mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-19 18:34:25 +02:00
Update sessions modal to show username & update sessions endpoints to always return username
This commit is contained in:
parent
3845940245
commit
e678fe6e2f
3 changed files with 23 additions and 13 deletions
|
@ -57,26 +57,24 @@ class SessionController {
|
|||
}
|
||||
|
||||
let where = null
|
||||
const include = [
|
||||
{
|
||||
model: Database.models.device
|
||||
}
|
||||
]
|
||||
|
||||
if (userId) {
|
||||
where = {
|
||||
userId
|
||||
}
|
||||
} else {
|
||||
include.push({
|
||||
model: Database.userModel,
|
||||
attributes: ['id', 'username']
|
||||
})
|
||||
}
|
||||
|
||||
const { rows, count } = await Database.playbackSessionModel.findAndCountAll({
|
||||
where,
|
||||
include,
|
||||
include: [
|
||||
{
|
||||
model: Database.deviceModel
|
||||
},
|
||||
{
|
||||
model: Database.userModel,
|
||||
attributes: ['id', 'username']
|
||||
}
|
||||
],
|
||||
order: [[orderKey, orderDesc]],
|
||||
limit: itemsPerPage,
|
||||
offset: itemsPerPage * page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue