Skip to content

Feat/deleted user - #416

Open
EinarSalbouvet wants to merge 22 commits into
mainfrom
feat/deleted-user
Open

Feat/deleted user#416
EinarSalbouvet wants to merge 22 commits into
mainfrom
feat/deleted-user

Conversation

@EinarSalbouvet

Copy link
Copy Markdown
Contributor

No description provided.

- 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.

Copilot AI left a comment

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.

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 Users table for both SQL Server and SQLite via EF Core migrations/snapshots.
  • Add DeleteUserAsync to the user service interface/implementation and expose a DELETE /users/{userId} endpoint.
  • Override UserRepository.DeleteByIdsAsync to 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.

Comment thread PrismaDotnetApi/PrismaApi.Application/Repositories/UserRepository.cs Outdated
Comment thread PrismaDotnetApi/PrismaApi.Infrastructure/Context/AppDbContext.cs
Comment thread PrismaDotnetApi/PrismaApi.Api/Controllers/UsersController.cs
EinarSalbouvet and others added 4 commits July 15, 2026 14:24
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>
@EinarSalbouvet EinarSalbouvet linked an issue Jul 15, 2026 that may be closed by this pull request

@rupakkatwal rupakkatwal left a comment

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.

Nice work!
One comment and one suggesrtion

Comment thread PrismaDotnetApi/PrismaApi.Domain/Entities/User.cs
- 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.
EinarSalbouvet and others added 11 commits August 13, 2026 08:32
- 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>
- 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 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.

@jafr67 jafr67 left a comment

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.

LGTM 👍

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.

Handle cascade of delete user

4 participants