From 2702615b3419cb47c1f18ca72d8a3e41617b8f80 Mon Sep 17 00:00:00 2001 From: schreifuchs Date: Wed, 10 Dec 2025 19:16:18 +0100 Subject: [PATCH] feat: added comments --- drizzle/0004_wealthy_groot.sql | 1 + drizzle/meta/0004_snapshot.json | 436 ++++++++++++++++++ drizzle/meta/_journal.json | 7 + src/lib/components/rating/RatingCard.svelte | 31 ++ src/lib/components/rating/RatingEditor.svelte | 27 ++ src/lib/components/rating/RatingInput.svelte | 63 +++ src/lib/server/db/schema/akti.ts | 2 +- src/routes/akti/[aktiId]/+page.svelte | 22 + .../akti/[aktiId]/comment/+page.server.ts | 68 +++ src/routes/akti/[aktiId]/comment/+page.svelte | 10 + 10 files changed, 666 insertions(+), 1 deletion(-) create mode 100644 drizzle/0004_wealthy_groot.sql create mode 100644 drizzle/meta/0004_snapshot.json create mode 100644 src/lib/components/rating/RatingCard.svelte create mode 100644 src/lib/components/rating/RatingEditor.svelte create mode 100644 src/lib/components/rating/RatingInput.svelte create mode 100644 src/routes/akti/[aktiId]/comment/+page.server.ts create mode 100644 src/routes/akti/[aktiId]/comment/+page.svelte diff --git a/drizzle/0004_wealthy_groot.sql b/drizzle/0004_wealthy_groot.sql new file mode 100644 index 0000000..cd7d25c --- /dev/null +++ b/drizzle/0004_wealthy_groot.sql @@ -0,0 +1 @@ +ALTER TABLE "rating" ALTER COLUMN "comment" SET NOT NULL; \ No newline at end of file diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0004_snapshot.json new file mode 100644 index 0000000..b5a49ec --- /dev/null +++ b/drizzle/meta/0004_snapshot.json @@ -0,0 +1,436 @@ +{ + "id": "0528e286-2cd4-4447-a3a4-5a7c2cda83b9", + "prevId": "8f81af0f-3a4e-4fb8-b7f1-cf4e6eec7ecb", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "session_state": { + "name": "session_state", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.authenticator": { + "name": "authenticator", + "schema": "", + "columns": { + "credentialID": { + "name": "credentialID", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "providerAccountId": { + "name": "providerAccountId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credentialPublicKey": { + "name": "credentialPublicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "counter": { + "name": "counter", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "credentialDeviceType": { + "name": "credentialDeviceType", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credentialBackedUp": { + "name": "credentialBackedUp", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "transports": { + "name": "transports", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "authenticator_userId_user_id_fk": { + "name": "authenticator_userId_user_id_fk", + "tableFrom": "authenticator", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "authenticator_credentialID_unique": { + "name": "authenticator_credentialID_unique", + "nullsNotDistinct": false, + "columns": ["credentialID"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "sessionToken": { + "name": "sessionToken", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verificationToken": { + "name": "verificationToken", + "schema": "", + "columns": { + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires": { + "name": "expires", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "emailVerified": { + "name": "emailVerified", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": ["email"] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.akti": { + "name": "akti", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + } + }, + "indexes": {}, + "foreignKeys": { + "akti_user_id_user_id_fk": { + "name": "akti_user_id_user_id_fk", + "tableFrom": "akti", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rating": { + "name": "rating", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "akti_id": { + "name": "akti_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "rating": { + "name": "rating", + "type": "real", + "primaryKey": false, + "notNull": true + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "akti_version": { + "name": "akti_version", + "type": "integer", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "rating_akti_id_akti_id_fk": { + "name": "rating_akti_id_akti_id_fk", + "tableFrom": "rating", + "tableTo": "akti", + "columnsFrom": ["akti_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "rating_user_id_user_id_fk": { + "name": "rating_user_id_user_id_fk", + "tableFrom": "rating", + "tableTo": "user", + "columnsFrom": ["user_id"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 10aca36..c04f9ed 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -29,6 +29,13 @@ "when": 1764000151184, "tag": "0003_tranquil_iron_monger", "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1765385786051, + "tag": "0004_wealthy_groot", + "breakpoints": true } ] } diff --git a/src/lib/components/rating/RatingCard.svelte b/src/lib/components/rating/RatingCard.svelte new file mode 100644 index 0000000..c91783c --- /dev/null +++ b/src/lib/components/rating/RatingCard.svelte @@ -0,0 +1,31 @@ + + +
+ {#if rating.user} + + {/if} + {#if rating.outdated} + i + {/if} + +

{rating.comment}

+ + {#if rating.rating} + + {/if} +
diff --git a/src/lib/components/rating/RatingEditor.svelte b/src/lib/components/rating/RatingEditor.svelte new file mode 100644 index 0000000..001e951 --- /dev/null +++ b/src/lib/components/rating/RatingEditor.svelte @@ -0,0 +1,27 @@ + + +
+
+ +