Skip to content

[LOCKLITE-81] Add many-to-many relation between users and vaults in database#149

Merged
vbetsch merged 14 commits intodevelopfrom
api/81-db-vault-members
Aug 21, 2025
Merged

[LOCKLITE-81] Add many-to-many relation between users and vaults in database#149
vbetsch merged 14 commits intodevelopfrom
api/81-db-vault-members

Conversation

@vbetsch
Copy link
Owner

@vbetsch vbetsch commented Aug 21, 2025

No description provided.

@vbetsch vbetsch requested a review from Copilot August 21, 2025 23:18
@vbetsch vbetsch self-assigned this Aug 21, 2025
@vbetsch vbetsch added the database About database schema or models label Aug 21, 2025
@vercel
Copy link

vercel bot commented Aug 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
locklite Ready Ready Preview Comment Aug 21, 2025 11:43pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@vbetsch vbetsch merged commit ba4c725 into develop Aug 21, 2025
6 checks passed
@vbetsch vbetsch deleted the api/81-db-vault-members branch August 21, 2025 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database About database schema or models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants