backend: fixed wrong error codes

This commit is contained in:
Alex
2025-03-02 23:14:03 +01:00
parent 6937ab333c
commit ff3106b8be
9 changed files with 37 additions and 22 deletions

View File

@@ -274,7 +274,11 @@ func (uc *UserController) RegisterUser(c *gin.Context) {
return
}
}
regData.User.RoleID = constants.Roles.Member
if regData.User.Membership.SubscriptionModel.Name == constants.SupporterSubscriptionModelName {
regData.User.RoleID = constants.Roles.Supporter
} else {
regData.User.RoleID = constants.Roles.Member
}
// Register User
id, token, err := uc.Service.RegisterUser(&regData.User)
@@ -288,6 +292,16 @@ func (uc *UserController) RegisterUser(c *gin.Context) {
}
regData.User.ID = id
// if this is a supporter don't send mails and he never did give any consent. So stop here
if regData.User.RoleID == constants.Roles.Supporter {
c.JSON(http.StatusCreated, gin.H{
"message": "Supporter Registration successuful",
"id": regData.User.ID,
})
return
}
// Register Consents
var consents = [2]models.Consent{
{