blob: 31308fca7a4644f9f50255f13bd5f6802582e234 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
package models
import "time"
// Task represents a task from Todoist
type Task struct {
ID string `json:"id"`
Content string `json:"content"`
Description string `json:"description"`
ProjectID string `json:"project_id"`
ProjectName string `json:"project_name"`
DueDate *time.Time `json:"due_date,omitempty"`
Priority int `json:"priority"`
Completed bool `json:"completed"`
Labels []string `json:"labels"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
}
// Note represents a note from Obsidian
type Note struct {
Filename string `json:"filename"`
Title string `json:"title"`
Content string `json:"content"` // First 200 chars or full content
Modified time.Time `json:"modified"`
Path string `json:"path"`
Tags []string `json:"tags"`
}
// Meal represents a meal from PlanToEat
type Meal struct {
ID string `json:"id"`
RecipeName string `json:"recipe_name"`
Date time.Time `json:"date"`
MealType string `json:"meal_type"` // breakfast, lunch, dinner
RecipeURL string `json:"recipe_url"`
}
// List represents a Trello list
type List struct {
ID string `json:"id"`
Name string `json:"name"`
}
// Board represents a Trello board
type Board struct {
ID string `json:"id"`
Name string `json:"name"`
Cards []Card `json:"cards"`
Lists []List `json:"lists"`
}
// Card represents a Trello card
type Card struct {
ID string `json:"id"`
Name string `json:"name"`
ListID string `json:"list_id"`
ListName string `json:"list_name"`
DueDate *time.Time `json:"due_date,omitempty"`
URL string `json:"url"`
}
// CacheMetadata tracks when data was last fetched
type CacheMetadata struct {
Key string `json:"key"`
LastFetch time.Time `json:"last_fetch"`
TTLMinutes int `json:"ttl_minutes"`
}
// IsCacheValid checks if the cache is still valid based on TTL
func (cm *CacheMetadata) IsCacheValid() bool {
expiryTime := cm.LastFetch.Add(time.Duration(cm.TTLMinutes) * time.Minute)
return time.Now().Before(expiryTime)
}
// DashboardData aggregates all data for the main view
type DashboardData struct {
Tasks []Task `json:"tasks"`
Notes []Note `json:"notes"`
Meals []Meal `json:"meals"`
Boards []Board `json:"boards,omitempty"`
LastUpdated time.Time `json:"last_updated"`
Errors []string `json:"errors,omitempty"`
}
|