chore: port lab5 solution as lab6 base

This commit is contained in:
2026-11-18 18:40:47 +03:00
parent 470d9d6f1e
commit 98d5787545
105 changed files with 21898 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import {
BucketAlreadyOwnedByYou,
CreateBucketCommand,
S3Client,
} from '@aws-sdk/client-s3';
import { execSync } from 'child_process';
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();
}
}