[LOCKLITE-81] Add many-to-many relation between users and vaults in database#149
Merged
[LOCKLITE-81] Add many-to-many relation between users and vaults in database#149
Conversation
This reverts commit 0cc57db.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the database schema to implement a many-to-many relationship between users and vaults using a VaultMember junction table, replacing the previous one-to-many relationship. This change enables multiple users to share access to the same vault.
- Introduces a new VaultMember model as a junction table between User and Vault
- Updates repository methods to handle vault membership instead of direct vault ownership
- Modifies seeding logic to create shared vaults that can be accessed by multiple users
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| prisma/schema.prisma | Adds VaultMember junction table and removes direct userId from Vault model |
| prisma/migrations/20250821224004_many_users_to_many_vaults/migration.sql | Database migration to implement the many-to-many relationship |
| src/projects/api/modules/vaults/infra/vaults.repository.ts | Updates repository methods to work with vault membership instead of ownership |
| src/projects/api/modules/seed/domain/upsert-user-with-vaults.usecase.ts | Modifies seeding logic to create or share existing vaults |
| src/projects/api/modules/seed/app/data/vaults.data.seed.ts | Centralizes vault definitions for reuse across multiple users |
| src/projects/api/modules/seed/app/data/users.data.seed.ts | Updates user seed data to reference shared vaults and adds more test users |
| src/projects/api/modules/seed/infra/seed.ts | Fixes import name to match renamed variable |
| package.json | Updates seed script path |
| Makefile | Adds dependencies and includes generate step in reset workflow |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/projects/api/modules/seed/domain/upsert-user-with-vaults.usecase.ts
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.