Add patch and delete endpoints#2904
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds missing PATCH and DELETE endpoints to the existing /v2/manage-template/<template_id> API so callers can update template fields and archive templates, aligning v2 manage-template functionality with expected template lifecycle operations.
Changes:
- Added
/v2/manage-template/<template_id>PATCH endpoint with request schema validation and support for updating name/content/subject/category/folder. - Added
/v2/manage-template/<template_id>DELETE endpoint that archives templates and returns the serialized template. - Added unit tests covering success and common failure cases for both endpoints.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/app/v2/manage_template/test_patch_template.py | New tests for PATCH manage-template endpoint (update and error paths). |
| tests/app/v2/manage_template/test_delete_template.py | New tests for DELETE manage-template endpoint (archive and error paths). |
| app/v2/manage_template/template_schemas.py | Adds PATCH request schema for manage-template updates. |
| app/v2/manage_template/patch_template.py | Implements PATCH endpoint logic and validation. |
| app/v2/manage_template/delete_template.py | Implements DELETE endpoint to archive templates. |
| app/init.py | Registers the new manage-template modules so routes are loaded. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e830a13 to
ee8f4eb
Compare
4c6f8ab to
a501e8f
Compare
f84cd82 to
a9407ab
Compare
whabanks
approved these changes
Jun 11, 2026
whabanks
left a comment
Contributor
There was a problem hiding this comment.
LGTM, tested locally and it's working as expected. Just one comment around folders.
|
|
||
| template.archived = True | ||
| template.updated_at = datetime.utcnow() | ||
| templates_dao.dao_update_template(template) |
Contributor
There was a problem hiding this comment.
Do we want to mirror existing behaviour on the admin endpoints and detach the archived templates from folders?
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.
Summary | Résumé
Added patch and delete endpoints for Templates
Related Issues | Cartes liées
Test instructions | Instructions pour tester la modification
^ Ifyou posted the above with template_type, you will get an error
Remove the template_type and when you send the PATCH, you should see the version gets updated