niki/repository/mysql/kind_box_req/reject.go

21 lines
695 B
Go
Raw Normal View History

package mysqlkindboxreq
import (
"context"
"git.gocasts.ir/ebhomengo/niki/entity"
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (d DB) RejectKindBoxReq(ctx context.Context, kindBoxReqID uint, description string) error {
op := richerror.Op("mysqlkindboxreq.RejectKindBoxReq")
_, err := d.conn.Conn().ExecContext(ctx, `update kind_box_reqs set description = ? , status = ? where id = ?`,
description, entity.KindBoxReqRejectedStatus.String(), kindBoxReqID)
if err != nil {
return richerror.New(op).WithErr(err).
WithMessage(errmsg.ErrorMsgSomethingWentWrong).WithKind(richerror.KindUnexpected)
}
return nil
}