feat: allow users to delete entities they have created
This commit is contained in:
@@ -518,6 +518,7 @@ export const getWithListIdsByPublicId = (
|
||||
columns: {
|
||||
id: true,
|
||||
workspaceId: true,
|
||||
createdBy: true,
|
||||
},
|
||||
with: {
|
||||
lists: {
|
||||
@@ -671,6 +672,7 @@ export const getWorkspaceAndBoardIdByBoardPublicId = async (
|
||||
columns: {
|
||||
id: true,
|
||||
workspaceId: true,
|
||||
createdBy: true,
|
||||
},
|
||||
where: eq(boards.publicId, boardPublicId),
|
||||
});
|
||||
|
||||
@@ -424,6 +424,7 @@ export const getWithListAndMembersByPublicId = async (
|
||||
title: true,
|
||||
description: true,
|
||||
dueDate: true,
|
||||
createdBy: true,
|
||||
},
|
||||
with: {
|
||||
labels: {
|
||||
@@ -938,7 +939,7 @@ export const getWorkspaceAndCardIdByCardPublicId = async (
|
||||
cardPublicId: string,
|
||||
) => {
|
||||
const result = await db.query.cards.findFirst({
|
||||
columns: { id: true },
|
||||
columns: { id: true, createdBy: true },
|
||||
where: and(eq(cards.publicId, cardPublicId), isNull(cards.deletedAt)),
|
||||
with: {
|
||||
list: {
|
||||
@@ -958,6 +959,7 @@ export const getWorkspaceAndCardIdByCardPublicId = async (
|
||||
return result
|
||||
? {
|
||||
id: result.id,
|
||||
createdBy: result.createdBy,
|
||||
workspaceId: result.list.board.workspaceId,
|
||||
workspaceVisibility: result.list.board.visibility,
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ export const getWorkspaceAndListIdByListPublicId = async (
|
||||
listPublicId: string,
|
||||
) => {
|
||||
const result = await db.query.lists.findFirst({
|
||||
columns: { id: true },
|
||||
columns: { id: true, createdBy: true },
|
||||
where: and(eq(lists.publicId, listPublicId), isNull(lists.deletedAt)),
|
||||
with: {
|
||||
board: {
|
||||
@@ -431,6 +431,10 @@ export const getWorkspaceAndListIdByListPublicId = async (
|
||||
});
|
||||
|
||||
return result
|
||||
? { id: result.id, workspaceId: result.board.workspaceId }
|
||||
? {
|
||||
id: result.id,
|
||||
createdBy: result.createdBy,
|
||||
workspaceId: result.board.workspaceId,
|
||||
}
|
||||
: null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user