fix(delete): update delete operations to return affected rows for cabinets, rooms, and warehouses

This commit is contained in:
Tran Anh Tuan
2026-05-08 15:54:28 +07:00
parent 58cfe890a1
commit 4382c53aac
15 changed files with 75 additions and 36 deletions

View File

@@ -49,14 +49,17 @@ func (q *Queries) CreateWarehouse(ctx context.Context, arg CreateWarehouseParams
return i, err
}
const deleteWarehouse = `-- name: DeleteWarehouse :exec
const deleteWarehouse = `-- name: DeleteWarehouse :execrows
DELETE FROM warehouses
WHERE id = $1
`
func (q *Queries) DeleteWarehouse(ctx context.Context, id int64) error {
_, err := q.db.Exec(ctx, deleteWarehouse, id)
return err
func (q *Queries) DeleteWarehouse(ctx context.Context, id int64) (int64, error) {
result, err := q.db.Exec(ctx, deleteWarehouse, id)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
const getWarehouseByID = `-- name: GetWarehouseByID :one