Add date/time flag to command and update functions

This commit is contained in:
Dan Jones 2026-03-01 08:52:59 -06:00
commit 21d27f8068
5 changed files with 13 additions and 10 deletions

View file

@ -30,7 +30,7 @@ func Fetch(ctx context.Context, url string) (*ytd.ExtractedInfo, error) {
return infos[0], nil
}
func GetLog(ctx context.Context, url string) (models.Log, error) {
func GetLog(ctx context.Context, url string, now time.Time) (models.Log, error) {
select {
case <-ctx.Done():
return models.Log{}, context.Cause(ctx)
@ -42,8 +42,8 @@ func GetLog(ctx context.Context, url string) (models.Log, error) {
if err != nil {
return models.Log{}, err
}
now := time.Now()
ent.Date = now
// TODO Get published date
metas := &ent.Fields
*metas = metas.Set("id", getID(now, info))