fix: include createdAt and updatedAt in ColumnPayload mapping
This commit is contained in:
Vendored
+27
-10
@@ -14,6 +14,7 @@ export class BoardService {
|
||||
title: title.trim() || 'Agile Kanban Board',
|
||||
adminKeyHash,
|
||||
memberKeyHash,
|
||||
memberKey,
|
||||
autoMoveStale: false,
|
||||
columns: {
|
||||
create: [
|
||||
@@ -79,24 +80,24 @@ export class BoardService {
|
||||
boardId: col.boardId,
|
||||
title: col.title,
|
||||
order: col.order,
|
||||
maxWipLimit: col.maxWipLimit || 0,
|
||||
autoStaleHours: col.autoStaleHours || 0,
|
||||
maxWipLimit: col.maxWipLimit,
|
||||
autoStaleHours: col.autoStaleHours,
|
||||
createdAt: col.createdAt.toISOString(),
|
||||
updatedAt: col.updatedAt.toISOString(),
|
||||
tickets: col.tickets.map((t) => {
|
||||
let parsedTags = [];
|
||||
let parsedSubtasks = [];
|
||||
let tags = [];
|
||||
let subtasks = [];
|
||||
try {
|
||||
parsedTags = JSON.parse(t.tags || '[]');
|
||||
tags = JSON.parse(t.tags || '[]');
|
||||
}
|
||||
catch {
|
||||
parsedTags = [];
|
||||
tags = [];
|
||||
}
|
||||
try {
|
||||
parsedSubtasks = JSON.parse(t.subtasks || '[]');
|
||||
subtasks = JSON.parse(t.subtasks || '[]');
|
||||
}
|
||||
catch {
|
||||
parsedSubtasks = [];
|
||||
subtasks = [];
|
||||
}
|
||||
return {
|
||||
id: t.id,
|
||||
@@ -105,8 +106,8 @@ export class BoardService {
|
||||
description: t.description,
|
||||
order: t.order,
|
||||
priority: t.priority,
|
||||
tags: parsedTags,
|
||||
subtasks: parsedSubtasks,
|
||||
tags,
|
||||
subtasks,
|
||||
dueDate: t.dueDate || null,
|
||||
isBlocked: t.isBlocked || false,
|
||||
blockedReason: t.blockedReason || null,
|
||||
@@ -117,10 +118,25 @@ export class BoardService {
|
||||
};
|
||||
}),
|
||||
}));
|
||||
let memberKeyVal = board.memberKey || '';
|
||||
if (!memberKeyVal && role === 'admin') {
|
||||
const newMemberKey = generateSecureKey(32);
|
||||
const newMemberKeyHash = hashKey(newMemberKey);
|
||||
await prisma.board.update({
|
||||
where: { id: boardId },
|
||||
data: {
|
||||
memberKey: newMemberKey,
|
||||
memberKeyHash: newMemberKeyHash,
|
||||
},
|
||||
});
|
||||
memberKeyVal = newMemberKey;
|
||||
}
|
||||
return {
|
||||
id: board.id,
|
||||
title: board.title,
|
||||
role,
|
||||
memberKey: memberKeyVal,
|
||||
memberUrlFragment: memberKeyVal ? `/b/${board.id}#member=${memberKeyVal}` : '',
|
||||
autoMoveStale: board.autoMoveStale || false,
|
||||
columns,
|
||||
createdAt: board.createdAt.toISOString(),
|
||||
@@ -137,6 +153,7 @@ export class BoardService {
|
||||
where: { id: boardId },
|
||||
data: {
|
||||
memberKeyHash: newMemberKeyHash,
|
||||
memberKey: newMemberKey,
|
||||
},
|
||||
});
|
||||
return {
|
||||
|
||||
Vendored
+2
@@ -30,6 +30,8 @@ export interface BoardPayload {
|
||||
id: string;
|
||||
title: string;
|
||||
role: Role;
|
||||
memberKey?: string;
|
||||
memberUrlFragment?: string;
|
||||
autoMoveStale: boolean;
|
||||
columns: ColumnPayload[];
|
||||
createdAt: string;
|
||||
|
||||
Reference in New Issue
Block a user