Skip to content

Commit

Permalink
refactor(style): simplify source code removal
Browse files Browse the repository at this point in the history
  • Loading branch information
vednoc committed Sep 24, 2023
1 parent 596ced4 commit a78cf24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
5 changes: 1 addition & 4 deletions handlers/style/ban.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ func BanPost(c *fiber.Ctx) error {
if err = models.CreateLog(tx, &logEntry); err != nil {
return err
}
if err = models.RemoveStyleCode(strconv.Itoa(int(s.ID))); err != nil {
return err
}
return nil
return models.RemoveStyleCode(id)
})
if err != nil {
log.Database.Printf("Failed to remove %d: %s\n", i, err)
Expand Down
7 changes: 1 addition & 6 deletions handlers/style/delete.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package style

import (
"strconv"

"github.com/gofiber/fiber/v2"
"gorm.io/gorm"

Expand Down Expand Up @@ -79,10 +77,7 @@ func DeletePost(c *fiber.Ctx) error {
if err = storage.DeleteSearchData(tx, i); err != nil {
return err
}
if err = models.RemoveStyleCode(strconv.Itoa(int(s.ID))); err != nil {
return err
}
return nil
return models.RemoveStyleCode(id)
})
if err != nil {
log.Database.Printf("Failed to delete %d: %s\n", i, err)
Expand Down

0 comments on commit a78cf24

Please sign in to comment.