From b5e9f2dd9b38380a073de202b6f94004c3b3ee92 Mon Sep 17 00:00:00 2001 From: Nam Huynh Date: Sat, 21 Aug 2021 19:36:53 +0700 Subject: [PATCH] add more fields to device data --- action_get_device_permissions.go | 2 +- model.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/action_get_device_permissions.go b/action_get_device_permissions.go index 05e95b5..ec16f5d 100644 --- a/action_get_device_permissions.go +++ b/action_get_device_permissions.go @@ -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)). diff --git a/model.go b/model.go index 7cd84a5..24e1812 100644 --- a/model.go +++ b/model.go @@ -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"` }