feat(research): inspect scoped stored market data (RP01)
This commit is contained in:
parent
b4ac6460ef
commit
5bfaf37d08
12 changed files with 1592 additions and 3 deletions
|
|
@ -14,6 +14,11 @@ import {
|
|||
prepareStoredDataset,
|
||||
StoredDatasetPreparationError,
|
||||
} from '../services/stored-dataset-preparation';
|
||||
import {
|
||||
inspectStoredSource,
|
||||
storedSourceCoverage,
|
||||
StoredSourceInspectionError,
|
||||
} from '../services/stored-source-inspection';
|
||||
|
||||
const logger = getLogger('dataset-catalog-routes');
|
||||
|
||||
|
|
@ -28,6 +33,47 @@ export function createDatasetRoutes(container: IServiceContainer) {
|
|||
throw new DatasetPreparationError(400, 'Invalid JSON request');
|
||||
}
|
||||
};
|
||||
app.get('/api/v2/datasets/stored-eod/coverage', async c => {
|
||||
c.header('Cache-Control', 'no-store');
|
||||
try {
|
||||
return c.json(await storedSourceCoverage(container.mongodb, c.req.query(), c.req.raw.signal));
|
||||
} catch (error) {
|
||||
if (c.req.raw.signal.aborted) {
|
||||
return Response.json(
|
||||
{ error: 'Stored source inspection cancelled' },
|
||||
{ status: 499, headers: { 'Cache-Control': 'no-store' } }
|
||||
);
|
||||
}
|
||||
if (error instanceof StoredSourceInspectionError) {
|
||||
return c.json({ error: error.message }, error.status);
|
||||
}
|
||||
logger.error('Failed to inspect stored source coverage', error);
|
||||
return c.json({ error: 'Stored source coverage unavailable' }, 500);
|
||||
}
|
||||
});
|
||||
app.post('/api/v2/datasets/stored-eod/inspect', async c => {
|
||||
c.header('Cache-Control', 'no-store');
|
||||
try {
|
||||
return c.json(
|
||||
await inspectStoredSource(container.mongodb, await readBody(c.req.raw), c.req.raw.signal)
|
||||
);
|
||||
} catch (error) {
|
||||
if (c.req.raw.signal.aborted) {
|
||||
return Response.json(
|
||||
{ error: 'Stored source inspection cancelled' },
|
||||
{ status: 499, headers: { 'Cache-Control': 'no-store' } }
|
||||
);
|
||||
}
|
||||
if (
|
||||
error instanceof StoredSourceInspectionError ||
|
||||
error instanceof DatasetPreparationError
|
||||
) {
|
||||
return c.json({ error: error.message }, error.status);
|
||||
}
|
||||
logger.error('Failed to inspect stored source quality', error);
|
||||
return c.json({ error: 'Stored source inspection unavailable' }, 500);
|
||||
}
|
||||
});
|
||||
app.post('/api/v2/datasets/canonical/stored-source', async c => {
|
||||
c.header('Cache-Control', 'no-store');
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue