feat: fetch activities for a given card
This commit is contained in:
5
src/server/db/migrations/0006_neat_korg.sql
Normal file
5
src/server/db/migrations/0006_neat_korg.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
DO $$ BEGIN
|
||||
ALTER TABLE "card_activity" ADD CONSTRAINT "card_activity_fromListId_list_id_fk" FOREIGN KEY ("fromListId") REFERENCES "list"("id") ON DELETE no action ON UPDATE no action;
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
1246
src/server/db/migrations/meta/0006_snapshot.json
Normal file
1246
src/server/db/migrations/meta/0006_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,13 @@
|
||||
"when": 1730813108528,
|
||||
"tag": "0005_blue_marvex",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 6,
|
||||
"version": "5",
|
||||
"when": 1730967400524,
|
||||
"tag": "0006_neat_korg",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -236,6 +236,40 @@ export const getWithListAndMembersByPublicId = async (
|
||||
id,
|
||||
name
|
||||
)
|
||||
),
|
||||
activities:card_activity (
|
||||
publicId,
|
||||
type,
|
||||
createdAt,
|
||||
fromIndex,
|
||||
toIndex,
|
||||
fromTitle,
|
||||
toTitle,
|
||||
fromDescription,
|
||||
toDescription,
|
||||
fromList:list!card_activity_fromListId_list_id_fk (
|
||||
publicId,
|
||||
name
|
||||
),
|
||||
toList:list!card_activity_toListId_list_id_fk (
|
||||
publicId,
|
||||
name
|
||||
),
|
||||
label!card_activity_labelId_label_id_fk (
|
||||
publicId,
|
||||
name
|
||||
),
|
||||
member:workspace_members!card_activity_workspaceMemberId_workspace_members_id_fk (
|
||||
publicId,
|
||||
user!workspace_members_userId_user_id_fk (
|
||||
id,
|
||||
name
|
||||
)
|
||||
),
|
||||
user!card_activity_createdBy_user_id_fk (
|
||||
id,
|
||||
name
|
||||
)
|
||||
)
|
||||
`,
|
||||
)
|
||||
@@ -349,6 +383,7 @@ export const hardDeleteCardMemberRelationship = async (
|
||||
.eq("cardId", args.cardId)
|
||||
.eq("workspaceMemberId", args.memberId)
|
||||
.select()
|
||||
.order("cardId", { ascending: true })
|
||||
.limit(1)
|
||||
.single();
|
||||
|
||||
|
||||
@@ -346,7 +346,9 @@ export const cardActivities = pgTable("card_activity", {
|
||||
.references(() => cards.id, { onDelete: "cascade" }),
|
||||
fromIndex: integer("fromIndex"),
|
||||
toIndex: integer("toIndex"),
|
||||
fromListId: bigint("fromListId", { mode: "number" }),
|
||||
fromListId: bigint("fromListId", { mode: "number" }).references(
|
||||
() => lists.id,
|
||||
),
|
||||
toListId: bigint("toListId", { mode: "number" }).references(() => lists.id),
|
||||
labelId: bigint("labelId", { mode: "number" }).references(() => labels.id),
|
||||
workspaceMemberId: bigint("workspaceMemberId", { mode: "number" }).references(
|
||||
|
||||
@@ -283,6 +283,13 @@ export type Database = {
|
||||
referencedRelation: "user";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
{
|
||||
foreignKeyName: "card_activity_fromListId_list_id_fk";
|
||||
columns: ["fromListId"];
|
||||
isOneToOne: false;
|
||||
referencedRelation: "list";
|
||||
referencedColumns: ["id"];
|
||||
},
|
||||
{
|
||||
foreignKeyName: "card_activity_labelId_label_id_fk";
|
||||
columns: ["labelId"];
|
||||
|
||||
Reference in New Issue
Block a user