Skip to content

Commit 1934971

Browse files
committed
[add] attaching receipt is required to change budget's status to "bought"
1 parent 4e52b12 commit 1934971

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/budget/put_budget_budget_id_status_approve.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ func PutBudgetBudgetIdStatusApprove(ctx echo.Context, dbClient db.TransactionCli
2323
if now_detail.Status != "approve" {
2424
return api.ResGetBudgetBudgetId{}, &response.Error{Code: http.StatusInternalServerError, Level: "Error", Message: "ステータスが一致しません", Log: "Unacceptable change"}
2525
}
26+
if requestBody.Bought && len(now_detail.Files) == 0 {
27+
return api.ResGetBudgetBudgetId{}, &response.Error{Code: http.StatusBadRequest, Level: "Error", Message: "購入済みにするには領収書を添付する必要があります", Log: "Receipt not attached"}
28+
}
2629
err = updateApproveBudget(dbClient, budgetId, requestBody)
2730
if err != nil {
2831
return api.ResGetBudgetBudgetId{}, err

0 commit comments

Comments
 (0)