Feat: User Session History

This commit is contained in:
chreamy committed 2024-03-05 00:26:22 -06:00
1 parent dc972173a4
commit a71411d5bf
9 files changed
+92 -19

No files matched your search

+12 -1
View File
@@ -1,5 +1,5 @@
import Pagination from '../models/pagination.ts'
import { userList } from '../models/users.js'
import { userList, userDetail, idToUser } from '../models/users.js'
export async function userListController(req: any, res: any) {
const { nextKey, order } = req.query
@@ -20,3 +20,14 @@ export async function userListController(req: any, res: any) {
res.status(500).send('Error fetching user data')
}
}
export async function userDetailController(req: any, res: any) {
const { id } = req.params
const sessions = await userDetail(id)
try {
const user = await idToUser(id)
res.render('usersDetail', { sessions, user })
} catch (error) {
console.error(error)
res.status(500).send('Error fetching user data')
}
}