diff --git a/api/openapi/openapi.yaml b/api/openapi/openapi.yaml index 85ecff5..9e4ad33 100644 --- a/api/openapi/openapi.yaml +++ b/api/openapi/openapi.yaml @@ -98,7 +98,7 @@ paths: application/json: schema: $ref: "#/components/schemas/AccountSigninResponse" - /account/logout: + /account/signout: post: tags: - account diff --git a/internal/api/services/accounts/accounts_verify.go b/internal/api/services/accounts/accounts_verify.go index 84d4bd1..7a0f1af 100755 --- a/internal/api/services/accounts/accounts_verify.go +++ b/internal/api/services/accounts/accounts_verify.go @@ -90,6 +90,7 @@ func AccountVerify_Service(ctx iris.Context, req types.AccountVerifyRequest) { ctx.JSON(types.CommonErrorResponse{ Error: "Something went wrong, please try again", }) + logboi.Err("Failed to commit transaction: " + err.Error()) return } diff --git a/internal/api/services/users/users_getbyuuid.go b/internal/api/services/users/users_getbyuuid.go index 1580e3f..37a2688 100755 --- a/internal/api/services/users/users_getbyuuid.go +++ b/internal/api/services/users/users_getbyuuid.go @@ -33,9 +33,9 @@ import ( // UsersGetByUuid_Service gets all users from the database by uuid func UsersGetByUuid_Service(ctx iris.Context) { - // Get user ID from URL parameters - uuid, err := ctx.Params().GetUint64("uuid") - if err != nil { + // Get user UUID from URL parameters + uuid := ctx.Params().GetString("uuid") + if uuid != "" { ctx.StatusCode(iris.StatusBadRequest) ctx.JSON(types.CommonErrorResponse{ Error: "Invalid uuid parameter", @@ -45,7 +45,7 @@ func UsersGetByUuid_Service(ctx iris.Context) { // Get user from database var user db.User - err = db.Db.Model(&db.User{}).Where("uuid = ?", uuid).Select("id", "username", "email", "uuid", "role", "first_name", "last_name", "verified", "friends").Find(&user).Error + err := db.Db.Model(&db.User{}).Where("uuid = ?", uuid).Select("id", "username", "email", "uuid", "role", "first_name", "last_name", "verified", "friends").Find(&user).Error if err != nil { ctx.StatusCode(iris.StatusInternalServerError) ctx.JSON(types.CommonErrorResponse{ diff --git a/internal/api/services/users/users_getself.go b/internal/api/services/users/users_getself.go index e80f787..ffb7bcc 100755 --- a/internal/api/services/users/users_getself.go +++ b/internal/api/services/users/users_getself.go @@ -39,8 +39,8 @@ func UsersGetSelf_Service(ctx iris.Context) { id := claims.UserId // Get user from database - var user []db.User - err := db.Db.Model(&db.User{}).Where("id = ?", id).Select("id", "username", "email", "uuid", "role", "first_name", "last_name", "verified", "friends").Find(&user).Error + var user db.User + err := db.Db.Model(&db.User{}).Where("id = ?", id).Select("id", "username", "email", "uuid", "role", "first_name", "last_name", "verified", "friends").First(&user).Error if err != nil { ctx.StatusCode(iris.StatusInternalServerError) ctx.JSON(types.CommonErrorResponse{ diff --git a/internal/database/models.go b/internal/database/models.go index 7187caf..18119ff 100755 --- a/internal/database/models.go +++ b/internal/database/models.go @@ -37,7 +37,7 @@ type User struct { Uuid string `json:"uuid"` Role string `json:"role"` Friends Friends `gorm:"type:VARCHAR(255)" json:"friends"` - Hash string `json:"hash"` + Hash string `json:"hash,omitempty"` Verified bool `json:"verified"` }