fix uuid errors
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package model
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type Position struct {
|
||||
Name string `json:"name" gorm:"unique;index"`
|
||||
RightMask int `json:"right_mask"`
|
||||
OrganizationID uint `json:"organization_id"`
|
||||
Users []User `json:"users,omitempty"`
|
||||
Name string `json:"name" gorm:"unique;index"`
|
||||
RightMask int `json:"right_mask"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
Users []User `json:"users,omitempty"`
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ type (
|
||||
User struct {
|
||||
gorm.Model
|
||||
ID uuid.UUID
|
||||
UserName string `json:"user_name" gorm:"unique;index"`
|
||||
Password string `json:"password,omitempty"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Role string `json:"role" gorm:"default:employee"`
|
||||
PositionID uint `json:"-"`
|
||||
Position Position `gorm:"-:migration"`
|
||||
UserName string `json:"user_name" gorm:"unique;index"`
|
||||
Password string `json:"password,omitempty"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name"`
|
||||
Role string `json:"role" gorm:"default:employee"`
|
||||
PositionID uuid.UUID `json:"-"`
|
||||
Position Position `gorm:"-:migration"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ func Login(c echo.Context) (err error) {
|
||||
claims["role"] = u.Role
|
||||
claims["position_name"] = u.Position.Name
|
||||
claims["position_rm"] = strconv.Itoa(u.Position.RightMask)
|
||||
claims["position_org_id"] = strconv.Itoa(int(u.Position.OrganizationID))
|
||||
claims["position_org_id"] = u.Position.OrganizationID
|
||||
|
||||
var _token, _ = token.SignedString([]byte(config.Env.Server.JWTSecret))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user