🐛 Bug fixes

This commit is contained in:
LittleSheep 2024-06-01 22:15:10 +08:00
parent 890148d580
commit 850efcdc8b
2 changed files with 6 additions and 5 deletions

View File

@ -2,11 +2,12 @@ package server
import ( import (
"fmt" "fmt"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"strings" "strings"
"time" "time"
"github.com/gofiber/fiber/v2"
"github.com/google/uuid"
"git.solsynth.dev/hydrogen/interactive/pkg/database" "git.solsynth.dev/hydrogen/interactive/pkg/database"
"git.solsynth.dev/hydrogen/interactive/pkg/models" "git.solsynth.dev/hydrogen/interactive/pkg/models"
"git.solsynth.dev/hydrogen/interactive/pkg/services" "git.solsynth.dev/hydrogen/interactive/pkg/services"
@ -95,7 +96,7 @@ func createPost(c *fiber.Ctx) error {
for _, attachment := range data.Attachments { for _, attachment := range data.Attachments {
if !services.CheckAttachmentByIDExists(attachment, "i.attachment") { if !services.CheckAttachmentByIDExists(attachment, "i.attachment") {
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %s not found", attachment)) return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %d not found", attachment))
} }
} }
@ -171,7 +172,7 @@ func editPost(c *fiber.Ctx) error {
for _, attachment := range data.Attachments { for _, attachment := range data.Attachments {
if !services.CheckAttachmentByIDExists(attachment, "i.attachment") { if !services.CheckAttachmentByIDExists(attachment, "i.attachment") {
return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %s not found", attachment)) return fiber.NewError(fiber.StatusBadRequest, fmt.Sprintf("attachment %d not found", attachment))
} }
} }

View File

@ -35,5 +35,5 @@ access_token_duration = 300
refresh_token_duration = 2592000 refresh_token_duration = 2592000
[database] [database]
dsn = "host=localhost dbname=hy_interactive port=5432 sslmode=disable" dsn = "host=localhost user=postgres password=password dbname=hy_interactive port=5432 sslmode=disable"
prefix = "interactive_" prefix = "interactive_"