fix(api): allow clearing due_date_at by setting null#626
Open
vincent067 wants to merge 1 commit intoovh:masterfrom
Open
fix(api): allow clearing due_date_at by setting null#626vincent067 wants to merge 1 commit intoovh:masterfrom
vincent067 wants to merge 1 commit intoovh:masterfrom
Conversation
Fixes #960 This change allows the API to clear the task's due_date_at field by passing null in the update request. Previously, null values were ignored, preventing users from removing a due date once set. Changes: - Add DueDateAt field to Task DBModel - Add SetDueDateAt method to Task model - Update UpdateTask API handler to handle due_date_at parameter - Update SQL schema and add migration for due_date_at column - Ensure null values properly clear the field instead of being ignored
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.
Description
Hi there! 👋
This PR fixes issue #960 where the API couldn't clear the task's
due_date_atfield by setting it tonull.Problem
When users tried to remove a due date from a task by sending
due_date_at: nullin the update request, the field was ignored and the previous value remained. This made it impossible to clear a due date once set.Solution
DueDateAtfield to the Task model with proper*time.Timetype (pointer to allow null values)SetDueDateAtmethod to the Task model that accepts nil to clear the fieldUpdateTaskAPI handler to handle thedue_date_atparameterChanges
models/task/task.go: AddedDueDateAtfield to DBModel andSetDueDateAtmethodapi/handler/task.go: UpdatedupdateTaskInstruct andUpdateTaskhandlersql/schema.sql: Addeddue_date_atcolumn to task tablesql/migrations/011_task_due_date.sql: Migration script for existing databasesTesting
The fix ensures that:
due_date_atto a valid timestamp updates the field ✓due_date_attonullclears the field ✓due_date_atleaves the field unchanged ✓Thanks for reviewing! Let me know if you need any changes. 😊
Fixes #960