-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Archive officers #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 implements an archive/unarchive system for officers to differentiate between active and inactive officers. Instead of maintaining all officers in a single collection, the system now supports moving officers between the officer (active) and archived (inactive) collections while tracking their status with the isActive field.
- Added two new endpoints (
archiveOfficerandunarchiveOfficer) to move officers between collections with transaction-based consistency - Extended existing CRUD endpoints to support an optional
archived=truequery parameter for operations on archived officers - Updated deployment configuration and documentation to reflect the new functionality
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/functions/archiveOfficer.ts | New endpoint to move officers from officer to archived collection with isActive=false |
| src/functions/unarchiveOfficer.ts | New endpoint to move officers from archived to officer collection with isActive=true |
| src/functions/getOfficers.ts | Added support for archived=true query parameter to retrieve archived officers |
| src/functions/getOfficer.ts | Added support for archived=true query parameter to retrieve a specific archived officer |
| src/functions/updateOfficer.ts | Added support for archived=true query parameter to update archived officers |
| src/functions/deleteOfficer.ts | Added support for archived=true query parameter to delete archived officers |
| src/functions/index.ts | Exports the new archive and unarchive functions |
| src/index.ts | Registers the new archive and unarchive HTTP endpoints and exports them |
| tests/deploy.ts | Includes new archive/unarchive handlers in the local dev server |
| cloudbuild.yaml | Adds new functions to the deployment pipeline |
| README.md | Documents the new archive/unarchive endpoints in the local development guide |
| API_DOCUMENTATION.md | Comprehensive documentation of archive/unarchive endpoints and the archived query parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I removed an extra paragraph that wasn't meant to be committed Co-authored-by: Copilot <[email protected]>
|
I need to make archiving NOT mark an officer as inactive, acmutd/officer-database#9 adds that separate functionality |
I made this PR so we can differentiate between active and inactive officers, instead of having all present AND past officers be in one giant directory. This PR adds support for archiving and unarchiving officer documents, allowing officers to be moved between the default
officersand the newarchivedcollection in Firestore. This PR closes #21.New Archive/Unarchive Functionality:
POST /archiveOfficerandPOST /unarchiveOfficerto move officer records between theofficerandarchivedcollections, updating theisActivefield accordingly. Error handling is included for missing IDs, not found, and already-archived/active cases.API Changes for Archived Officers:
getOfficers,getOfficer,updateOfficer, anddeleteOfficerendpoints to accept an optionalarchived=truequery parameter, allowing operations on archived officers in addition to active ones.archivedquery parameter for relevant endpoints.