41 lines
2.4 KiB
Go
41 lines
2.4 KiB
Go
package entity
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"time"
|
|
)
|
|
|
|
type Users struct {
|
|
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
|
|
Username string `json:"username" gorm:"type:varchar"`
|
|
Email string `json:"email" gorm:"type:varchar"`
|
|
Fullname string `json:"fullname" gorm:"type:varchar"`
|
|
Address *string `json:"address" gorm:"type:varchar"`
|
|
PhoneNumber *string `json:"phone_number" gorm:"type:varchar"`
|
|
WorkType *string `json:"work_type" gorm:"type:varchar"`
|
|
GenderType *string `json:"gender_type" gorm:"type:varchar"`
|
|
IdentityType *string `json:"identity_type" gorm:"type:varchar"`
|
|
IdentityGroup *string `json:"identity_group" gorm:"type:varchar"`
|
|
IdentityGroupNumber *string `json:"identity_group_number" gorm:"type:varchar"`
|
|
IdentityNumber *string `json:"identity_number" gorm:"type:varchar"`
|
|
DateOfBirth *string `json:"date_of_birth" gorm:"type:varchar"`
|
|
LastEducation *string `json:"last_education" gorm:"type:varchar"`
|
|
UserRoleId uint `json:"user_role_id" gorm:"type:int4"`
|
|
UserLevelId uint `json:"user_level_id" gorm:"type:int4"`
|
|
UserLevel *UserLevels `json:"user_levels" gorm:"foreignKey:UserLevelId;references:ID"`
|
|
KeycloakId *string `json:"keycloak_id" gorm:"type:varchar"`
|
|
StatusId *int `json:"status_id" gorm:"type:int4;default:1"`
|
|
CreatedById *uint `json:"created_by_id" gorm:"type:int4"`
|
|
ProfilePicturePath *string `json:"profile_picture_path" gorm:"type:varchar"`
|
|
TempPassword *string `json:"temp_password" gorm:"type:varchar"`
|
|
IsEmailUpdated *bool `json:"is_email_updated" gorm:"type:bool;default:false"`
|
|
|
|
// Multi-tenant access control
|
|
IsSuperAdmin *bool `json:"is_super_admin" gorm:"type:bool;default:false"` // Platform super admin (access all clients)
|
|
ClientId *uuid.UUID `json:"client_id" gorm:"type:UUID"` // Primary/default client
|
|
ClientAccesses []UserClientAccess `json:"client_accesses,omitempty" gorm:"foreignKey:UserId;references:ID"` // Multiple client access
|
|
|
|
IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
|
} |