feat: add soft delete support for users, projects, and organizations#214
Open
rishab11250 wants to merge 1 commit into
Open
feat: add soft delete support for users, projects, and organizations#214rishab11250 wants to merge 1 commit into
rishab11250 wants to merge 1 commit into
Conversation
- Add deleted_at and deleted_by_id columns to User, Project, Organization models - Create missing project and organization Pydantic schemas - Convert all hard deletes to soft deletes in services - Filter out soft-deleted records from all queries - Add restore and hard-delete endpoints to routers - Create Alembic migration for new columns - Permission model: owner soft-deletes, owner/superuser restores, superuser hard-deletes Closes nensii21#198
Owner
|
attached videos and screenshots showing what changes have been made also some CI jobs are failing update it. |
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.
Pull Request
Summary
Add soft delete support for Users, Projects, and Organizations. Instead of permanently deleting records, they are now marked with a
deleted_attimestamp and hidden from all normal queries. Admins can restore or permanently delete them.Related Issue
Closes #198
Type of Change
Changes Made
deleted_at(datetime) anddeleted_by_id(FK → users.id) columns withdeleted_byrelationships toUser,Project, andOrganization.ProjectResponseandOrganizationResponseschemas inapp/schemas/project.pyandapp/schemas/organization.py. Addeddeleted_at/deleted_by_idtoUserResponse.get_*,list_*,get_by_*,search_*methods now filter out soft-deleted records.delete_*methods replaced withsoft_delete_*(sets timestamp). Addedrestore_*andhard_delete_*methods.PATCH /{entity}/{id}/restore(owner/superuser) andDELETE /{entity}/{id}/hard(superuser only) endpoints.4b4c96034900_add_soft_delete_columns.pyadds all columns with named foreign key constraints.Testing
Additional testing notes: No database connection available locally to run migration against live PostgreSQL. Migration is structured following existing patterns with proper upgrade/downgrade paths.
Checklist
Additional Notes
Permission model:
Branch:
feat/soft-delete-supportCommit:
4fe9f36