3bb2ef2759
Fix latent API bug where multi-word fields (RecurrenceDuration, ParentUUID, CreatedAt) serialized as PascalCase, breaking the frontend. Add explicit snake_case json tags and custom MarshalJSON/UnmarshalJSON on Task, Status, and APIKey to emit unix timestamps and string status codes. Add Urgency float64 as a derived field on Task, populated via PopulateUrgency helper in all handlers before serialization. The report engine's sortByUrgency now also retains the computed score. Frontend updated with urgency type, color-coded badge in TaskItem, and mock data values. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
316 lines
6.7 KiB
JavaScript
316 lines
6.7 KiB
JavaScript
/**
|
|
* Mock task data for local development / design review.
|
|
* Covers a realistic spread of projects, priorities, tags, due dates, and statuses.
|
|
*/
|
|
|
|
const now = Math.floor(Date.now() / 1000);
|
|
const HOUR = 3600;
|
|
const DAY = 86400;
|
|
|
|
/** @type {import('$lib/api/types.js').Task[]} */
|
|
export const mockTasks = [
|
|
// ── Pending tasks ────────────────────────────────────────────
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111101',
|
|
id: 1,
|
|
status: 'P',
|
|
description: 'Set up Caddy reverse proxy for opal-web',
|
|
project: 'Infrastructure',
|
|
priority: 3,
|
|
created: now - 7 * DAY,
|
|
modified: now - 1 * DAY,
|
|
start: now - 2 * HOUR,
|
|
end: null,
|
|
due: now + 2 * DAY,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['devops', 'selfhosted'],
|
|
urgency: 14.2
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111102',
|
|
id: 2,
|
|
status: 'P',
|
|
description: 'Write unit tests for task filter parsing',
|
|
project: 'Opal',
|
|
priority: 2,
|
|
created: now - 5 * DAY,
|
|
modified: now - 3 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: now + 5 * DAY,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['testing', 'backend'],
|
|
urgency: 7.3
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111103',
|
|
id: 3,
|
|
status: 'P',
|
|
description: 'Fix tag extraction for nested wiki-links',
|
|
project: 'Jade',
|
|
priority: 2,
|
|
created: now - 3 * DAY,
|
|
modified: now - 3 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['bug'],
|
|
urgency: 4.1
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111104',
|
|
id: 4,
|
|
status: 'P',
|
|
description: 'Grocery run - farmers market',
|
|
project: null,
|
|
priority: 1,
|
|
created: now - 1 * DAY,
|
|
modified: now - 1 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: now + 1 * DAY,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['errand'],
|
|
urgency: 3.5
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111105',
|
|
id: 5,
|
|
status: 'P',
|
|
description: 'Design task detail page for opal-web',
|
|
project: 'Opal',
|
|
priority: 3,
|
|
created: now - 2 * DAY,
|
|
modified: now - 2 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: now - 1 * DAY, // overdue
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['frontend', 'design'],
|
|
urgency: 15.8
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111106',
|
|
id: 6,
|
|
status: 'P',
|
|
description: 'Renew domain registration for jnss.me',
|
|
project: 'Infrastructure',
|
|
priority: 1,
|
|
created: now - 14 * DAY,
|
|
modified: now - 14 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: now + 30 * DAY,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['admin'],
|
|
urgency: 2.4
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111107',
|
|
id: 7,
|
|
status: 'P',
|
|
description: 'Add recurrence UI to task creation form',
|
|
project: 'Opal',
|
|
priority: 1,
|
|
created: now - 4 * DAY,
|
|
modified: now - 4 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['frontend'],
|
|
urgency: 2.9
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111108',
|
|
id: 8,
|
|
status: 'P',
|
|
description: 'Migrate Nextcloud to latest stable',
|
|
project: 'Infrastructure',
|
|
priority: 0,
|
|
created: now - 10 * DAY,
|
|
modified: now - 10 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['selfhosted', 'maintenance'],
|
|
urgency: 1.6
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111109',
|
|
id: 9,
|
|
status: 'P',
|
|
description: 'Read "Designing Data-Intensive Applications" ch. 7',
|
|
project: null,
|
|
priority: 0,
|
|
created: now - 6 * DAY,
|
|
modified: now - 6 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['reading', 'learning'],
|
|
urgency: 1.2
|
|
},
|
|
{
|
|
uuid: '11111111-1111-4111-a111-111111111110',
|
|
id: 10,
|
|
status: 'P',
|
|
description: 'Review PR: sync conflict resolution strategy',
|
|
project: 'Opal',
|
|
priority: 2,
|
|
created: now - 1 * DAY,
|
|
modified: now - 1 * DAY,
|
|
start: null,
|
|
end: null,
|
|
due: now, // due today
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['review', 'backend'],
|
|
urgency: 10.5
|
|
},
|
|
|
|
// ── Completed tasks ──────────────────────────────────────────
|
|
{
|
|
uuid: '22222222-2222-4222-a222-222222222201',
|
|
id: 11,
|
|
status: 'C',
|
|
description: 'Implement XDG directory support',
|
|
project: 'Opal',
|
|
priority: 2,
|
|
created: now - 14 * DAY,
|
|
modified: now - 7 * DAY,
|
|
start: null,
|
|
end: now - 7 * DAY,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['backend', 'refactor'],
|
|
urgency: 0
|
|
},
|
|
{
|
|
uuid: '22222222-2222-4222-a222-222222222202',
|
|
id: 12,
|
|
status: 'C',
|
|
description: 'Set up Authentik OAuth provider',
|
|
project: 'Infrastructure',
|
|
priority: 3,
|
|
created: now - 21 * DAY,
|
|
modified: now - 10 * DAY,
|
|
start: null,
|
|
end: now - 10 * DAY,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['auth', 'selfhosted'],
|
|
urgency: 0
|
|
},
|
|
{
|
|
uuid: '22222222-2222-4222-a222-222222222203',
|
|
id: 13,
|
|
status: 'C',
|
|
description: 'Build setup wizard for first-run',
|
|
project: 'Opal',
|
|
priority: 2,
|
|
created: now - 10 * DAY,
|
|
modified: now - 5 * DAY,
|
|
start: null,
|
|
end: now - 5 * DAY,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['ux', 'backend'],
|
|
urgency: 0
|
|
},
|
|
{
|
|
uuid: '22222222-2222-4222-a222-222222222204',
|
|
id: 14,
|
|
status: 'C',
|
|
description: 'Fix PersistentPreRun initialization order',
|
|
project: 'Opal',
|
|
priority: 3,
|
|
created: now - 8 * DAY,
|
|
modified: now - 6 * DAY,
|
|
start: null,
|
|
end: now - 6 * DAY,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['bug', 'backend'],
|
|
urgency: 0
|
|
},
|
|
{
|
|
uuid: '22222222-2222-4222-a222-222222222205',
|
|
id: 15,
|
|
status: 'C',
|
|
description: 'Write deployment guide with Caddy config',
|
|
project: 'Opal',
|
|
priority: 1,
|
|
created: now - 9 * DAY,
|
|
modified: now - 6 * DAY,
|
|
start: null,
|
|
end: now - 6 * DAY,
|
|
due: null,
|
|
scheduled: null,
|
|
wait: null,
|
|
until: null,
|
|
recurrence_duration: null,
|
|
parent_uuid: null,
|
|
tags: ['docs'],
|
|
urgency: 0
|
|
}
|
|
];
|