feat: update download job
This commit is contained in:
@@ -231,3 +231,21 @@ func (m *mediasModel) Update(ctx context.Context, hash string, model *model.Medi
|
||||
m.log.Infof("media item updated successfully")
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetByID
|
||||
func (m *mediasModel) GetByID(ctx context.Context, id int64) (*model.Medias, error) {
|
||||
tbl := table.Medias
|
||||
stmt := tbl.
|
||||
SELECT(tbl.AllColumns).
|
||||
WHERE(tbl.ID.EQ(Int64(id)))
|
||||
m.log.Infof("sql: %s", stmt.DebugSql())
|
||||
|
||||
var media model.Medias
|
||||
err := stmt.QueryContext(ctx, db, &media)
|
||||
if err != nil {
|
||||
m.log.Errorf("error querying media item by ID: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &media, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user