add org structure

This commit is contained in:
andrusyakka
2023-07-05 18:44:22 +03:00
parent ac08cceda0
commit 9234b577bb
8 changed files with 57 additions and 11 deletions

8
model/position.go Normal file
View File

@@ -0,0 +1,8 @@
package model
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"`
}

View File

@@ -5,9 +5,12 @@ import "gorm.io/gorm"
type (
User struct {
gorm.Model
UserName string `json:"userName" gorm:"unique"`
Password string `json:"password,omitempty"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
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"`
}
)