lab4: вложения (proxy upload, download, уборщик), attachment_ids в сообщениях

This commit is contained in:
2026-10-22 22:28:54 +03:00
parent ec4e9fb608
commit 6fcc623447
23 changed files with 959 additions and 106 deletions
+15 -1
View File
@@ -16,6 +16,18 @@ async function bootstrap(): Promise<void> {
AppModule,
new FastifyAdapter({ logger: true }),
);
// Raw image bodies reach the controller as an unread stream: the upload is
// bounded by our own checks, not by Fastify's bodyLimit.
app.getHttpAdapter()
.getInstance()
.addContentTypeParser(
['image/png', 'image/jpeg'],
(
_request: unknown,
payload: unknown,
done: (error: Error | null, body?: unknown) => void,
) => done(null, payload),
);
app.useGlobalInterceptors(
new RequestIdInterceptor(
app.get(HttpAdapterHost),
@@ -50,7 +62,9 @@ async function bootstrap(): Promise<void> {
shuttingDown = true;
health.setDraining();
if (drainDelayMs > 0)
await new Promise<void>((resolve) => setTimeout(resolve, drainDelayMs));
await new Promise<void>((resolve) =>
setTimeout(resolve, drainDelayMs),
);
await app.close();
process.exit(0);
};