Add comprehensive documentation for employee learning platform

- Created handover document outlining design decisions and application functionality.
- Developed implementation plan detailing phased approach for service development.
- Specified ingestion service responsibilities, API surface, and processing pipeline.
This commit is contained in:
RaymondVerhoef
2026-05-23 15:38:09 +02:00
parent 881148357e
commit dda20612e9
32 changed files with 3519 additions and 573 deletions

View File

@@ -0,0 +1,29 @@
import type { FastifyPluginAsync } from 'fastify';
import { IngestBodySchema } from '../types.js';
import { createJob, getJob } from '../jobs/queue.js';
const documentRoutes: FastifyPluginAsync = async (app) => {
app.post('/ingest', async (request, reply) => {
const parsed = IngestBodySchema.safeParse(request.body);
if (!parsed.success) {
return reply.status(400).send({ error: 'Invalid request body', details: parsed.error.format() });
}
const job = createJob(parsed.data);
return reply.status(202).send({ jobId: job.id, status: job.status });
});
app.get<{ Params: { jobId: string } }>('/status/:jobId', async (request, reply) => {
const job = getJob(request.params.jobId);
if (!job) {
return reply.status(404).send({ error: 'Job not found' });
}
return reply.send({
jobId: job.id,
status: job.status,
progress: job.progress,
error: job.error,
});
});
};
export default documentRoutes;