🐛 Fix fixes on listing attachments and improve performance
This commit is contained in:
parent
f91143ce9a
commit
168c089456
@ -18,11 +18,13 @@ func listAttachment(c *fiber.Ctx) error {
|
|||||||
|
|
||||||
tx := database.C
|
tx := database.C
|
||||||
|
|
||||||
var author models.Account
|
if len(c.Query("author")) > 0 {
|
||||||
if err := database.C.Where("name = ?", c.Query("author")).Error; err != nil {
|
var author models.Account
|
||||||
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
if err := database.C.Where("name = ?", c.Query("author")).First(&author).Error; err != nil {
|
||||||
} else {
|
return fiber.NewError(fiber.StatusBadRequest, err.Error())
|
||||||
tx = tx.Where("account_id = ?", author.ID)
|
} else {
|
||||||
|
tx = tx.Where("account_id = ?", author.ID)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if usage := strings.Split(c.Query("usage"), " "); len(usage) > 0 {
|
if usage := strings.Split(c.Query("usage"), " "); len(usage) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user