add more fields to device data

This commit is contained in:
Nam Huynh 2021-08-21 19:40:21 +07:00
parent 7c8cf0eb1b
commit 342834dfe9
2 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,7 @@ func (s Service) GetStaffPermissionsByToken(token string) (doc StaffPermissions)
ctx := context.Background() ctx := context.Background()
stm, args, _ := s.Builder. stm, args, _ := s.Builder.
Select("dm.id AS device_id, s.id, s.name, s.account_type, sr.permissions"). Select("dm.id AS device_id, s.id, s.name, s.account_type, s.active, sr.permissions").
From(fmt.Sprintf("%s AS dm", TableDeviceMngt)). From(fmt.Sprintf("%s AS dm", TableDeviceMngt)).
Join(fmt.Sprintf("LEFT JOIN %s s ON s.id = dm.owner_id", TableStaff)). Join(fmt.Sprintf("LEFT JOIN %s s ON s.id = dm.owner_id", TableStaff)).
Join(fmt.Sprintf("LEFT JOIN %s sr ON s.role_id = sr.id", TableStaffRole)). Join(fmt.Sprintf("LEFT JOIN %s sr ON s.role_id = sr.id", TableStaffRole)).

View File

@ -62,5 +62,6 @@ type StaffPermissions struct {
Name string `db:"name"` Name string `db:"name"`
Permissions []string `db:"permissions"` Permissions []string `db:"permissions"`
AccountType string `db:"account_type"` AccountType string `db:"account_type"`
Active bool `db:"active"`
DeviceID string `db:"device_id"` DeviceID string `db:"device_id"`
} }