Feat/deleted user - #416
Open
EinarSalbouvet wants to merge 22 commits into
Open
Conversation
- Created a new migration `AddDeletedUser` to insert a user with ID "d008bfdf-fe89-48f3-80a8-777bba4d9bbf" named "Deleted User" into the Users table. - Updated the `AppDbContextModelSnapshot` to reflect the new user data. - Implemented the `Down` method to remove the user if the migration is rolled back.
- Created a new migration file to add a user with the name "Deleted User" and specific timestamps. - Updated the AppDbContextModelSnapshot to include the new user data for seeding.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a “Deleted User” system user and adds a user self-delete flow that reassigns audit references (CreatedById/UpdatedById) to that placeholder before removing the user record.
Changes:
- Seed a fixed “Deleted User” row into the
Userstable for both SQL Server and SQLite via EF Core migrations/snapshots. - Add
DeleteUserAsyncto the user service interface/implementation and expose aDELETE /users/{userId}endpoint. - Override
UserRepository.DeleteByIdsAsyncto update auditable entities’ CreatedById/UpdatedById to the deleted-user placeholder and remove related project roles.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| PrismaDotnetApi/SqlServerMigrations/AppDbContextModelSnapshot.cs | Adds seed data for the “Deleted User” in the SQL Server model snapshot. |
| PrismaDotnetApi/SqlServerMigrations/20260715095316_AddDeletedUser.Designer.cs | SQL Server migration designer reflecting the new seed data. |
| PrismaDotnetApi/SqlServerMigrations/20260715095316_AddDeletedUser.cs | SQL Server migration inserting/removing the “Deleted User” seed row. |
| PrismaDotnetApi/SqliteMigrations/AppDbContextModelSnapshot.cs | Adds seed data for the “Deleted User” in the SQLite model snapshot. |
| PrismaDotnetApi/SqliteMigrations/20260715095307_AddDeletedUser.Designer.cs | SQLite migration designer reflecting the new seed data. |
| PrismaDotnetApi/SqliteMigrations/20260715095307_AddDeletedUser.cs | SQLite migration inserting/removing the “Deleted User” seed row. |
| PrismaDotnetApi/PrismaApi.Test/Mocks/TestUserService.cs | Adds a mock implementation for DeleteUserAsync. |
| PrismaDotnetApi/PrismaApi.Infrastructure/Context/AppDbContext.cs | Adjusts facilitator-role counting logic in EnforceMinimumProjectRoles. |
| PrismaDotnetApi/PrismaApi.Domain/Entities/User.cs | Seeds the deleted-user placeholder via model configuration. |
| PrismaDotnetApi/PrismaApi.Domain/Constants/DomainConstants.cs | Introduces constants for deleted-user id/name. |
| PrismaDotnetApi/PrismaApi.Application/Services/UserService.cs | Adds DeleteUserAsync implementation (self-delete enforcement + repository call). |
| PrismaDotnetApi/PrismaApi.Application/Repositories/UserRepository.cs | Implements deletion behavior with audit-reference reassignment + role cleanup. |
| PrismaDotnetApi/PrismaApi.Application/Interfaces/Services/IUserService.cs | Extends interface with DeleteUserAsync. |
| PrismaDotnetApi/PrismaApi.Api/Controllers/UsersController.cs | Adds DELETE /users/{userId} endpoint calling the service method. |
Files not reviewed (2)
- PrismaDotnetApi/SqlServerMigrations/20260715095316_AddDeletedUser.Designer.cs: Generated file
- PrismaDotnetApi/SqliteMigrations/20260715095307_AddDeletedUser.Designer.cs: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…-decision-api into feat/deleted-user
rupakkatwal
requested changes
Jul 21, 2026
rupakkatwal
left a comment
Contributor
There was a problem hiding this comment.
Nice work!
One comment and one suggesrtion
…llable string for table names
- Created a new migration `AddDeletedUser` to insert a user with the name "Deleted User" into the Users table. - Updated the AppDbContextModelSnapshot to reflect changes in table mappings by removing null parameters from `ToTable` method calls for various entities.
- Created a new migration `AddDeletedUser` to insert a user with ID "d008bfdf-fe89-48f3-80a8-777bba4d9bbf" named "Deleted User" into the Users table. - Updated the `AppDbContextModelSnapshot` to reflect the new user data. - Implemented the `Down` method to remove the user if the migration is rolled back.
- Created a new migration file to add a user with the name "Deleted User" and specific timestamps. - Updated the AppDbContextModelSnapshot to include the new user data for seeding.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…llable string for table names
- Created a new migration `AddDeletedUser` to insert a user with the name "Deleted User" into the Users table. - Updated the AppDbContextModelSnapshot to reflect changes in table mappings by removing null parameters from `ToTable` method calls for various entities.
…-decision-api into feat/deleted-user
- Created a new migration file to add a user with the name "Deleted User". - The user is inserted with a specific ID and timestamps for CreatedAt and UpdatedAt. - Implemented the Down method to remove the user if the migration is rolled back.
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.