added additional tests for parent id

This commit is contained in:
$(pass /github/name)
2024-07-12 18:58:32 +02:00
parent 0b2ad57864
commit ac037b12e0
2 changed files with 14 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
package controllers
import (
"fmt"
"GoMembership/internal/models"
"GoMembership/internal/services"
@@ -45,7 +47,7 @@ func (uc *UserController) RegisterUser(c *gin.Context) {
id, token, err := uc.Service.RegisterUser(&regData.User)
if err != nil {
logger.Error.Printf("Couldn't register User: %v", err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "Couldn't register User"})
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("Couldn't register User: %v", err)})
return
}
regData.User.ID = id
@@ -85,7 +87,6 @@ func (uc *UserController) RegisterUser(c *gin.Context) {
logger.Error.Printf("Failed to notify admin of new user registration: %v", err)
// Proceed without returning error since user registration is successful
}
c.JSON(http.StatusCreated, gin.H{
"status": "success",
"id": regData.User.ID,