add more fields to device data

This commit is contained in:
Nam Huynh 2021-08-21 19:36:53 +07:00
parent e78f8befa1
commit b5e9f2dd9b
2 changed files with 3 additions and 1 deletions

View File

@ -12,7 +12,7 @@ func (s Service) GetDevicePermissionsByToken(token string) (doc StaffDevicePermi
ctx := context.Background()
stm, args, _ := s.Builder.
Select("dm.id, s.account_type, sr.permissions").
Select("dm.id AS device_id, s.id, s.name, s.account_type, sr.permissions").
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 sr ON s.role_id = sr.id", TableStaffRole)).

View File

@ -59,6 +59,8 @@ type HeaderData struct {
// StaffDevicePermissions ...
type StaffDevicePermissions struct {
ID string `db:"id"`
Name string `db:"name"`
Permissions []string `db:"permissions"`
AccountType string `db:"account_type"`
DeviceID string `db:"device_id"`
}