Include local on userPresence View

This commit is contained in:
Douglas Barone 2022-03-31 16:05:04 -04:00
parent 0278e56929
commit 7f4fcb5318
3 changed files with 11 additions and 4 deletions

View File

@ -7,7 +7,12 @@ export async function userPresence(_, { search }) {
where: {
wifiDevices: { some: { lastSeen: { not: null } } }
},
include: { wifiDevices: { orderBy: [{ lastSeen: 'desc' }] } }
include: {
wifiDevices: {
orderBy: [{ lastSeen: 'desc' }],
include: { accessPoint: true }
}
}
})
search = search.toLowerCase().trim()
@ -57,7 +62,8 @@ export async function userPresence(_, { search }) {
thumbnailPhoto: userPresence.thumbnailPhoto,
lastSeen: userPresence.wifiDevices[0].lastSeen,
status: userPresence.wifiDevices[0].status,
apName: userPresence.wifiDevices[0].apName
apName: userPresence.wifiDevices[0].apName,
local: userPresence.wifiDevices[0].accessPoint.local
}))
.slice(0, 200)
}

View File

@ -252,6 +252,7 @@ const typeDefs = gql`
lastSeen: String!
status: Status!
apName: String!
local: String
}
"The status of a Device"

View File

@ -139,9 +139,8 @@
<span class="font-weight-medium">On-line</span>
</v-list-item-subtitle>
<v-list-item-subtitle>
Próximo ao AP
<span class="font-weight-medium">
{{ userPresence.apName }}
{{ userPresence.local || userPresence.apName }}
</span>
</v-list-item-subtitle>
</template>
@ -290,6 +289,7 @@ export default {
lastSeen
status
apName
local
}
}
`,