Add User Partner and Product
This commit is contained in:
+21
-20
@@ -10,27 +10,28 @@ import (
|
||||
)
|
||||
|
||||
type User struct {
|
||||
ID int64
|
||||
Name string
|
||||
Email string
|
||||
Password string
|
||||
Status userstatus.UserStatus
|
||||
NIK string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
RoleID role.Role
|
||||
RoleName string
|
||||
PartnerID *int64
|
||||
BranchName string
|
||||
ID int64
|
||||
Name string
|
||||
Email string
|
||||
Password string
|
||||
Status userstatus.UserStatus
|
||||
NIK string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
RoleID role.Role
|
||||
RoleName string
|
||||
PartnerID *int64
|
||||
PartnerName string
|
||||
}
|
||||
|
||||
type AuthenticateUser struct {
|
||||
Token string
|
||||
Name string
|
||||
RoleID role.Role
|
||||
RoleName string
|
||||
BranchID *int64
|
||||
BranchName string
|
||||
Token string
|
||||
Name string
|
||||
RoleID role.Role
|
||||
RoleName string
|
||||
PartnerID *int64
|
||||
PartnerName string
|
||||
PartnerStatus string
|
||||
}
|
||||
|
||||
type UserRoleDB struct {
|
||||
@@ -53,7 +54,7 @@ func (u *User) ToUserDB(createdBy int64) (*UserDB, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if u.RoleID == role.BranchAdmin && u.PartnerID == nil {
|
||||
if u.RoleID == role.Admin && u.PartnerID == nil {
|
||||
return nil, errors.New("invalid request")
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ func (u *User) ToUserDB(createdBy int64) (*UserDB, error) {
|
||||
Email: u.Email,
|
||||
Password: hashedPassword,
|
||||
RoleID: int64(u.RoleID),
|
||||
BranchID: u.PartnerID,
|
||||
PartnerID: u.PartnerID,
|
||||
Status: userstatus.Active,
|
||||
CreatedBy: createdBy,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user