feat: update repo funcs
This commit is contained in:
@@ -164,6 +164,7 @@ export const getByPublicId = async (
|
|||||||
description: true,
|
description: true,
|
||||||
listId: true,
|
listId: true,
|
||||||
index: true,
|
index: true,
|
||||||
|
dueDate: true,
|
||||||
},
|
},
|
||||||
with: {
|
with: {
|
||||||
labels: {
|
labels: {
|
||||||
@@ -353,6 +354,7 @@ export const getBySlug = async (
|
|||||||
description: true,
|
description: true,
|
||||||
listId: true,
|
listId: true,
|
||||||
index: true,
|
index: true,
|
||||||
|
dueDate: true,
|
||||||
},
|
},
|
||||||
with: {
|
with: {
|
||||||
labels: {
|
labels: {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export const create = async (
|
|||||||
createdBy: string;
|
createdBy: string;
|
||||||
listId: number;
|
listId: number;
|
||||||
position: "start" | "end";
|
position: "start" | "end";
|
||||||
|
dueDate?: Date | null;
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
return db.transaction(async (tx) => {
|
return db.transaction(async (tx) => {
|
||||||
@@ -71,6 +72,7 @@ export const create = async (
|
|||||||
createdBy: cardInput.createdBy,
|
createdBy: cardInput.createdBy,
|
||||||
listId: cardInput.listId,
|
listId: cardInput.listId,
|
||||||
index: index,
|
index: index,
|
||||||
|
dueDate: cardInput.dueDate ?? null,
|
||||||
})
|
})
|
||||||
.returning({ id: cards.id, listId: cards.listId });
|
.returning({ id: cards.id, listId: cards.listId });
|
||||||
|
|
||||||
@@ -163,6 +165,7 @@ export const update = async (
|
|||||||
cardInput: {
|
cardInput: {
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
dueDate?: Date | null;
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
cardPublicId: string;
|
cardPublicId: string;
|
||||||
@@ -173,6 +176,8 @@ export const update = async (
|
|||||||
.set({
|
.set({
|
||||||
title: cardInput.title,
|
title: cardInput.title,
|
||||||
description: cardInput.description,
|
description: cardInput.description,
|
||||||
|
dueDate: cardInput.dueDate !== undefined ? cardInput.dueDate : undefined,
|
||||||
|
updatedAt: new Date(),
|
||||||
})
|
})
|
||||||
.where(and(eq(cards.publicId, args.cardPublicId), isNull(cards.deletedAt)))
|
.where(and(eq(cards.publicId, args.cardPublicId), isNull(cards.deletedAt)))
|
||||||
.returning({
|
.returning({
|
||||||
@@ -180,6 +185,7 @@ export const update = async (
|
|||||||
publicId: cards.publicId,
|
publicId: cards.publicId,
|
||||||
title: cards.title,
|
title: cards.title,
|
||||||
description: cards.description,
|
description: cards.description,
|
||||||
|
dueDate: cards.dueDate,
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -214,6 +220,7 @@ export const getByPublicId = (db: dbClient, cardPublicId: string) => {
|
|||||||
title: true,
|
title: true,
|
||||||
description: true,
|
description: true,
|
||||||
listId: true,
|
listId: true,
|
||||||
|
dueDate: true,
|
||||||
},
|
},
|
||||||
where: eq(cards.publicId, cardPublicId),
|
where: eq(cards.publicId, cardPublicId),
|
||||||
});
|
});
|
||||||
@@ -397,6 +404,7 @@ export const getWithListAndMembersByPublicId = async (
|
|||||||
publicId: true,
|
publicId: true,
|
||||||
title: true,
|
title: true,
|
||||||
description: true,
|
description: true,
|
||||||
|
dueDate: true,
|
||||||
},
|
},
|
||||||
with: {
|
with: {
|
||||||
labels: {
|
labels: {
|
||||||
@@ -780,6 +788,7 @@ export const reorder = async (
|
|||||||
publicId: true,
|
publicId: true,
|
||||||
title: true,
|
title: true,
|
||||||
description: true,
|
description: true,
|
||||||
|
dueDate: true,
|
||||||
},
|
},
|
||||||
where: eq(cards.id, card.id),
|
where: eq(cards.id, card.id),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export const create = async (
|
|||||||
commentId?: number;
|
commentId?: number;
|
||||||
fromComment?: string;
|
fromComment?: string;
|
||||||
toComment?: string;
|
toComment?: string;
|
||||||
|
fromDueDate?: Date;
|
||||||
|
toDueDate?: Date;
|
||||||
sourceBoardId?: number;
|
sourceBoardId?: number;
|
||||||
},
|
},
|
||||||
) => {
|
) => {
|
||||||
@@ -45,6 +47,8 @@ export const create = async (
|
|||||||
commentId: activityInput.commentId,
|
commentId: activityInput.commentId,
|
||||||
fromComment: activityInput.fromComment,
|
fromComment: activityInput.fromComment,
|
||||||
toComment: activityInput.toComment,
|
toComment: activityInput.toComment,
|
||||||
|
fromDueDate: activityInput.fromDueDate,
|
||||||
|
toDueDate: activityInput.toDueDate,
|
||||||
sourceBoardId: activityInput.sourceBoardId,
|
sourceBoardId: activityInput.sourceBoardId,
|
||||||
})
|
})
|
||||||
.returning({ id: cardActivities.id });
|
.returning({ id: cardActivities.id });
|
||||||
@@ -68,6 +72,8 @@ export const bulkCreate = async (
|
|||||||
fromDescription?: string;
|
fromDescription?: string;
|
||||||
toDescription?: string;
|
toDescription?: string;
|
||||||
createdBy: string;
|
createdBy: string;
|
||||||
|
fromDueDate?: Date;
|
||||||
|
toDueDate?: Date;
|
||||||
sourceBoardId?: number;
|
sourceBoardId?: number;
|
||||||
}[],
|
}[],
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user