diff --git a/common/responses.go b/common/responses.go index 8063565..ea51a28 100644 --- a/common/responses.go +++ b/common/responses.go @@ -2,13 +2,6 @@ package common import "github.com/jinzhu/gorm/dialects/postgres" -type UserResponse struct { - Username string `json:"username"` - Role string `json:"role"` - Mail string `json:"mail"` - ID uint `json:"id"` -} - type ScenarioResponse struct { Name string `json:"name"` ID uint `json:"id"` diff --git a/common/serializers.go b/common/serializers.go index 8f2b044..e9eb56f 100644 --- a/common/serializers.go +++ b/common/serializers.go @@ -4,53 +4,6 @@ import ( "github.com/gin-gonic/gin" ) -// User/s Serializers - -type UsersSerializer struct { - Ctx *gin.Context - Users []User -} - -func (self *UsersSerializer) Response(assoc bool) []UserResponse { - response := []UserResponse{} - for _, user := range self.Users { - serializer := UserSerializer{self.Ctx, user} - response = append(response, serializer.Response(assoc)) - } - return response -} - -type UserSerializer struct { - Ctx *gin.Context - User -} - -func (self *UserSerializer) Response(assoc bool) UserResponse { - - response := UserResponse{ - Username: self.Username, - Role: self.Role, - Mail: self.Mail, - ID: self.ID, - } - - // Associated models MUST NOT called with assoc=true otherwise we - // will have an infinite loop due to the circular dependencies - if assoc { - - // TODO: maybe all those should be made in one transaction - - //scenarios, _, _ := scenario.FindUserScenarios(&self.User) - //scenariosSerializer := - // ScenariosSerializer{self.Ctx, scenarios} - - // Add the associated models to the response - //response.Scenarios = scenariosSerializer.Response() - } - - return response -} - // Scenario/s Serializers type ScenariosSerializer struct { diff --git a/routes/user/user_endpoints.go b/routes/user/user_endpoints.go index 6f945da..a1641ce 100644 --- a/routes/user/user_endpoints.go +++ b/routes/user/user_endpoints.go @@ -21,13 +21,6 @@ type tokenClaims struct { jwt.StandardClaims } -type AuthResponse struct { - Success bool `json:"success"` - Message string `json:"message"` - Token string `json:"token"` - User common.UserResponse `json:"user"` -} - func VisitorAuthenticate(r *gin.RouterGroup) { r.POST("", authenticate) }