Feature: user upload artwork

This commit is contained in:
2025-10-25 02:22:39 -04:00
parent 28d0443f44
commit deb163bd70
23 changed files with 1288 additions and 177 deletions

View File

@@ -27,3 +27,20 @@ CREATE TRIGGER update_users_updated_at
BEFORE UPDATE ON "public"."Users"
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();
-- 5. Define the Artworks table
CREATE TABLE "public"."Artworks" (
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
"title" CITEXT UNIQUE NOT NULL,
"filename" TEXT NOT NULL,
"mimetype" TEXT NOT NULL,
"size" INTEGER NOT NULL,
"created_at" TIMESTAMPTZ NOT NULL DEFAULT NOW(),
"updated_at" TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- 6. Create the trigger and attach it to the Artworks table
CREATE TRIGGER update_artworks_updated_at
BEFORE UPDATE ON "public"."Artworks"
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();

View File

@@ -8,10 +8,20 @@ datasource db {
url = env("DATABASE_URL")
}
model Artworks {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
title String @unique @db.Text
filename String
mimetype String
size Int
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)
}
model Users {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
username String @unique @db.Citext
email String @unique @db.Citext
username String @unique @db.Text
email String @unique @db.Text
hashed_password String
created_at DateTime @default(now()) @db.Timestamptz(6)
updated_at DateTime @default(now()) @db.Timestamptz(6)