diff --git a/plice/src/lib/server/db/index.ts b/plice/src/lib/server/db/index.ts index 4413eb6..5797fe9 100644 --- a/plice/src/lib/server/db/index.ts +++ b/plice/src/lib/server/db/index.ts @@ -1,4 +1,4 @@ -import type { Track, TrackVersion } from '@prisma/client'; +import type { Comment, Track, TrackVersion } from '@prisma/client'; export interface Database { fetchHomepageData: (producerId: string) => Promise< @@ -46,5 +46,5 @@ export interface Database { createTrack: (producerId: string, title: string) => Promise; createTrackVersion: (trackId: number) => Promise; - createComment: (versionId: string, userId: string, content: string) => Promise; + createComment: (versionId: string, userId: string, content: string) => Promise; } diff --git a/plice/src/lib/server/db/prisma.ts b/plice/src/lib/server/db/prisma.ts index 2b025b9..5efb0b5 100644 --- a/plice/src/lib/server/db/prisma.ts +++ b/plice/src/lib/server/db/prisma.ts @@ -123,8 +123,13 @@ export class DatabasePrisma implements Database { }); }; - createComment = async (_versionId: string, _userId: string, _content: string) => { - // TODO - return null; + createComment = async (versionId: string, userId: string, content: string) => { + return await this.client.comment.create({ + data: { + content, + authorId: userId, + trackVersionId: versionId + } + }); }; }