mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 06:54:28 +00:00
feat(comment): add emoji reaction support for comments (#405)
* feat(comment): add emoji reaction support for comments * fix(webui): adjust emoji picker trigger icon size to match mark-done icon * fix(webui): prevent search icon and placeholder overlap in emoji picker * fix(webui): use normal text color for reaction count * feat(db): limit comment reaction code column to VarChar(32)
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "asset_comment_reactions" (
|
||||
"id" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"comment_id" TEXT NOT NULL,
|
||||
"user_id" TEXT NOT NULL,
|
||||
"code" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "asset_comment_reactions_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "asset_comment_reactions_comment_id_idx" ON "asset_comment_reactions"("comment_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "asset_comment_reactions_comment_id_user_id_code_key" ON "asset_comment_reactions"("comment_id", "user_id", "code");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comment_reactions" ADD CONSTRAINT "asset_comment_reactions_comment_id_fkey" FOREIGN KEY ("comment_id") REFERENCES "asset_comments"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "asset_comment_reactions" ADD CONSTRAINT "asset_comment_reactions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `code` on the `asset_comment_reactions` table. The data in that column could be lost. The data in that column will be cast from `Text` to `VarChar(32)`.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "asset_comment_reactions" ALTER COLUMN "code" SET DATA TYPE VARCHAR(32);
|
||||
@@ -218,6 +218,7 @@ model User {
|
||||
teamMembers TeamMember[] @relation("UserToTeamMember")
|
||||
comments AssetComment[] @relation("UserToAssetComment")
|
||||
completionChangedComments AssetComment[] @relation("UserToAssetCommentCompletionChanged")
|
||||
commentReactions AssetCommentReaction[] @relation("UserToAssetCommentReaction")
|
||||
createdInvites Invite[] @relation("UserToInvite")
|
||||
createdNotifications Notification[] @relation("UserToCreatedNotification")
|
||||
notifications Notification[] @relation("UserToNotification")
|
||||
@@ -656,6 +657,7 @@ model AssetComment {
|
||||
replies AssetComment[] @relation("CommentReplies")
|
||||
|
||||
attachments AssetCommentAttachment[] @relation("CommentToAttachment")
|
||||
reactions AssetCommentReaction[] @relation("CommentToReaction")
|
||||
|
||||
@@index([assetId])
|
||||
@@map("asset_comments")
|
||||
@@ -675,6 +677,23 @@ model AssetCommentAttachment {
|
||||
@@map("asset_comment_attachments")
|
||||
}
|
||||
|
||||
model AssetCommentReaction {
|
||||
id String @id @default(ulid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
commentId String @map("comment_id")
|
||||
comment AssetComment @relation("CommentToReaction", fields: [commentId], references: [id], onDelete: Cascade)
|
||||
|
||||
userId String @map("user_id")
|
||||
user User @relation("UserToAssetCommentReaction", fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
code String @db.VarChar(32)
|
||||
|
||||
@@unique([commentId, userId, code])
|
||||
@@index([commentId])
|
||||
@@map("asset_comment_reactions")
|
||||
}
|
||||
|
||||
model AssetEmbedding {
|
||||
id String @id @default(ulid())
|
||||
embedding Unsupported("vector(1536)")?
|
||||
|
||||
Reference in New Issue
Block a user