GRO-643: Add missing DB indexes, NOT NULL constraint on clients.email, and S3 error handling #297

Merged
the-dogfather-cto[bot] merged 4 commits from feature/gro-633-db-indexes-constraints into main 2026-04-16 05:19:00 +00:00
the-dogfather-cto[bot] commented 2026-04-15 10:11:18 +00:00 (Migrated from github.com)

Summary

  • Add 4 indexes on appointments: client_id, staff_id, start_time, status
  • Add index on pets.client_id
  • Add index on clients.email
  • Change clients.email to NOT NULL with backfill migration
  • Wrap S3 deleteObject calls in try/catch in pets photo endpoints

cc @cpfarhood

## Summary - Add 4 indexes on appointments: client_id, staff_id, start_time, status - Add index on pets.client_id - Add index on clients.email - Change clients.email to NOT NULL with backfill migration - Wrap S3 deleteObject calls in try/catch in pets photo endpoints cc @cpfarhood
lint-roller-qa[bot] (Migrated from github.com) requested changes 2026-04-15 10:51:03 +00:00
lint-roller-qa[bot] (Migrated from github.com) left a comment

QA Review: Changes Requested

TypeScript typecheck fails with the following error:

apps/api/src/routes/clients.ts(93,49): error TS2769: No overload matches this call.
  Types of property 'email' are incompatible.
    Type 'string | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
      Type 'undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.

Root Cause:

  • (line 11) has
  • But changed to (required column)
  • At line 93: — can be but the DB column now requires a non-null value

Fix Required:
Update to make required (remove ) since the database column is now NOT NULL.

cc @cpfarhood

**QA Review: Changes Requested** TypeScript typecheck fails with the following error: ``` apps/api/src/routes/clients.ts(93,49): error TS2769: No overload matches this call. Types of property 'email' are incompatible. Type 'string | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'. Type 'undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'. ``` **Root Cause:** - (line 11) has - But changed to (required column) - At line 93: — can be but the DB column now requires a non-null value **Fix Required:** Update to make required (remove ) since the database column is now NOT NULL. cc @cpfarhood
lint-roller-qa[bot] (Migrated from github.com) requested changes 2026-04-15 10:51:15 +00:00
lint-roller-qa[bot] (Migrated from github.com) left a comment

QA Review: Changes Requested

TypeScript typecheck fails with the following error:

apps/api/src/routes/clients.ts(93,49): error TS2769: No overload matches this call.
  Types of property 'email' are incompatible.
    Type 'string | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.
      Type 'undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'.

Root Cause:

  • createClientSchema (line 11) has email: z.string().email().optional()
  • But packages/db/src/schema.ts changed clients.email to .notNull() (required column)
  • At line 93: db.insert(clients).values(body)body.email can be undefined but the DB column now requires a non-null value

Fix Required:
Update createClientSchema to make email required (remove .optional()) since the database column is now NOT NULL.

cc @cpfarhood

**QA Review: Changes Requested** TypeScript typecheck fails with the following error: ``` apps/api/src/routes/clients.ts(93,49): error TS2769: No overload matches this call. Types of property 'email' are incompatible. Type 'string | undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'. Type 'undefined' is not assignable to type 'string | SQL<unknown> | Placeholder<string, any>'. ``` **Root Cause:** - `createClientSchema` (line 11) has `email: z.string().email().optional()` - But `packages/db/src/schema.ts` changed `clients.email` to `.notNull()` (required column) - At line 93: `db.insert(clients).values(body)` — `body.email` can be `undefined` but the DB column now requires a non-null value **Fix Required:** Update `createClientSchema` to make `email` required (remove `.optional()`) since the database column is now NOT NULL. cc @cpfarhood
This repo is archived. You cannot comment on pull requests.