Add callback and update user role

This commit is contained in:
aditya.siregar
2024-06-05 00:24:53 +07:00
parent 4d402e32c9
commit 04a89c5508
27 changed files with 388 additions and 49 deletions
+3
View File
@@ -21,6 +21,7 @@ type User struct {
RoleID role.Role
RoleName string
PartnerID *int64
SiteID *int64
PartnerName string
}
@@ -39,6 +40,7 @@ type UserRoleDB struct {
UserID int64 `gorm:"column:user_id"`
RoleID int64 `gorm:"column:role_id"`
PartnerID *int64 `gorm:"column:partner_id"`
SiteID *int64 `gorm:"column:site_id"`
CreatedAt time.Time `gorm:"column:created_at"`
UpdatedAt time.Time `gorm:"column:updated_at"`
}
@@ -66,6 +68,7 @@ func (u *User) ToUserDB(createdBy int64) (*UserDB, error) {
PartnerID: u.PartnerID,
Status: userstatus.Active,
CreatedBy: createdBy,
SiteID: u.SiteID,
}, nil
}