Define Integration Point with PostgreSQL Users #37

Closed
opened 2025-10-19 19:19:34 +00:00 by GFMpt13 · 1 comment
GFMpt13 commented 2025-10-19 19:19:34 +00:00 (Migrated from github.com)

This task defines how our MongoDB database will reference users (Mechanics, Managers, etc.) who are managed in a separate PostgreSQL database by the authentication team. We will not store any user details (like name or email) in our database.

Proposed Strategy: We will store the user's primary key from the PostgreSQL users table as a foreign key in our MongoDB documents. This key must be a stable, non-changing identifier (e.g., a UUID).

Requirements Covered

  • RF05 (Assign mechanics to WOs)
  • RF10 (Dashboard control by user/role)
  • RNF02 (Authentication profiles)

Tasks

  • Confirm with the auth team that a stable UUID (or equivalent) will be provided for each user.
  • Document the schema modification in workOrders to include mechanicsIds: [UUID].
  • Identify other collections that may need a user reference (e.g., workOrders.createdById: UUID, invoices.emittedById: UUID).
  • Document the "contract": The backend service will be responsible for "hydrating" this data. When a user's name is needed (e.g., on the dashboard), the service will query the User/Auth API using the stored UUID.
This task defines how our MongoDB database will reference users (Mechanics, Managers, etc.) who are managed in a separate PostgreSQL database by the authentication team. We will not store any user details (like name or email) in our database. **Proposed Strategy:** We will store the user's primary key from the PostgreSQL `users` table as a foreign key in our MongoDB documents. This key must be a stable, non-changing identifier (e.g., a **UUID**). ### Requirements Covered * RF05 (Assign mechanics to WOs) * RF10 (Dashboard control by user/role) * RNF02 (Authentication profiles) ### Tasks - [x] Confirm with the auth team that a stable **UUID** (or equivalent) will be provided for each user. - [x] Document the schema modification in `workOrders` to include `mechanicsIds: [UUID]`. - [x] Identify other collections that may need a user reference (e.g., `workOrders.createdById: UUID`, `invoices.emittedById: UUID`). - [x] Document the "contract": The backend service will be responsible for "hydrating" this data. When a user's name is needed (e.g., on the dashboard), the service will query the User/Auth API using the stored UUID.
GFMpt13 commented 2025-10-29 16:17:53 +00:00 (Migrated from github.com)

Added workOrders.createdById: UUID and invoices.emittedById: UUID to the DB.
Documented the "contract" in database_architecture_mongodb.md

The DataBase Desing:

Image

Added workOrders.createdById: UUID and invoices.emittedById: UUID to the DB. Documented the "contract" in database_architecture_mongodb.md The DataBase Desing: ![Image](https://github.com/user-attachments/assets/454e4796-2d18-403b-ac99-30e32bbb0a92)
Sign in to join this conversation.
No description provided.