show last time item was refreshed

This commit is contained in:
2026-02-13 23:20:12 +03:00
parent f43519f7f6
commit a37ed0d902
5 changed files with 42 additions and 7 deletions

View File

@@ -28,11 +28,12 @@ type Torrent struct {
}
type Item struct {
ID int64 `json:"id" db:"id"`
Query string `json:"query" db:"query"`
Category int `json:"category" db:"category"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
Torrents []Torrent `json:"torrents,omitempty"`
ID int64 `json:"id" db:"id"`
Query string `json:"query" db:"query"`
Category int `json:"category" db:"category"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
Torrents []Torrent `json:"torrents,omitempty"`
RefreshedAt *time.Time `json:"refreshedAt" db:"refreshed_at"`
}
func (m *Model) Init() {
@@ -59,6 +60,8 @@ func (m *Model) Init() {
item_id integer not null,
FOREIGN KEY (item_id) REFERENCES users(id)
)`)
m.db.Exec(`ALTER TABLE items ADD COLUMN refreshed_at datetime default null`)
}
func New(db *sqlx.DB) *Model {