Fix 404 & clean code
This commit is contained in:
parent
6b27dd545a
commit
68edf0a76f
9 changed files with 192 additions and 184 deletions
|
|
@ -307,14 +307,14 @@ func ContactEdit(c *fiber.Ctx) error {
|
|||
var person models.Person
|
||||
result := db.Find(&person, "id = ?", id)
|
||||
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return fiber.NewError(fiber.StatusNotFound, "Not found")
|
||||
}
|
||||
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
|
||||
if result.RowsAffected < 1 {
|
||||
return fiber.NewError(fiber.StatusNotFound, "Not found")
|
||||
}
|
||||
|
||||
title := fmt.Sprintf(
|
||||
"%s %s | Modifier contact",
|
||||
person.LastName,
|
||||
|
|
@ -549,14 +549,14 @@ func ContactConvert(c *fiber.Ctx) error {
|
|||
var person models.Person
|
||||
result := db.Find(&person, "id = ?", id)
|
||||
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return fiber.NewError(fiber.StatusNotFound, "Not found")
|
||||
}
|
||||
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
|
||||
if result.RowsAffected < 1 {
|
||||
return fiber.NewError(fiber.StatusNotFound, "Not found")
|
||||
}
|
||||
|
||||
person.IsContact = false
|
||||
person.IsMember = true
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue