EENE Dashboard upload to Gitea
This commit is contained in:
@@ -2,12 +2,20 @@ export interface TaskIssueEntry {
|
||||
id: string;
|
||||
text: string;
|
||||
showOnCard: boolean;
|
||||
occurredOn?: string | null;
|
||||
}
|
||||
|
||||
function newIssueId() {
|
||||
return `issue-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
||||
}
|
||||
|
||||
function normalizeOccurredOn(raw: unknown): string | null {
|
||||
if (typeof raw !== 'string' || !raw.trim()) return null;
|
||||
const iso = raw.trim();
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(iso)) return null;
|
||||
return iso;
|
||||
}
|
||||
|
||||
export function normalizeIssueEntries(raw: unknown): TaskIssueEntry[] {
|
||||
if (!Array.isArray(raw)) return [];
|
||||
const entries: TaskIssueEntry[] = [];
|
||||
@@ -20,6 +28,7 @@ export function normalizeIssueEntries(raw: unknown): TaskIssueEntry[] {
|
||||
id: typeof row.id === 'string' && row.id ? row.id : newIssueId(),
|
||||
text,
|
||||
showOnCard: row.showOnCard !== false,
|
||||
occurredOn: normalizeOccurredOn(row.occurredOn),
|
||||
});
|
||||
}
|
||||
return entries;
|
||||
@@ -34,7 +43,7 @@ export function parseIssueEntriesFromTask(task: {
|
||||
if (fromJson.length > 0) return fromJson;
|
||||
const legacy = task.issueNote?.trim();
|
||||
if (!legacy) return [];
|
||||
return [{ id: 'legacy', text: legacy, showOnCard: task.showIssue !== false }];
|
||||
return [{ id: 'legacy', text: legacy, showOnCard: task.showIssue !== false, occurredOn: null }];
|
||||
}
|
||||
|
||||
export function deriveIssueFields(entries: TaskIssueEntry[]) {
|
||||
|
||||
@@ -25,6 +25,18 @@ export const taskInclude = {
|
||||
taskAssignees: {
|
||||
include: { member: { select: teamMemberSelect } },
|
||||
},
|
||||
milestones: {
|
||||
orderBy: { order: 'asc' as const },
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
progress: true,
|
||||
startDate: true,
|
||||
dueDate: true,
|
||||
periodEntries: true,
|
||||
order: true,
|
||||
},
|
||||
},
|
||||
_count: { select: { files: true, details: true } },
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ router.get('/:id', async (req, res, next) => {
|
||||
router.post('/', async (req, res, next) => {
|
||||
try {
|
||||
const body = req.body as Record<string, any>;
|
||||
const { title, description, status, priority, quarter, category,
|
||||
const { title, description, detailDescription, status, priority, quarter, category,
|
||||
section, tag, taskType, progress, issueNote, startDate, dueDate, assigneeId, showDate,
|
||||
showDescription, showStatus, showIssue, showProgress, pmMemberId } = body;
|
||||
|
||||
@@ -88,6 +88,7 @@ router.post('/', async (req, res, next) => {
|
||||
data: {
|
||||
title,
|
||||
description,
|
||||
detailDescription: detailDescription ?? null,
|
||||
status: (status as any) || 'TODO',
|
||||
priority: (priority as any) || 'MEDIUM',
|
||||
quarter,
|
||||
@@ -135,7 +136,7 @@ router.patch('/:id', async (req, res, next) => {
|
||||
if (!existing) throw new AppError(404, '업무를 찾을 수 없습니다.');
|
||||
|
||||
const body = req.body as Record<string, any>;
|
||||
const { title, description, status, priority, quarter, category,
|
||||
const { title, description, detailDescription, status, priority, quarter, category,
|
||||
section, tag, taskType, progress, issueNote, startDate, dueDate, assigneeId, showDate,
|
||||
showDescription, showStatus, showIssue, showProgress, pmMemberId } = body;
|
||||
|
||||
@@ -147,6 +148,7 @@ router.patch('/:id', async (req, res, next) => {
|
||||
data: {
|
||||
...(title && { title }),
|
||||
...(description !== undefined && { description }),
|
||||
...(detailDescription !== undefined && { detailDescription: detailDescription || null }),
|
||||
...(status && { status: status as any }),
|
||||
...(priority && { priority: priority as any }),
|
||||
...(quarter && { quarter }),
|
||||
|
||||
Reference in New Issue
Block a user