Commit graph

4 commits

Author SHA1 Message Date
c95825dc88 Fix Notes API parameter format for Create and Update
The Checkvist API expects nested JSON parameters in the format
{"comment": {"comment": "text"}} but the code was sending flat
{"comment": "text"}, causing 400 Bad Request errors.

Changes:
- Add noteCommentWrapper struct for nested JSON format
- Update createNoteRequest and updateNoteRequest to use wrapper
- Update Create and Update methods to use nested structure
- Update tests to verify nested format

Fixes: checkvist-api-awg
2026-01-14 18:18:31 +01:00
9145157ba7 Add tests documenting Notes API parameter format bug 2026-01-14 18:14:14 +01:00
e4862b8e9b Fix date parsing for Checkvist API format
Add custom APITime type with UnmarshalJSON to handle the non-standard
date format returned by the Checkvist API ("2026/01/14 16:07:31 +0000")
instead of the expected RFC3339 format.

Changes:
- Add APITime type with custom JSON marshaling/unmarshaling in models.go
- Replace time.Time with APITime for UpdatedAt/CreatedAt fields in
  Checklist, Task, and Note structs
- Add NewAPITime constructor for convenience
- Update test fixtures to use real API date format
- Add comprehensive unit tests for APITime in models_test.go

Fixes: checkvist-api-4qn
2026-01-14 18:10:02 +01:00
2f44308d42 Add unit tests for Notes
Create notes_test.go with tests:
- TestNotes_List: list all notes on a task
- TestNotes_Create: create new note
- TestNotes_Update: update note comment
- TestNotes_Delete: delete note

Add testdata/notes/ fixtures:
- list.json: sample notes list

All 4 tests pass using httptest.Server mocking.

Closes checkvist-api-bbx
2026-01-14 13:47:23 +01:00