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

@@ -40,14 +40,17 @@ func (q *Queries) CreateRole(ctx context.Context, arg CreateRoleParams) (Role, e
return i, err
}
const deleteRole = `-- name: DeleteRole :exec
const deleteRole = `-- name: DeleteRole :execrows
DELETE FROM roles
WHERE id = $1
`
func (q *Queries) DeleteRole(ctx context.Context, id uuid.UUID) error {
_, err := q.db.Exec(ctx, deleteRole, id)
return err
func (q *Queries) DeleteRole(ctx context.Context, id uuid.UUID) (int64, error) {
result, err := q.db.Exec(ctx, deleteRole, id)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
const getRoleByID = `-- name: GetRoleByID :one