Today view and Inbox section: dynamic query, not stored sections

- ListTodayView() on backend: queries nodes created or updated today
  using local timezone day boundaries
- todayBoundaries() helper returns start/end of current day in RFC3339
- Section validation: Create() rejects today and inbox as node sections
- validSections moved from repository.go to types.go with IsValidSection
  and IsServiceSection helpers
- Frontend selectSection('today') calls ListTodayView instead of
  ListNodesBySection('today')
- FAB (create node) hidden in today and inbox sections
- CreateNode in app.go guarded against today/inbox sections
- types.go: today/inbox defined as service sections (sidebar only)
This commit is contained in:
2026-06-01 01:39:02 +08:00
parent a4ae22c445
commit 69891e395c
8 changed files with 107 additions and 11 deletions
+12
View File
@@ -143,6 +143,15 @@ func (a *App) ListNodesBySection(section string) ([]NodeDTO, error) {
return toNodeDTOs(list), nil
}
// ListTodayView returns nodes created or updated today — a dynamic day view.
func (a *App) ListTodayView() ([]NodeDTO, error) {
list, err := a.nodes.ListTodayNodes()
if err != nil {
return nil, err
}
return toNodeDTOs(list), nil
}
func (a *App) ListChildren(parentID string) ([]NodeDTO, error) {
list, err := a.nodes.ListChildren(parentID, false)
if err != nil {
@@ -161,6 +170,9 @@ func (a *App) GetNodeDetail(nodeID string) (*NodeDTO, error) {
}
func (a *App) CreateNode(parentID, nodeType, title, section string) (*NodeDTO, error) {
if section == "today" || section == "inbox" {
return nil, fmt.Errorf("cannot create node with section %q", section)
}
n, err := a.nodes.Create(parentID, nodeType, title, section)
if err != nil {
return nil, err
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -16,7 +16,7 @@
background: #13131f;
}
</style>
<script type="module" crossorigin src="/assets/main-B8EIu1OK.js"></script>
<script type="module" crossorigin src="/assets/main-BY9JF_6I.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-Bo58X7Pc.css">
</head>
<body>