From 31931d29b3187cf8aaa7242ede9b1497504a8ca7 Mon Sep 17 00:00:00 2001 From: Zach R Date: Sat, 6 Jul 2024 17:03:03 -0700 Subject: [PATCH 1/4] Add more fields to /api/history --- src/extensions/api/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/extensions/api/index.ts b/src/extensions/api/index.ts index 6c5d91be..7cc80af2 100644 --- a/src/extensions/api/index.ts +++ b/src/extensions/api/index.ts @@ -425,9 +425,12 @@ express.get('/api/history/:slackId', readLimit, async (req, res) => { createdAt: r.createdAt, time: r.time, elapsed: r.elapsed, + messageTs:r.messageTs, goal: r.goal.name, ended: r.completed || r.cancelled, + banked: r.metadata?.banked, + scrapbookId: r.scrapbookId, work: r.metadata?.work, } From 4234cebd53c1ea7400fe871bd9ccb3b1d33a2670 Mon Sep 17 00:00:00 2001 From: Zach R Date: Sat, 6 Jul 2024 17:05:32 -0700 Subject: [PATCH 2/4] Add id field to /api/goals --- src/extensions/api/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extensions/api/index.ts b/src/extensions/api/index.ts index 7cc80af2..7c85f324 100644 --- a/src/extensions/api/index.ts +++ b/src/extensions/api/index.ts @@ -359,6 +359,7 @@ express.get('/api/goals/:slackId', readLimit, async (req, res) => { userId: slackUser.userId, }, select: { + id:true, name: true, minutes: true, }, @@ -368,6 +369,7 @@ express.get('/api/goals/:slackId', readLimit, async (req, res) => { ok: true, data: result.map(r => { return { + id: r.id, name: r.name, minutes: r.minutes } From e4969a0c815cc37e28a89e6beace983e049bce94 Mon Sep 17 00:00:00 2001 From: Zach R Date: Sat, 6 Jul 2024 17:48:17 -0700 Subject: [PATCH 3/4] Update readme to reflect new fields --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 51f23785..a8ad951c 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Example Response: "data": { "goals": [ { + "id": "" "name": "No Goal", "minutes": 0, } @@ -74,8 +75,11 @@ Example Response: "createdAt": "2024-06-23T05:09:04.105Z", "time": 60, "elapsed": 23, + "messageTs": "1720001234.123456" "goal": "No Goal", "ended": false, + "banked": false, + "scrapbookId": "", "work": "123" } ] From 498aac9737ed99fce348becf3de33b57c55f4a41 Mon Sep 17 00:00:00 2001 From: Zach R Date: Thu, 11 Jul 2024 11:28:52 -0700 Subject: [PATCH 4/4] Add status field to /api/history/ --- README.md | 1 + src/extensions/api/index.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index a8ad951c..8f44176b 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Example Response: "goal": "No Goal", "ended": false, "banked": false, + "status": "Approved" "scrapbookId": "", "work": "123" } diff --git a/src/extensions/api/index.ts b/src/extensions/api/index.ts index 7c85f324..22c1f264 100644 --- a/src/extensions/api/index.ts +++ b/src/extensions/api/index.ts @@ -432,6 +432,7 @@ express.get('/api/history/:slackId', readLimit, async (req, res) => { goal: r.goal.name, ended: r.completed || r.cancelled, banked: r.metadata?.banked, + status: r.metadata.airtable?.status, scrapbookId: r.scrapbookId, work: r.metadata?.work,