feat(storage): add RustFS attachments and presigned uploads

Add two API replicas, safe object reconciliation, upload validation, regression tests and documented load experiments.
This commit is contained in:
2026-11-12 10:16:39 +03:00
parent ec540a1a72
commit dc46ac213d
118 changed files with 44628 additions and 38 deletions
+6
View File
@@ -0,0 +1,6 @@
import { Global, Module } from '@nestjs/common';
import { PrismaService } from './prisma.service';
@Global()
@Module({ providers: [PrismaService], exports: [PrismaService] })
export class PrismaModule {}
+42
View File
@@ -0,0 +1,42 @@
import 'dotenv/config';
import {
Injectable,
type OnModuleDestroy,
type OnModuleInit,
} from '@nestjs/common';
import { PrismaPg } from '@prisma/adapter-pg';
import { PrismaClient } from '../generated/prisma/client';
@Injectable()
export class PrismaService
extends PrismaClient
implements OnModuleInit, OnModuleDestroy
{
constructor() {
const connectionString = process.env.DATABASE_URL;
if (!connectionString) throw new Error('DATABASE_URL is required');
const poolMax = Number(process.env.DB_POOL_MAX ?? 15);
if (!Number.isSafeInteger(poolMax) || poolMax < 1) {
throw new Error('DB_POOL_MAX must be a positive integer');
}
super({
adapter: new PrismaPg({
connectionString,
max: poolMax,
connectionTimeoutMillis: 5000,
query_timeout: 5000,
idleTimeoutMillis: 30000,
options: '-c statement_timeout=5000',
}),
transactionOptions: { maxWait: 5000, timeout: 10000 },
});
}
async onModuleInit(): Promise<void> {
await this.$connect();
}
async onModuleDestroy(): Promise<void> {
await this.$disconnect();
}
}