register controller

This commit is contained in:
Fran Jurmanović
2021-05-08 18:26:02 +02:00
parent 20894ee42e
commit 316c39b2dd
12 changed files with 193 additions and 3 deletions

9
pkg/models/db.go Normal file
View File

@@ -0,0 +1,9 @@
package models
import "time"
type CommonModel struct {
Id string `json:"id" pg:"id"`
DateCreated time.Time `json:"dateCreated" pg:"datecreated"`
DateUpdated time.Time `json:"dateUpdated" pg:"dateupdated"`
}

7
pkg/models/exception.go Normal file
View File

@@ -0,0 +1,7 @@
package models
type ExceptionModel struct {
ErrorCode string `json:"errorCode"`
Message string `json:"message"`
StatusCode int `json:"statusCode"`
}

25
pkg/models/register.go Normal file
View File

@@ -0,0 +1,25 @@
package models
type UserModel struct {
tableName struct{} `pg:"users,alias:users"`
CommonModel
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
}
type UserReturnInfoModel struct {
tableName struct{} `pg:"users,alias:users"`
CommonModel
Username string `json:"username"`
Email string `json:"email"`
}
func (um *UserModel) Payload() UserReturnInfoModel {
payload := UserReturnInfoModel{
CommonModel: um.CommonModel,
Username: um.Username,
Email: um.Email,
}
return payload
}