Add Dockerfile, add raw view

This commit is contained in:
2025-12-21 13:27:12 +01:00
parent 9bb649c9e2
commit b1541f8777
35 changed files with 2811 additions and 78 deletions

10
src/lib/prisma.ts Normal file
View File

@ -0,0 +1,10 @@
import { PrismaPg } from '@prisma/adapter-pg';
import "dotenv/config";
import { PrismaClient } from '../generated/prisma/client';
const connectionString = `${process.env.DATABASE_URL}`
const adapter = new PrismaPg({ connectionString })
const prisma = new PrismaClient({ adapter })
export { prisma };

22
src/lib/s3.ts Normal file
View File

@ -0,0 +1,22 @@
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import "dotenv/config";
export const s3 = new S3Client({
region: "us-east-1",
endpoint: `${process.env.S3_ENDPOINT}`,
forcePathStyle: true,
credentials: {
accessKeyId: `${process.env.S3_ACCESSKEY}`,
secretAccessKey: `${process.env.S3_SECRET}`,
},
});
export async function getSignedImageUrl(key: string, expiresInSec = 3600) {
const command = new GetObjectCommand({
Bucket: `${process.env.BUCKET_NAME}`,
Key: key,
});
return getSignedUrl(s3, command, { expiresIn: expiresInSec });
}

6
src/lib/utils.ts Normal file
View File

@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}