core: use local watch-order store

This commit is contained in:
2026-04-11 22:32:56 +02:00
parent 600698e12a
commit 9115e16334
9 changed files with 206 additions and 450 deletions

View File

@@ -9,21 +9,28 @@ import (
"time"
"mal/internal/database"
"mal/internal/watchorder"
)
type Client struct {
httpClient *http.Client
baseURL string
db database.Querier
watchOrders *watchorder.Store
mu sync.Mutex
lastReqTime time.Time
}
func NewClient(db database.Querier) *Client {
func NewClient(db database.Querier, watchOrders *watchorder.Store) *Client {
if watchOrders == nil {
watchOrders = watchorder.EmptyStore()
}
return &Client{
httpClient: &http.Client{Timeout: 10 * time.Second},
baseURL: "https://api.jikan.moe/v4",
db: db,
httpClient: &http.Client{Timeout: 10 * time.Second},
baseURL: "https://api.jikan.moe/v4",
db: db,
watchOrders: watchOrders,
}
}