Fix search issue

This commit is contained in:
Aleksander Wilczyński 2024-08-03 01:09:35 +02:00
parent b4e58ff3d2
commit 3b9106717f
Signed by untrusted user: alekswilc
GPG Key ID: D4464A248E5F27FE
4 changed files with 3 additions and 15 deletions

11
package-lock.json generated
View File

@ -18,7 +18,6 @@
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/mongoose": "^5.11.97",
"@types/node": "^22.0.0",
"@types/uuid": "^10.0.0",
"copyfiles": "^2.4.1",
@ -141,16 +140,6 @@
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
"dev": true
},
"node_modules/@types/mongoose": {
"version": "5.11.97",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.11.97.tgz",
"integrity": "sha512-cqwOVYT3qXyLiGw7ueU2kX9noE8DPGRY6z8eUxudhXY8NZ7DMKYAxyZkLSevGfhCX3dO/AoX5/SO9lAzfjon0Q==",
"deprecated": "Mongoose publishes its own types, so you do not need to install this package.",
"dev": true,
"dependencies": {
"mongoose": "*"
}
},
"node_modules/@types/node": {
"version": "22.0.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz",

View File

@ -12,7 +12,6 @@
"description": "",
"devDependencies": {
"@types/express": "^4.17.21",
"@types/mongoose": "^5.11.97",
"@types/node": "^22.0.0",
"@types/uuid": "^10.0.0",
"copyfiles": "^2.4.1",

View File

@ -27,7 +27,7 @@ export class ApiModule {
})
app.get('/search', async (req, res) => {
if (!req.query.q) return res.send('invalid');
if (!req.query.q) return res.redirect('/');
const records = await MLog.find({ $text: { $search: req.query.q as string } })
.sort({ leftDate: -1 })
.limit(30)
@ -39,7 +39,7 @@ export class ApiModule {
})
app.get('/details/:id', async (req, res) => {
if (!req.params.id) return res.send('invalid');
if (!req.params.id) return res.redirect('/');
const record = await MLog.findOne({ id: req.params.id });
const player = await PlayerUtil.getPlayer(record?.userSteamId!);

View File

@ -1,4 +1,4 @@
import { RedisClient, RedisClientType } from 'redis'
import { RedisClientType } from 'redis'
import { SimrailClient } from '../util/SimrailClient.ts'
/* eslint no-var: off */
declare global