-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat: basic due date support #4835
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
Adds basic due date functionality for memos using @Due(YYYY-MM-DD) syntax: - Due date detection: Automatically detects @Due(YYYY-MM-DD) patterns in memo content - Filtering: New has_due_date filter to show only memos with due dates - Statistics: Added due date count to user statistics display - Database support: Updated all database drivers (SQLite, MySQL, PostgreSQL) for due date queries Implementation: - Added has_due_date field to MemoPayload.Property protobuf - Updated memo payload runner with regex validation for due date patterns - Enhanced frontend with due date filter button and statistics card - Added comprehensive test coverage for due date detection
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
Adds basic due date support to memos by detecting @due(YYYY-MM-DD)
tags, exposing a new filter, updating statistics, and persisting the flag through the API and storage layers.
- Detects
@due(YYYY-MM-DD)
in memo content and setsHasDueDate
- Exposes
dueDate
filter in UI and API, and displays a “Due” stat card - Persists
has_due_date
through protobuf, DB queries, service logic, and adds test coverage for detection
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
web/src/types/proto/google/protobuf/descriptor.ts | Updated generated TS descriptor to include visibility features |
web/src/types/proto/api/v1/user_service.ts | Added dueDateCount to UserStats_MemoTypeStats |
web/src/store/memoFilter.ts | Added "dueDate" to filter factors |
web/src/pages/UserProfile.tsx | Added dueDate filter condition |
web/src/pages/Home.tsx | Added dueDate filter condition |
web/src/pages/Archived.tsx | Added dueDate filter condition |
web/src/hooks/useStatisticsData.ts | Aggregates dueDateCount in stats hook |
web/src/components/StatisticsView/StatisticsView.tsx | Added “Due” stat card with calendar icon |
web/src/components/MemoFilters.tsx | Renders label/icon for dueDate filter |
store/memo.go | Added HasDueDate to FindMemoPayload |
store/db/sqlite/memo.go | Filters by hasDueDate in SQLite query |
store/db/postgres/memo.go | Filters by hasDueDate in Postgres query |
store/db/mysql/memo.go | Filters by hasDueDate in MySQL query |
server/runner/memopayload/runner_test.go | Tests for hasDueDate detection |
server/runner/memopayload/runner.go | Implements hasDueDate with regex and validation |
server/router/api/v1/user_service_stats.go | Counts HasDueDate in user stats response |
server/router/api/v1/memo_service_filter.go | Parses has_due_date filter in service filter builder |
proto/store/memo.proto | Added has_due_date field to MemoPayload.Property |
proto/gen/store/memo.pb.go | Generated Go binding for HasDueDate |
proto/gen/apidocs.swagger.yaml | Added dueDateCount to API docs |
proto/gen/api/v1/user_service.pb.go | Generated Go binding for DueDateCount |
proto/api/v1/user_service.proto | Added due_date_count in UserStats message |
Comments suppressed due to low confidence (1)
server/router/api/v1/memo_service_filter.go:71
- There aren’t any unit tests verifying that the
has_due_date
filter expression is parsed and applied correctly. Consider adding tests for this new filter path.
if filterExpr.HasDueDate {
@@ -103,6 +103,9 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo | |||
if v.HasIncompleteTasks { | |||
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.hasIncompleteTasks') IS TRUE") | |||
} | |||
if v.HasDueDate { | |||
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.hasDueDate') IS TRUE") |
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.
The JSON path is using hasDueDate
but the protobuf JSON tag is has_due_date
. Update the path to $.property.has_due_date
to match the stored JSON key.
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.hasDueDate') IS TRUE") | |
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.has_due_date') IS TRUE") |
Copilot uses AI. Check for mistakes.
@@ -102,6 +102,9 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo | |||
if v.HasIncompleteTasks { | |||
where = append(where, "(memo.payload->'property'->>'hasIncompleteTasks')::BOOLEAN IS TRUE") | |||
} | |||
if v.HasDueDate { | |||
where = append(where, "(memo.payload->'property'->>'hasDueDate')::BOOLEAN IS TRUE") |
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.
Postgres JSON operator should use 'has_due_date'
to match the protobuf JSON field. Change ->>'hasDueDate'
to ->>'has_due_date'
.
where = append(where, "(memo.payload->'property'->>'hasDueDate')::BOOLEAN IS TRUE") | |
where = append(where, "(memo.payload->'property'->>'has_due_date')::BOOLEAN IS TRUE") |
Copilot uses AI. Check for mistakes.
@@ -111,6 +111,9 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo | |||
if v.HasIncompleteTasks { | |||
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.hasIncompleteTasks') IS TRUE") | |||
} | |||
if v.HasDueDate { | |||
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.hasDueDate') IS TRUE") |
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.
MySQL JSON path must reference has_due_date
instead of hasDueDate
to align with the JSON tag in protobuf.
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.hasDueDate') IS TRUE") | |
where = append(where, "JSON_EXTRACT(`memo`.`payload`, '$.property.has_due_date') IS TRUE") |
Copilot uses AI. Check for mistakes.
// - - separator | ||
// - 2 digit day (01-31) | ||
// - ) suffix | ||
dueDatePattern := regexp.MustCompile(`@due\((\d{4})-(\d{2})-(\d{2})\)`) |
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.
Compiling the regex on every invocation can be expensive. Move MustCompile
to a package-level var
so it’s compiled once.
dueDatePattern := regexp.MustCompile(`@due\((\d{4})-(\d{2})-(\d{2})\)`) |
Copilot uses AI. Check for mistakes.
Too many projects, too little time... sorry, closing this as I have higher priorities for coming months. |
Add due date support to memos
(first part of #4823 )
Adds basic due date functionality for memos using
@due(YYYY-MM-DD)
syntaxFeatures:
@due(YYYY-MM-DD)
patterns in memo contenthas_due_date
filter to show only memos with due datesImplementation:
has_due_date
field toMemoPayload.Property
protobufUsage:
@due(2025-01-15)
in memo content to set due dateNote: this is the very minimal functionality to add due dates to memos. NOT included yet are