Skip to content

feat: implement Plan-01 Data Model#1

Open
martyy-code wants to merge 10 commits into
wareflowx:mainfrom
martyy-code:feature/plan-01-data-model
Open

feat: implement Plan-01 Data Model#1
martyy-code wants to merge 10 commits into
wareflowx:mainfrom
martyy-code:feature/plan-01-data-model

Conversation

@martyy-code

Copy link
Copy Markdown

Summary

  • Complete WEMS database schema with 11 tables
  • Modular query API: queries.role.create(), queries.employee.list()
  • oRPC router with type-safe procedures
  • Soft delete pattern on major entities
  • Seed script with sample data

Test plan

  • Database migration applies successfully
  • Seed script creates 5 roles, 3 warehouses, 8 certification types, 4 employees
  • All TypeScript packages build without errors
  • Verify in Electron app (requires better-sqlite3 rebuild for Electron)

Technical Details

Package Status
@electron-template/db ✅ Schema, queries, seed
@electron-template/api ✅ oRPC router, procedures
@electron-template/sdk ✅ Type exports

Tables Created

  • roles, warehouses, employees (with soft delete)
  • certifications, certification_types (with soft delete)
  • caces_certifications, medical_visits, online_trainings, driving_authorizations
  • alert_settings, snoozed_alerts

🤖 Generated with Claude Code

@martyy-code martyy-code force-pushed the feature/plan-01-data-model branch from 16f2ab4 to ab1a70f Compare May 28, 2026 07:00
.handler(async ({ input }) => {
return queries.certification.getByIdWithDetails(input.id)
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One method with optionnal param pls

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

caces, medical visits, ... should be in separate files

return queries.warehouse.update(input.id, { name: input.name })
})

const deleteWarehouse = os

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why suffix only on this procedure ?

Comment thread packages/api/src/procedures/role.ts Outdated
return queries.role.update(input.id, { name: input.name })
})

const deleteRole = os

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe internal ts name ?

Comment thread packages/api/src/procedures/employee.ts Outdated
Comment on lines +7 to +17
.input(z.object({
firstName: z.string(),
lastName: z.string(),
email: z.string().optional(),
phone: z.string().optional(),
arrivalDate: z.string(),
contractType: z.enum(contractTypesList as [string, ...string[]]),
roleId: z.string(),
warehouseId: z.string()
}))
.handler(async ({ input }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not drizzle type ? Could check drizzle-zod with fresh

Comment thread packages/api/src/procedures/alert.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should create a alerts folder with file for each alterts types

Complete data model for WEMS (Warehouse Employee Management System):
- Drizzle ORM schema with soft delete support for Role, Warehouse, CertificationType, Certification
- oRPC API procedures for all CRUD operations
- Modular folder structure for procedures and queries

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@martyy-code martyy-code force-pushed the feature/plan-01-data-model branch from e66f86f to 222b73f Compare May 28, 2026 08:32
martyy-code and others added 9 commits May 28, 2026 10:58
The prepare script triggers a build during pnpm install, but API's dist
files haven't been generated yet. The CI explicitly builds packages in
order, so prepare is redundant.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix import paths in router.ts to use new folder structure under ./procedures/certifications/
- Add packages/*/dist to .gitignore to exclude build outputs

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Build ordering:
- Add db build step before api build in CI workflows
- Add db + api build steps before SDK in CI workflows

Lint fixes:
- Ignore test files in eslint config (*.test.ts, *.spec.ts)
- Remove unused imports from queries.test.ts
- Remove unused NewEmployee and searchLower from employee.ts
- Remove unused NewRole from role.ts

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The API procedures directly import drizzle-orm for eq(), but drizzle-orm
was only listed in db package. This caused TypeScript to fail finding the module.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Lint fixes:
- Update eslint config to ignore dist, handle _ prefixed unused vars
- Add no-unsafe-* rules to allow proxy pattern
- Change lint file pattern from **/*.ts to src/**/*.ts

TypeScript fixes:
- Add Record<string, any> type alias for db proxy
- Add drizzle-orm dependency to API package
- Prefix unused employeeId params with _ in caces, medical
- Remove unused NewDrivingAuthorization, NewOnlineTraining imports

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All workflows that depend on packages/db, api, or sdk now build
those packages first before running their own build/typecheck/lint.

This fixes the "Cannot find module" errors when CI ran workflows
in parallel without ensuring dependencies were built first.

Modified workflows:
- typecheck-desktop.yml
- build-desktop.yml
- build-web.yml
- lint-desktop.yml
- lint-api.yml
- test-web.yml

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- lint.yml (Web): build db, api, sdk before web lint
- lint-sdk.yml: build db, api before sdk lint

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Add drizzle-zod dependency to packages/db
- Create packages/db/src/schemas.ts with auto-generated schemas from Drizzle tables
- Update API procedures to use schemas from drizzle-zod (role, warehouse, employee)
- Fix lint scripts to only lint src/, not dist/ (build output)
- Fix TypeScript issues in initDb.ts with eslint-disable for runtime db proxy

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
All CI workflows now run on push and PR to both main and dev branches.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants