From 2949c63cabdd6734ffb368a56a386171c96c1484 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Thu, 5 Jun 2025 16:39:28 +0100 Subject: [PATCH 01/10] refactor(project): :truck: consolidate docs & utils in parent folders --- README.md | 6 +++--- .../Brief_Docs}/Brand Guidelines.pdf | Bin ...e for Neurodivergent people - Project Brief.docx | Bin {Brief_Docs => docs/Brief_Docs}/Project Brief.md | 0 {HITL_Docs => docs/HITL_Docs}/ARCHITECTURE.md | 0 {HITL_Docs => docs/HITL_Docs}/FUNCTIONAL.md | 0 {HITL_Docs => docs/HITL_Docs}/PROMPTS.md | 0 {HITL_Docs => docs/HITL_Docs}/TESTING.md | 0 {utils => src/lib/utils}/emailBuilder.ts | 0 9 files changed, 3 insertions(+), 3 deletions(-) rename {Brief_Docs => docs/Brief_Docs}/Brand Guidelines.pdf (100%) rename {Brief_Docs => docs/Brief_Docs}/Digital Resource for Neurodivergent people - Project Brief.docx (100%) rename {Brief_Docs => docs/Brief_Docs}/Project Brief.md (100%) rename {HITL_Docs => docs/HITL_Docs}/ARCHITECTURE.md (100%) rename {HITL_Docs => docs/HITL_Docs}/FUNCTIONAL.md (100%) rename {HITL_Docs => docs/HITL_Docs}/PROMPTS.md (100%) rename {HITL_Docs => docs/HITL_Docs}/TESTING.md (100%) rename {utils => src/lib/utils}/emailBuilder.ts (100%) diff --git a/README.md b/README.md index 6ac81ed..f924a01 100644 --- a/README.md +++ b/README.md @@ -395,8 +395,8 @@ The project follows a standard SvelteKit structure: ## Documentation -- [FUNCTIONAL.md](./HITL_Docs/FUNCTIONAL.md) - Functional requirements -- [ARCHITECTURE.md](./HITL_Docs/ARCHITECTURE.md) - Technical architecture -- [TESTING.md](./HITL_Docs/TESTING.md) - Testing guide +- [FUNCTIONAL.md](./docs/HITL_Docs/FUNCTIONAL.md) - Functional requirements +- [ARCHITECTURE.md](./docs/HITL_Docs/ARCHITECTURE.md) - Technical architecture +- [TESTING.md](./docs/HITL_Docs/TESTING.md) - Testing guide Explore this codebase on [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/foundersandcoders/LIFT02) diff --git a/Brief_Docs/Brand Guidelines.pdf b/docs/Brief_Docs/Brand Guidelines.pdf similarity index 100% rename from Brief_Docs/Brand Guidelines.pdf rename to docs/Brief_Docs/Brand Guidelines.pdf diff --git a/Brief_Docs/Digital Resource for Neurodivergent people - Project Brief.docx b/docs/Brief_Docs/Digital Resource for Neurodivergent people - Project Brief.docx similarity index 100% rename from Brief_Docs/Digital Resource for Neurodivergent people - Project Brief.docx rename to docs/Brief_Docs/Digital Resource for Neurodivergent people - Project Brief.docx diff --git a/Brief_Docs/Project Brief.md b/docs/Brief_Docs/Project Brief.md similarity index 100% rename from Brief_Docs/Project Brief.md rename to docs/Brief_Docs/Project Brief.md diff --git a/HITL_Docs/ARCHITECTURE.md b/docs/HITL_Docs/ARCHITECTURE.md similarity index 100% rename from HITL_Docs/ARCHITECTURE.md rename to docs/HITL_Docs/ARCHITECTURE.md diff --git a/HITL_Docs/FUNCTIONAL.md b/docs/HITL_Docs/FUNCTIONAL.md similarity index 100% rename from HITL_Docs/FUNCTIONAL.md rename to docs/HITL_Docs/FUNCTIONAL.md diff --git a/HITL_Docs/PROMPTS.md b/docs/HITL_Docs/PROMPTS.md similarity index 100% rename from HITL_Docs/PROMPTS.md rename to docs/HITL_Docs/PROMPTS.md diff --git a/HITL_Docs/TESTING.md b/docs/HITL_Docs/TESTING.md similarity index 100% rename from HITL_Docs/TESTING.md rename to docs/HITL_Docs/TESTING.md diff --git a/utils/emailBuilder.ts b/src/lib/utils/emailBuilder.ts similarity index 100% rename from utils/emailBuilder.ts rename to src/lib/utils/emailBuilder.ts From 34928e0dd3dfcebc5ee560a759498c309b4a1e82 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Thu, 5 Jun 2025 16:42:53 +0100 Subject: [PATCH 02/10] feat(types): :sparkles: add Input type and related interfaces for Profile, Question, Response, Action, and Share --- src/lib/types/inputs.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/lib/types/inputs.ts diff --git a/src/lib/types/inputs.ts b/src/lib/types/inputs.ts new file mode 100644 index 0000000..0986451 --- /dev/null +++ b/src/lib/types/inputs.ts @@ -0,0 +1,21 @@ +export type Input = Profile | Question | Response | Action | Share; + +export interface Profile { + name: string +} + +export interface Question { + name: string +} + +export interface Response { + name: string +} + +export interface Action { + name: string +} + +export interface Share { + name: string +} \ No newline at end of file From 57cc112ad9d5337146141c6b0d27dff19a0ffb6c Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Thu, 5 Jun 2025 18:03:13 +0100 Subject: [PATCH 03/10] feat(types): :label: define types, subtypes & validators for Profiles --- package-lock.json | 12 +++++++++- package.json | 3 ++- src/lib/services/database/types.ts | 2 +- src/lib/types/{inputs.ts => typesMain.ts} | 13 ++++++++++- src/lib/types/typesSub.ts | 23 +++++++++++++++++++ .../types/{supabase.ts => typesSupabase.ts} | 0 src/lib/utils/validators.ts | 6 +++++ 7 files changed, 55 insertions(+), 4 deletions(-) rename src/lib/types/{inputs.ts => typesMain.ts} (60%) create mode 100644 src/lib/types/typesSub.ts rename src/lib/types/{supabase.ts => typesSupabase.ts} (100%) create mode 100644 src/lib/utils/validators.ts diff --git a/package-lock.json b/package-lock.json index 81932fe..570c1ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "0.0.1", "dependencies": { "@supabase/supabase-js": "^2.49.8", - "dotenv": "^16.5.0" + "dotenv": "^16.5.0", + "zod": "^3.25.51" }, "devDependencies": { "@eslint/compat": "^1.2.5", @@ -6320,6 +6321,15 @@ "integrity": "sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==", "dev": true, "license": "MIT" + }, + "node_modules/zod": { + "version": "3.25.51", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.51.tgz", + "integrity": "sha512-TQSnBldh+XSGL+opiSIq0575wvDPqu09AqWe1F7JhUMKY+M91/aGlK4MhpVNO7MgYfHcVCB1ffwAUTJzllKJqg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } } } diff --git a/package.json b/package.json index 49e7f2a..bbf1162 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ }, "dependencies": { "@supabase/supabase-js": "^2.49.8", - "dotenv": "^16.5.0" + "dotenv": "^16.5.0", + "zod": "^3.25.51" } } diff --git a/src/lib/services/database/types.ts b/src/lib/services/database/types.ts index a485abb..c7751b2 100644 --- a/src/lib/services/database/types.ts +++ b/src/lib/services/database/types.ts @@ -4,7 +4,7 @@ export type { Tables, TablesInsert, TablesUpdate -} from '$lib/types/supabase'; +} from '$lib/types/typesSupabase'; // Common response types export type DbResult = Promise<{ diff --git a/src/lib/types/inputs.ts b/src/lib/types/typesMain.ts similarity index 60% rename from src/lib/types/inputs.ts rename to src/lib/types/typesMain.ts index 0986451..e6b62d9 100644 --- a/src/lib/types/inputs.ts +++ b/src/lib/types/typesMain.ts @@ -1,7 +1,18 @@ +import type { + User, + Employer, + Pronouns +} from "./typesSub"; + export type Input = Profile | Question | Response | Action | Share; export interface Profile { - name: string + id?: string; + name: string; + user: User; + pronouns?: Pronouns; + jobTitle?: string; + employer: Employer } export interface Question { diff --git a/src/lib/types/typesSub.ts b/src/lib/types/typesSub.ts new file mode 100644 index 0000000..3afd905 --- /dev/null +++ b/src/lib/types/typesSub.ts @@ -0,0 +1,23 @@ +import { z } from "zod"; +import * as check from "../utils/validators"; + +export type User = z.infer; + +export interface Employer { + name?: string, + id?: string, + manager: Manager +} + +export interface Manager { + id?: string, + name?: string, + pronouns?: Pronouns, + email?: string, +}; + +export type Pronouns = [ + subject: string, + object: string, + possessive: string +]; \ No newline at end of file diff --git a/src/lib/types/supabase.ts b/src/lib/types/typesSupabase.ts similarity index 100% rename from src/lib/types/supabase.ts rename to src/lib/types/typesSupabase.ts diff --git a/src/lib/utils/validators.ts b/src/lib/utils/validators.ts new file mode 100644 index 0000000..8e16bc1 --- /dev/null +++ b/src/lib/utils/validators.ts @@ -0,0 +1,6 @@ +import { z } from "zod"; + +export const User = z.object({ + userId: z.string().optional(), + email: z.string().email(), +}); \ No newline at end of file From 8a1b2656cf23274ef7bc9ab344cb531a29c08c45 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:04:26 +0100 Subject: [PATCH 04/10] =?UTF-8?q?feat(types):=20=F0=9F=8F=B7=20define=20ty?= =?UTF-8?q?pe=20for=20Questions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/types/typesMain.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/types/typesMain.ts b/src/lib/types/typesMain.ts index e6b62d9..b770f92 100644 --- a/src/lib/types/typesMain.ts +++ b/src/lib/types/typesMain.ts @@ -16,7 +16,10 @@ export interface Profile { } export interface Question { - name: string + id?: string, + category: string, + question_text: string, + order: number } export interface Response { From c0b16e992747a381be9d8d241f2a338c11e8267c Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:06:35 +0100 Subject: [PATCH 05/10] refactor: :truck: simplify type/validator structure --- src/lib/services/database/types.ts | 2 +- src/lib/types/{typesMain.ts => main.ts} | 2 +- src/lib/types/{typesSub.ts => sub.ts} | 2 +- src/lib/types/{typesSupabase.ts => supabase.ts} | 0 src/lib/{utils/validators.ts => types/validate.ts} | 0 5 files changed, 3 insertions(+), 3 deletions(-) rename src/lib/types/{typesMain.ts => main.ts} (95%) rename src/lib/types/{typesSub.ts => sub.ts} (88%) rename src/lib/types/{typesSupabase.ts => supabase.ts} (100%) rename src/lib/{utils/validators.ts => types/validate.ts} (100%) diff --git a/src/lib/services/database/types.ts b/src/lib/services/database/types.ts index c7751b2..a485abb 100644 --- a/src/lib/services/database/types.ts +++ b/src/lib/services/database/types.ts @@ -4,7 +4,7 @@ export type { Tables, TablesInsert, TablesUpdate -} from '$lib/types/typesSupabase'; +} from '$lib/types/supabase'; // Common response types export type DbResult = Promise<{ diff --git a/src/lib/types/typesMain.ts b/src/lib/types/main.ts similarity index 95% rename from src/lib/types/typesMain.ts rename to src/lib/types/main.ts index b770f92..10450f0 100644 --- a/src/lib/types/typesMain.ts +++ b/src/lib/types/main.ts @@ -2,7 +2,7 @@ import type { User, Employer, Pronouns -} from "./typesSub"; +} from "./sub"; export type Input = Profile | Question | Response | Action | Share; diff --git a/src/lib/types/typesSub.ts b/src/lib/types/sub.ts similarity index 88% rename from src/lib/types/typesSub.ts rename to src/lib/types/sub.ts index 3afd905..d7c6e40 100644 --- a/src/lib/types/typesSub.ts +++ b/src/lib/types/sub.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import * as check from "../utils/validators"; +import * as check from "./validate"; export type User = z.infer; diff --git a/src/lib/types/typesSupabase.ts b/src/lib/types/supabase.ts similarity index 100% rename from src/lib/types/typesSupabase.ts rename to src/lib/types/supabase.ts diff --git a/src/lib/utils/validators.ts b/src/lib/types/validate.ts similarity index 100% rename from src/lib/utils/validators.ts rename to src/lib/types/validate.ts From 06909e9ecea2e52b4b8d870ec702bc843791a014 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:15:19 +0100 Subject: [PATCH 06/10] =?UTF-8?q?feat(types):=20=F0=9F=8F=B7=20define=20ty?= =?UTF-8?q?pe=20for=20Responses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/types/main.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/types/main.ts b/src/lib/types/main.ts index 10450f0..0cae12e 100644 --- a/src/lib/types/main.ts +++ b/src/lib/types/main.ts @@ -1,8 +1,4 @@ -import type { - User, - Employer, - Pronouns -} from "./sub"; +import type { User, Employer, Pronouns } from "./sub"; export type Input = Profile | Question | Response | Action | Share; @@ -23,7 +19,17 @@ export interface Question { } export interface Response { - name: string + id?: string, + user_id: string, + question_id: string, + response_text: string, + status?: "answered" | "skipped", + visibility: "public" | "private", + version: number, + is_latest: boolean, + // TODO: Use Temporal() to handle dates + created_at?: string, + updated_at?: string, } export interface Action { From 773df75c686baf6a85254ac3de490800d6ecaf81 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:20:42 +0100 Subject: [PATCH 07/10] =?UTF-8?q?feat(types):=20=F0=9F=8F=B7=20define=20ty?= =?UTF-8?q?pe=20for=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also add "draft" as possible Action status --- src/lib/types/main.ts | 12 +++++++++++- supabase/migrations/20250528170555_schema_tweaks.sql | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/types/main.ts b/src/lib/types/main.ts index 0cae12e..2aa05cc 100644 --- a/src/lib/types/main.ts +++ b/src/lib/types/main.ts @@ -33,7 +33,17 @@ export interface Response { } export interface Action { - name: string + id?: string, + user_id: string, + response_id?: string, + type: string, + description?: string, + version: number, + is_latest: boolean, + status: "draft" | "active" | "archived", + // TODO: Use Temporal() to handle dates + created_at?: string, + updated_at?: string } export interface Share { diff --git a/supabase/migrations/20250528170555_schema_tweaks.sql b/supabase/migrations/20250528170555_schema_tweaks.sql index 01db6ec..80b18e8 100644 --- a/supabase/migrations/20250528170555_schema_tweaks.sql +++ b/supabase/migrations/20250528170555_schema_tweaks.sql @@ -48,7 +48,9 @@ -- Status -- Add status column with active/archived options alter table actions - add column status text not null default 'active' check (status in ('active', 'archived')); + add column status text not null default 'draft' check ( + status in ('draft', 'active', 'archived') + ); -- Version -- Create a sequence that increments by 1 when edited From e1ec43ef3c9c535e4c7ddb74cd259f518a4932d4 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:36:37 +0100 Subject: [PATCH 08/10] =?UTF-8?q?feat(types):=20=F0=9F=8F=B7=20define=20ty?= =?UTF-8?q?pe=20for=20Shares?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also add share arrays to Action & Response --- src/lib/types/main.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/lib/types/main.ts b/src/lib/types/main.ts index 2aa05cc..ace2b5e 100644 --- a/src/lib/types/main.ts +++ b/src/lib/types/main.ts @@ -27,9 +27,9 @@ export interface Response { visibility: "public" | "private", version: number, is_latest: boolean, - // TODO: Use Temporal() to handle dates - created_at?: string, - updated_at?: string, + created_at?: string, // TODO: Temporal() + updated_at?: string, // TODO: Temporal() + shares?: Share[] // sharing_event_responses } export interface Action { @@ -41,11 +41,23 @@ export interface Action { version: number, is_latest: boolean, status: "draft" | "active" | "archived", - // TODO: Use Temporal() to handle dates - created_at?: string, - updated_at?: string + created_at?: string, // TODO: Temporal() + updated_at?: string // TODO: Temporal(), + shares?: Share[] // sharing_event_actions } export interface Share { - name: string + id?: string, + user_id: string, + recipient_email?: string, + /* note: Recipient Email + This makes sense for now, as the manager email is just a prop on the Profile + However, there's a line manager id prop earmarked for later use + + If a table is implemented for Line Managers, this prop should be replaced by a foreign key to it + */ + message?: string, + responses?: Response[], // sharing_event_responses + actions?: Action[], // sharing_event_actions + shared_at?: string // TODO: Temporal() } \ No newline at end of file From 98ac9855010a08d81db0a08287b3d213bb243704 Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:40:24 +0100 Subject: [PATCH 09/10] docs(project): :memo: make pull request template actually appear --- .github/{PULL_REQUEST_TEMPLATE/PR.md => PULL_REQUEST_TEMPLATE.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{PULL_REQUEST_TEMPLATE/PR.md => PULL_REQUEST_TEMPLATE.md} (100%) diff --git a/.github/PULL_REQUEST_TEMPLATE/PR.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .github/PULL_REQUEST_TEMPLATE/PR.md rename to .github/PULL_REQUEST_TEMPLATE.md From a88155934eae6accfbe6e65021824c7d4f487b7c Mon Sep 17 00:00:00 2001 From: Jason Warren Date: Fri, 6 Jun 2025 15:51:26 +0100 Subject: [PATCH 10/10] docs(project): :memo: add step to PR template --- .github/PULL_REQUEST_TEMPLATE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e49858b..7e368e5 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,6 +7,13 @@ --- +## TL;DR + + +--- + ## Gallery