feat: add attachment upload with streaming and image validation

This commit is contained in:
2026-11-05 15:05:36 +03:00
parent d960734dae
commit fa0211eecb
20 changed files with 3252 additions and 15 deletions
+24 -1
View File
@@ -1,5 +1,28 @@
import {
BucketAlreadyOwnedByYou,
CreateBucketCommand,
S3Client,
} from '@aws-sdk/client-s3';
import { execSync } from 'child_process';
export default function globalSetup(): void {
export default async function globalSetup(): Promise<void> {
execSync('npx prisma migrate deploy', { stdio: 'inherit' });
const client = new S3Client({
endpoint: process.env.S3_ENDPOINT,
region: 'us-east-1',
forcePathStyle: true,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID!,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
},
});
try {
await client.send(new CreateBucketCommand({ Bucket: process.env.S3_BUCKET! }));
} catch (error) {
if (!(error instanceof BucketAlreadyOwnedByYou)) {
throw error;
}
} finally {
client.destroy();
}
}