chore: commit all current changes
This commit is contained in:
@@ -4,7 +4,7 @@ import { auth } from '@/lib/auth';
|
||||
import { requireAuthenticatedSession } from '@/lib/server/auth-session';
|
||||
import { asErrorMessage, jsonError } from '@/lib/server/http';
|
||||
import { buildPortfolioSummary } from '@/lib/server/portfolio';
|
||||
import { listFilingsRecords } from '@/lib/server/repos/filings';
|
||||
import { getFilingByAccession, listFilingsRecords } from '@/lib/server/repos/filings';
|
||||
import {
|
||||
deleteHoldingByIdRecord,
|
||||
listUserHoldings,
|
||||
@@ -386,6 +386,47 @@ export const app = new Elysia({ prefix: '/api' })
|
||||
ticker: t.String({ minLength: 1 })
|
||||
})
|
||||
})
|
||||
.get('/analysis/reports/:accessionNumber', async ({ params }) => {
|
||||
const { response } = await requireAuthenticatedSession();
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
|
||||
const accessionNumber = params.accessionNumber?.trim() ?? '';
|
||||
if (accessionNumber.length < 4) {
|
||||
return jsonError('Invalid accession number');
|
||||
}
|
||||
|
||||
const filing = await getFilingByAccession(accessionNumber);
|
||||
if (!filing) {
|
||||
return jsonError('AI summary not found', 404);
|
||||
}
|
||||
|
||||
const summary = filing.analysis?.text ?? filing.analysis?.legacyInsights ?? '';
|
||||
if (!summary) {
|
||||
return jsonError('AI summary not found', 404);
|
||||
}
|
||||
|
||||
return Response.json({
|
||||
report: {
|
||||
accessionNumber: filing.accession_number,
|
||||
ticker: filing.ticker,
|
||||
companyName: filing.company_name,
|
||||
filingDate: filing.filing_date,
|
||||
filingType: filing.filing_type,
|
||||
provider: filing.analysis?.provider ?? 'unknown',
|
||||
model: filing.analysis?.model ?? 'unknown',
|
||||
summary,
|
||||
filingUrl: filing.filing_url,
|
||||
submissionUrl: filing.submission_url ?? null,
|
||||
primaryDocument: filing.primary_document ?? null
|
||||
}
|
||||
});
|
||||
}, {
|
||||
params: t.Object({
|
||||
accessionNumber: t.String({ minLength: 4 })
|
||||
})
|
||||
})
|
||||
.get('/filings', async ({ query }) => {
|
||||
const { response } = await requireAuthenticatedSession();
|
||||
if (response) {
|
||||
|
||||
Reference in New Issue
Block a user