mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
feat: user sessions history & fix ts <any>
This commit is contained in:
1 parent
94ae2d7df4
commit
218a25daee
7 files changed
+95
-43
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { userCount } from '../models/users.js'
|
||||
import { questList } from '../models/quests.ts'
|
||||
|
||||
import { Request, Response } from 'express'
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export async function homeController(req: any, res: any) {
|
||||
export async function homeController(req: Request, res: Response) {
|
||||
const quests = await questList()
|
||||
const [totalQuests, totalCompleted] = quests.reduce(
|
||||
([total, completed], quest) => [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { questList } from '../models/quests.js'
|
||||
import { Request, Response } from 'express'
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export async function questListController(req: any, res: any) {
|
||||
export async function questListController(req: Request, res: Response) {
|
||||
const quests = await questList()
|
||||
quests.forEach((quest) => {
|
||||
quest.failed = quest.started - quest.completed
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Pagination from '../models/pagination.ts'
|
||||
import { sessionList, sessionDetail } from '../models/sessions.ts'
|
||||
import { Request, Response } from 'express'
|
||||
export async function sessionListController(req: any, res: any) {
|
||||
const { nextKey, order } = req.query
|
||||
export async function sessionListController(req: Request, res: Response) {
|
||||
const { nextKey, order } = req.query as { nextKey: string; order: string }
|
||||
const itemsPerPage = 50
|
||||
|
||||
try {
|
||||
@@ -21,7 +21,7 @@ export async function sessionListController(req: any, res: any) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function sessionDetailController(req: any, res: any) {
|
||||
export async function sessionDetailController(req: Request, res: Response) {
|
||||
const { id } = req.params
|
||||
const session = await sessionDetail(id)
|
||||
res.render('sessionDetail', { session })
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
<<<<<<< HEAD
|
||||
import mongoose from 'mongoose'
|
||||
import Pagination from '../models/pagination.ts'
|
||||
import { userList, userDetail, idToUser } from '../models/users.js'
|
||||
=======
|
||||
import Pagination from '../models/pagination.js'
|
||||
import { userList } from '../models/users.js'
|
||||
>>>>>>> bb4a11b20c8fdad8459ac3b7a0fdb8d9d9221e31
|
||||
|
||||
export async function userListController(req: any, res: any) {
|
||||
const { nextKey, order } = req.query
|
||||
import { Request, Response } from 'express'
|
||||
export async function userListController(req: Request, res: Response) {
|
||||
const { nextKey, order } = req.query as { nextKey: string; order: string }
|
||||
const itemsPerPage = 50
|
||||
|
||||
try {
|
||||
@@ -25,9 +21,8 @@ export async function userListController(req: any, res: any) {
|
||||
res.status(500).send('Error fetching user data')
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
export async function userDetailController(req: any, res: any) {
|
||||
const { id } = req.params
|
||||
export async function userDetailController(req: Request, res: Response) {
|
||||
const id = new mongoose.Types.ObjectId(req.params.id)
|
||||
const sessions = await userDetail(id)
|
||||
try {
|
||||
const user = await idToUser(id)
|
||||
@@ -37,5 +32,3 @@ export async function userDetailController(req: any, res: any) {
|
||||
res.status(500).send('Error fetching user data')
|
||||
}
|
||||
}
|
||||
=======
|
||||
>>>>>>> bb4a11b20c8fdad8459ac3b7a0fdb8d9d9221e31
|
||||
Reference in new issue
Block a user