feat: admin dashboard last logins

This commit is contained in:
NGPixel
2020-04-13 15:54:10 -04:00
committed by Nicolas Giard
parent 514d31a46d
commit 9a93ac28f2
5 changed files with 75 additions and 43 deletions

View File

@@ -46,6 +46,13 @@ module.exports = {
usr.tfaSecret = ''
return usr
},
async lastLogins (obj, args, context, info) {
return WIKI.models.users.query()
.select('id', 'name', 'lastLoginAt')
.whereNotNull('lastLoginAt')
.orderBy('lastLoginAt', 'desc')
.limit(10)
}
},
UserMutation: {

View File

@@ -29,6 +29,8 @@ type UserQuery {
): User @auth(requires: ["manage:users", "manage:system"])
profile: UserProfile
lastLogins: [UserLastLogin] @auth(requires: ["write:groups", "manage:groups", "write:users", "manage:users", "manage:system"])
}
# -----------------------------------------------
@@ -99,6 +101,12 @@ type UserResponse {
user: User
}
type UserLastLogin {
id: Int!
name: String!
lastLoginAt: Date!
}
type UserMinimal {
id: Int!
name: String!