feat: add post buy count

This commit is contained in:
yanghao05
2025-04-18 22:10:28 +08:00
parent 2cb7960302
commit 192bd07b9e
13 changed files with 429 additions and 11 deletions

View File

@@ -198,3 +198,20 @@ func (m *mediasModel) GetByID(ctx context.Context, id int64) (*model.Medias, err
return &media, nil
}
// Delete
func (m *mediasModel) Delete(ctx context.Context, id int64) error {
tbl := table.Medias
stmt := tbl.
DELETE().
WHERE(tbl.ID.EQ(Int64(id)))
m.log.Infof("sql: %s", stmt.DebugSql())
if _, err := stmt.ExecContext(ctx, db); err != nil {
m.log.Errorf("error deleting media item: %v", err)
return err
}
m.log.Infof("media item deleted successfully")
return nil
}