add more fields to device data
This commit is contained in:
parent
342834dfe9
commit
a6746c0562
|
@ -14,8 +14,8 @@ func (s Service) GetStaffPermissionsByToken(token string) (doc StaffPermissions)
|
|||
stm, args, _ := s.Builder.
|
||||
Select("dm.id AS device_id, s.id, s.name, s.account_type, s.active, 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)).
|
||||
LeftJoin(fmt.Sprintf("%s AS s ON s.id = dm.owner_id", TableStaff)).
|
||||
LeftJoin(fmt.Sprintf("%s AS sr ON s.role_id = sr.id", TableStaffRole)).
|
||||
Where("dm.auth_token = ?", token).
|
||||
ToSql()
|
||||
if err := s.DB.GetContext(ctx, &doc, stm, args...); err != nil {
|
||||
|
|
|
@ -3,6 +3,7 @@ package devicemngt
|
|||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Selly-Modules/logger"
|
||||
|
@ -73,7 +74,8 @@ func (s Service) Upsert(payload UpsertPayload) {
|
|||
|
||||
// Auth token
|
||||
if headerData.AuthToken != "" {
|
||||
authToken = headerData.AuthToken
|
||||
// Get token only, remove "Bearer "
|
||||
authToken = strings.Split(headerData.AuthToken, " ")[1]
|
||||
} else {
|
||||
authToken = payload.AuthToken
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue