-
Notifications
You must be signed in to change notification settings - Fork 9
feat(PM-2177): modified schema to support vote tracking #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
08b0321
feat: modified schema to support vote tracking
hentrymartin 866b227
fix: updated upVote and downVote logic
hentrymartin 16418fc
fix: updated upVote and downVote logic
hentrymartin f24042d
fix: updated upVote and downVote logic
hentrymartin 2b5ecd5
fix: review comments
hentrymartin fbe4a61
fix: review comments
hentrymartin efc9371
fix: review comments
hentrymartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
prisma/migrations/20251113212614_add_vote_tracking_to_ai_workflow_run_items/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| Warnings: | ||
| - You are about to drop the column `downVotes` on the `aiWorkflowRunItem` table. All the data in the column will be lost. | ||
| - You are about to drop the column `upVotes` on the `aiWorkflowRunItem` table. All the data in the column will be lost. | ||
| - You are about to drop the column `downVotes` on the `aiWorkflowRunItemComment` table. All the data in the column will be lost. | ||
| - You are about to drop the column `upVotes` on the `aiWorkflowRunItemComment` table. All the data in the column will be lost. | ||
| */ | ||
| -- CreateEnum | ||
| CREATE TYPE "VoteType" AS ENUM ('UPVOTE', 'DOWNVOTE'); | ||
|
|
||
| -- AlterTable | ||
| ALTER TABLE "aiWorkflowRunItem" DROP COLUMN "downVotes", | ||
| DROP COLUMN "upVotes"; | ||
|
|
||
| -- AlterTable | ||
| ALTER TABLE "aiWorkflowRunItemComment" DROP COLUMN "downVotes", | ||
| DROP COLUMN "upVotes"; | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "aiWorkflowRunItemVote" ( | ||
| "id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
| "workflowRunItemId" VARCHAR(14) NOT NULL, | ||
| "voteType" "VoteType" NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "createdBy" TEXT, | ||
|
|
||
| CONSTRAINT "aiWorkflowRunItemVote_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "aiWorkflowRunItemCommentVote" ( | ||
| "id" VARCHAR(14) NOT NULL DEFAULT nanoid(), | ||
| "workflowRunItemCommentId" VARCHAR(14) NOT NULL, | ||
| "voteType" "VoteType" NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "createdBy" TEXT, | ||
hentrymartin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| CONSTRAINT "aiWorkflowRunItemCommentVote_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "aiWorkflowRunItemVote_workflowRunItemId_idx" ON "aiWorkflowRunItemVote"("workflowRunItemId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "aiWorkflowRunItemCommentVote_workflowRunItemCommentId_idx" ON "aiWorkflowRunItemCommentVote"("workflowRunItemCommentId"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "aiWorkflowRunItemVote" ADD CONSTRAINT "aiWorkflowRunItemVote_workflowRunItemId_fkey" FOREIGN KEY ("workflowRunItemId") REFERENCES "aiWorkflowRunItem"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "aiWorkflowRunItemCommentVote" ADD CONSTRAINT "aiWorkflowRunItemCommentVote_workflowRunItemCommentId_fkey" FOREIGN KEY ("workflowRunItemCommentId") REFERENCES "aiWorkflowRunItemComment"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ import { | |
| IsUUID, | ||
| Max, | ||
| IsEmpty, | ||
| IsBoolean, | ||
| } from 'class-validator'; | ||
| import { Type, Transform } from 'class-transformer'; | ||
|
|
||
|
|
@@ -134,15 +135,13 @@ export class CreateAiWorkflowRunItemDto { | |
|
|
||
| @ApiProperty({ required: false }) | ||
| @IsOptional() | ||
| @IsInt() | ||
| @Min(0) | ||
| upVotes?: number; | ||
| @IsBoolean() | ||
kkartunov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| upVote?: boolean; | ||
|
|
||
| @ApiProperty({ required: false }) | ||
| @IsOptional() | ||
| @IsInt() | ||
| @Min(0) | ||
| downVotes?: number; | ||
| @IsBoolean() | ||
| downVote?: boolean; | ||
hentrymartin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @ApiProperty({ required: false }) | ||
| @IsOptional() | ||
|
|
@@ -204,12 +203,12 @@ export class UpdateRunItemCommentDto { | |
| @ApiProperty({ required: false }) | ||
| @IsInt() | ||
| @IsOptional() | ||
| upVotes?: number; | ||
| upVote?: number; | ||
|
||
|
|
||
| @ApiProperty({ required: false }) | ||
| @IsInt() | ||
| @IsOptional() | ||
| downVotes?: number; | ||
| downVote?: number; | ||
hentrymartin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @ApiHideProperty() | ||
| @IsEmpty({ message: 'parentId cannot be updated' }) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.