add PATCH update delivery status by id
This commit is contained in:
@@ -17,6 +17,7 @@ type Querier interface {
|
||||
GetDeliveryByID(ctx context.Context, id pgtype.UUID) (Delivery, error)
|
||||
GetDeliveryCount(ctx context.Context) ([]GetDeliveryCountRow, error)
|
||||
UpdateDelivery(ctx context.Context, arg UpdateDeliveryParams) error
|
||||
UpdateDeliveryStatus(ctx context.Context, arg UpdateDeliveryStatusParams) error
|
||||
}
|
||||
|
||||
var _ Querier = (*Queries)(nil)
|
||||
|
||||
@@ -186,3 +186,17 @@ func (q *Queries) UpdateDelivery(ctx context.Context, arg UpdateDeliveryParams)
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateDeliveryStatus = `-- name: UpdateDeliveryStatus :exec
|
||||
UPDATE deliveries SET status = $1, updated_at = NOW() WHERE id = $2
|
||||
`
|
||||
|
||||
type UpdateDeliveryStatusParams struct {
|
||||
Status string `db:"status" json:"status"`
|
||||
ID pgtype.UUID `db:"id" json:"id"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateDeliveryStatus(ctx context.Context, arg UpdateDeliveryStatusParams) error {
|
||||
_, err := q.db.Exec(ctx, updateDeliveryStatus, arg.Status, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user