Harden loan-order create validation and cover gin JSON binding.
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled

Reject zero loanType/branchId/dates before insert, and assert mobile-style payloads bind through gin required tags.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
guwandykandCursor committed 2026-08-26 13:13:38 +05:00
1 parent 6683826662
commit 0d000f9af6
2 files changed
+42 -12

No files matched your search

+4
View File
@@ -152,6 +152,10 @@ func (h *handler) create(c *gin.Context) {
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
return
}
if dto.LoanType.Int64() <= 0 || dto.BranchId.Int64() <= 0 || dto.BornAt.IsZero() || dto.PassportGivenAt.IsZero() {
c.JSON(http.StatusBadRequest, appresult.ErrMissingParam)
return
}
item, err := h.repository.Create(c.Request.Context(), dto)
if err != nil {