From 0516e2ffdc0d409ce7f408d5b4a6758417cff6e1 Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:03:28 -0400 Subject: [PATCH 1/8] install typescript globally and verify that ts and kysely-codegen were installed --- .github/workflows/regenerate-db-types.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index 72e8ae7e..d506604b 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -53,14 +53,12 @@ jobs: echo "Installing project dependencies" npm ci --legacy-peer-deps - echo "Installing kysely-codegen globally" - npm install -g kysely-codegen - - echo "Verifying kysely-codegen installation" - kysely-codegen --version || { - echo "Error: kysely-codegen installation failed" - exit 1 - } + echo "Installing kysely-codegen and typescript globally" + npm install -g kysely-codegen typescript + + echo "Verifying installations" + which kysely-codegen || { echo "Error: kysely-codegen not found"; exit 1; } + tsc --version || { echo "Error: typescript not found"; exit 1; } - name: Setup PostgreSQL uses: ikalnytskyi/action-setup-postgres@v6 From 0bc65ab8c6611a1d9206ebf5a39ddbd4e80c0786 Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:11:14 -0400 Subject: [PATCH 2/8] add pg --- .github/workflows/regenerate-db-types.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index d506604b..20980fe0 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -54,7 +54,7 @@ jobs: npm ci --legacy-peer-deps echo "Installing kysely-codegen and typescript globally" - npm install -g kysely-codegen typescript + npm install -g kysely-codegen typescript pg echo "Verifying installations" which kysely-codegen || { echo "Error: kysely-codegen not found"; exit 1; } From 78c04d51912681aa3102998aada5f64db64b05fd Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:16:23 -0400 Subject: [PATCH 3/8] update increment --- .github/workflows/regenerate-db-types.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index 20980fe0..e87c32e4 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -149,14 +149,14 @@ jobs: cp "$SOURCE_FILE" "$dir/db-types.d.ts" if [ $? -eq 0 ]; then - ((SUCCESS_COUNT++)) + SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) else echo "Failed to copy to $dir" - ((FAIL_COUNT++)) + FAIL_COUNT=$((FAIL_COUNT + 1)) fi else echo "Warning: Directory $dir does not exist" - ((FAIL_COUNT++)) + FAIL_COUNT=$((FAIL_COUNT + 1)) fi done From 05027431a8f7351c1ee3141666037165082a275c Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:21:00 -0400 Subject: [PATCH 4/8] update gh pr author --- .github/workflows/regenerate-db-types.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index e87c32e4..1f91c87b 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -217,14 +217,14 @@ jobs: if: steps.git-check.outputs.changes == 'true' id: pr-author run: | - # username PR_AUTHOR_NAME="${{ github.event.pull_request.user.login }}" - PR_AUTHOR_EMAIL="${{ github.event.pull_request.user.login }}@users.noreply.github.com" + PR_AUTHOR_EMAIL="${PR_AUTHOR_NAME}@users.noreply.github.com" - REAL_EMAIL=$(gh api /users/${{ github.event.pull_request.user.login }} --jq '.email' 2>/dev/null || echo "") - - if [ -n "$REAL_EMAIL" ] && [ "$REAL_EMAIL" != "null" ]; then - PR_AUTHOR_EMAIL="$REAL_EMAIL" + if [ -n "$PR_AUTHOR_NAME" ]; then + REAL_EMAIL=$(gh api /users/${PR_AUTHOR_NAME} --jq '.email' 2>/dev/null || echo "") + if [ -n "$REAL_EMAIL" ] && [ "$REAL_EMAIL" != "null" ]; then + PR_AUTHOR_EMAIL="$REAL_EMAIL" + fi fi echo "name=$PR_AUTHOR_NAME" >> $GITHUB_OUTPUT From 2f1ea080b0083ff0a5cf36a423752753e39b2e8e Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:26:46 -0400 Subject: [PATCH 5/8] use ref_name for workflow_dispatch --- .github/workflows/regenerate-db-types.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index 1f91c87b..106e5a68 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -252,7 +252,7 @@ jobs: git commit -m "$COMMIT_MESSAGE" - git push origin HEAD:${{ github.head_ref }} + git push origin HEAD:${{ github.head_ref || github.ref_name }} echo "Changes committed + pushed successfully" From 136ce7665b051f0002889bc27dd5575e6538dbf1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 9 Jun 2026 22:30:57 +0000 Subject: [PATCH 6/8] chore: auto-regenerate database types from schema changes --- apps/backend/lambdas/auth/db-types.d.ts | 13 ++- apps/backend/lambdas/donors/db-types.d.ts | 13 ++- .../lambdas/expenditures/db-types.d.ts | 11 ++- apps/backend/lambdas/projects/db-types.d.ts | 14 ++- apps/backend/lambdas/reports/db-types.d.ts | 5 +- apps/backend/lambdas/tools/db-types.d.ts | 90 +++++++++++++++++++ apps/backend/lambdas/users/db-types.d.ts | 14 ++- 7 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 apps/backend/lambdas/tools/db-types.d.ts diff --git a/apps/backend/lambdas/auth/db-types.d.ts b/apps/backend/lambdas/auth/db-types.d.ts index 5ca734e3..471a8a02 100644 --- a/apps/backend/lambdas/auth/db-types.d.ts +++ b/apps/backend/lambdas/auth/db-types.d.ts @@ -29,7 +29,9 @@ export interface BranchExpenditures { entered_by: number | null; expenditure_id: Generated; project_id: number; + receipt_url: string | null; spent_on: Generated; + status: Generated; } export interface BranchProjectDonations { @@ -52,20 +54,28 @@ export interface BranchProjectMemberships { export interface BranchProjects { created_at: Generated; currency: Generated; - end_date: Timestamp | null; description: string; + end_date: Timestamp | null; name: string; project_id: Generated; start_date: Timestamp | null; total_budget: Numeric | null; } +export interface BranchReports { + date_created: Generated; + object_url: string; + project_id: number; + report_id: Generated; +} + export interface BranchUsers { cognito_sub: string | null; created_at: Generated; email: string; is_admin: Generated; name: string; + profile_image: string | null; user_id: Generated; } @@ -75,5 +85,6 @@ export interface DB { "branch.project_donations": BranchProjectDonations; "branch.project_memberships": BranchProjectMemberships; "branch.projects": BranchProjects; + "branch.reports": BranchReports; "branch.users": BranchUsers; } diff --git a/apps/backend/lambdas/donors/db-types.d.ts b/apps/backend/lambdas/donors/db-types.d.ts index 5ca734e3..471a8a02 100644 --- a/apps/backend/lambdas/donors/db-types.d.ts +++ b/apps/backend/lambdas/donors/db-types.d.ts @@ -29,7 +29,9 @@ export interface BranchExpenditures { entered_by: number | null; expenditure_id: Generated; project_id: number; + receipt_url: string | null; spent_on: Generated; + status: Generated; } export interface BranchProjectDonations { @@ -52,20 +54,28 @@ export interface BranchProjectMemberships { export interface BranchProjects { created_at: Generated; currency: Generated; - end_date: Timestamp | null; description: string; + end_date: Timestamp | null; name: string; project_id: Generated; start_date: Timestamp | null; total_budget: Numeric | null; } +export interface BranchReports { + date_created: Generated; + object_url: string; + project_id: number; + report_id: Generated; +} + export interface BranchUsers { cognito_sub: string | null; created_at: Generated; email: string; is_admin: Generated; name: string; + profile_image: string | null; user_id: Generated; } @@ -75,5 +85,6 @@ export interface DB { "branch.project_donations": BranchProjectDonations; "branch.project_memberships": BranchProjectMemberships; "branch.projects": BranchProjects; + "branch.reports": BranchReports; "branch.users": BranchUsers; } diff --git a/apps/backend/lambdas/expenditures/db-types.d.ts b/apps/backend/lambdas/expenditures/db-types.d.ts index 18fcb702..471a8a02 100644 --- a/apps/backend/lambdas/expenditures/db-types.d.ts +++ b/apps/backend/lambdas/expenditures/db-types.d.ts @@ -54,20 +54,28 @@ export interface BranchProjectMemberships { export interface BranchProjects { created_at: Generated; currency: Generated; - end_date: Timestamp | null; description: string; + end_date: Timestamp | null; name: string; project_id: Generated; start_date: Timestamp | null; total_budget: Numeric | null; } +export interface BranchReports { + date_created: Generated; + object_url: string; + project_id: number; + report_id: Generated; +} + export interface BranchUsers { cognito_sub: string | null; created_at: Generated; email: string; is_admin: Generated; name: string; + profile_image: string | null; user_id: Generated; } @@ -77,5 +85,6 @@ export interface DB { "branch.project_donations": BranchProjectDonations; "branch.project_memberships": BranchProjectMemberships; "branch.projects": BranchProjects; + "branch.reports": BranchReports; "branch.users": BranchUsers; } diff --git a/apps/backend/lambdas/projects/db-types.d.ts b/apps/backend/lambdas/projects/db-types.d.ts index a44eaf8f..471a8a02 100644 --- a/apps/backend/lambdas/projects/db-types.d.ts +++ b/apps/backend/lambdas/projects/db-types.d.ts @@ -29,7 +29,9 @@ export interface BranchExpenditures { entered_by: number | null; expenditure_id: Generated; project_id: number; + receipt_url: string | null; spent_on: Generated; + status: Generated; } export interface BranchProjectDonations { @@ -52,19 +54,28 @@ export interface BranchProjectMemberships { export interface BranchProjects { created_at: Generated; currency: Generated; - end_date: Timestamp | null; description: string; + end_date: Timestamp | null; name: string; project_id: Generated; start_date: Timestamp | null; total_budget: Numeric | null; } +export interface BranchReports { + date_created: Generated; + object_url: string; + project_id: number; + report_id: Generated; +} + export interface BranchUsers { + cognito_sub: string | null; created_at: Generated; email: string; is_admin: Generated; name: string; + profile_image: string | null; user_id: Generated; } @@ -74,5 +85,6 @@ export interface DB { "branch.project_donations": BranchProjectDonations; "branch.project_memberships": BranchProjectMemberships; "branch.projects": BranchProjects; + "branch.reports": BranchReports; "branch.users": BranchUsers; } diff --git a/apps/backend/lambdas/reports/db-types.d.ts b/apps/backend/lambdas/reports/db-types.d.ts index f5ce7754..471a8a02 100644 --- a/apps/backend/lambdas/reports/db-types.d.ts +++ b/apps/backend/lambdas/reports/db-types.d.ts @@ -29,7 +29,9 @@ export interface BranchExpenditures { entered_by: number | null; expenditure_id: Generated; project_id: number; + receipt_url: string | null; spent_on: Generated; + status: Generated; } export interface BranchProjectDonations { @@ -52,8 +54,8 @@ export interface BranchProjectMemberships { export interface BranchProjects { created_at: Generated; currency: Generated; - end_date: Timestamp | null; description: string; + end_date: Timestamp | null; name: string; project_id: Generated; start_date: Timestamp | null; @@ -73,6 +75,7 @@ export interface BranchUsers { email: string; is_admin: Generated; name: string; + profile_image: string | null; user_id: Generated; } diff --git a/apps/backend/lambdas/tools/db-types.d.ts b/apps/backend/lambdas/tools/db-types.d.ts new file mode 100644 index 00000000..471a8a02 --- /dev/null +++ b/apps/backend/lambdas/tools/db-types.d.ts @@ -0,0 +1,90 @@ +/** + * This file was generated by kysely-codegen. + * Please do not edit it manually. + */ + +import type { ColumnType } from "kysely"; + +export type Generated = T extends ColumnType + ? ColumnType + : ColumnType; + +export type Numeric = ColumnType; + +export type Timestamp = ColumnType; + +export interface BranchDonors { + contact_email: string | null; + contact_name: string | null; + created_at: Generated; + donor_id: Generated; + organization: string; +} + +export interface BranchExpenditures { + amount: Numeric; + category: string | null; + created_at: Generated; + description: string | null; + entered_by: number | null; + expenditure_id: Generated; + project_id: number; + receipt_url: string | null; + spent_on: Generated; + status: Generated; +} + +export interface BranchProjectDonations { + amount: Numeric; + donated_at: Generated; + donation_id: Generated; + donor_id: number; + project_id: number; +} + +export interface BranchProjectMemberships { + hours: Numeric | null; + membership_id: Generated; + project_id: number; + role: string; + start_date: Timestamp | null; + user_id: number; +} + +export interface BranchProjects { + created_at: Generated; + currency: Generated; + description: string; + end_date: Timestamp | null; + name: string; + project_id: Generated; + start_date: Timestamp | null; + total_budget: Numeric | null; +} + +export interface BranchReports { + date_created: Generated; + object_url: string; + project_id: number; + report_id: Generated; +} + +export interface BranchUsers { + cognito_sub: string | null; + created_at: Generated; + email: string; + is_admin: Generated; + name: string; + profile_image: string | null; + user_id: Generated; +} + +export interface DB { + "branch.donors": BranchDonors; + "branch.expenditures": BranchExpenditures; + "branch.project_donations": BranchProjectDonations; + "branch.project_memberships": BranchProjectMemberships; + "branch.projects": BranchProjects; + "branch.reports": BranchReports; + "branch.users": BranchUsers; +} diff --git a/apps/backend/lambdas/users/db-types.d.ts b/apps/backend/lambdas/users/db-types.d.ts index f08f3c38..471a8a02 100644 --- a/apps/backend/lambdas/users/db-types.d.ts +++ b/apps/backend/lambdas/users/db-types.d.ts @@ -29,7 +29,9 @@ export interface BranchExpenditures { entered_by: number | null; expenditure_id: Generated; project_id: number; + receipt_url: string | null; spent_on: Generated; + status: Generated; } export interface BranchProjectDonations { @@ -52,22 +54,29 @@ export interface BranchProjectMemberships { export interface BranchProjects { created_at: Generated; currency: Generated; - end_date: Timestamp | null; description: string; + end_date: Timestamp | null; name: string; project_id: Generated; start_date: Timestamp | null; total_budget: Numeric | null; } +export interface BranchReports { + date_created: Generated; + object_url: string; + project_id: number; + report_id: Generated; +} + export interface BranchUsers { cognito_sub: string | null; created_at: Generated; email: string; is_admin: Generated; name: string; - user_id: Generated; profile_image: string | null; + user_id: Generated; } export interface DB { @@ -76,5 +85,6 @@ export interface DB { "branch.project_donations": BranchProjectDonations; "branch.project_memberships": BranchProjectMemberships; "branch.projects": BranchProjects; + "branch.reports": BranchReports; "branch.users": BranchUsers; } From 422a64969bc68cc2c55ab7fa7a97d260c87c7a20 Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:35:51 -0400 Subject: [PATCH 7/8] skip comment if not pull request --- .github/workflows/regenerate-db-types.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index 106e5a68..6691be2f 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -257,7 +257,7 @@ jobs: echo "Changes committed + pushed successfully" - name: Comment on PR - if: steps.git-check.outputs.changes == 'true' + if: steps.git-check.outputs.changes == 'true' && github.event_name == 'pull_request' uses: actions/github-script@v7 with: script: | @@ -286,7 +286,7 @@ jobs: }); - name: Comment on PR if no changes - if: steps.git-check.outputs.changes != 'true' + if: steps.git-check.outputs.changes != 'true' && github.event_name == 'pull_request' uses: actions/github-script@v7 with: script: | From 8dbca923add6d405938b04f2afa07fb116dff99f Mon Sep 17 00:00:00 2001 From: tsudhakar87 Date: Tue, 9 Jun 2026 18:43:39 -0400 Subject: [PATCH 8/8] cleanups --- .github/workflows/regenerate-db-types.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/regenerate-db-types.yaml b/.github/workflows/regenerate-db-types.yaml index 6691be2f..1ed9a4cb 100644 --- a/.github/workflows/regenerate-db-types.yaml +++ b/.github/workflows/regenerate-db-types.yaml @@ -53,12 +53,13 @@ jobs: echo "Installing project dependencies" npm ci --legacy-peer-deps - echo "Installing kysely-codegen and typescript globally" + echo "Installing kysely-codegen, typescript, and pg globally" npm install -g kysely-codegen typescript pg echo "Verifying installations" which kysely-codegen || { echo "Error: kysely-codegen not found"; exit 1; } tsc --version || { echo "Error: typescript not found"; exit 1; } + node -e "require('pg')" || { echo "Error: pg not found"; exit 1; } - name: Setup PostgreSQL uses: ikalnytskyi/action-setup-postgres@v6