forked from simrail/simrail.pro
Fix search issue
This commit is contained in:
parent
b4e58ff3d2
commit
3b9106717f
11
package-lock.json
generated
11
package-lock.json
generated
@ -18,7 +18,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/mongoose": "^5.11.97",
|
|
||||||
"@types/node": "^22.0.0",
|
"@types/node": "^22.0.0",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
@ -141,16 +140,6 @@
|
|||||||
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
|
"integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==",
|
||||||
"dev": true
|
"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": {
|
"node_modules/@types/node": {
|
||||||
"version": "22.0.0",
|
"version": "22.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz",
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/mongoose": "^5.11.97",
|
|
||||||
"@types/node": "^22.0.0",
|
"@types/node": "^22.0.0",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
|
@ -27,7 +27,7 @@ export class ApiModule {
|
|||||||
})
|
})
|
||||||
|
|
||||||
app.get('/search', async (req, res) => {
|
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 } })
|
const records = await MLog.find({ $text: { $search: req.query.q as string } })
|
||||||
.sort({ leftDate: -1 })
|
.sort({ leftDate: -1 })
|
||||||
.limit(30)
|
.limit(30)
|
||||||
@ -39,7 +39,7 @@ export class ApiModule {
|
|||||||
})
|
})
|
||||||
|
|
||||||
app.get('/details/:id', async (req, res) => {
|
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 record = await MLog.findOne({ id: req.params.id });
|
||||||
const player = await PlayerUtil.getPlayer(record?.userSteamId!);
|
const player = await PlayerUtil.getPlayer(record?.userSteamId!);
|
||||||
|
|
||||||
|
2
src/types/typings.d.ts
vendored
2
src/types/typings.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import { RedisClient, RedisClientType } from 'redis'
|
import { RedisClientType } from 'redis'
|
||||||
import { SimrailClient } from '../util/SimrailClient.ts'
|
import { SimrailClient } from '../util/SimrailClient.ts'
|
||||||
/* eslint no-var: off */
|
/* eslint no-var: off */
|
||||||
declare global
|
declare global
|
||||||
|
Loading…
x
Reference in New Issue
Block a user