Added nexUser to express.Request type

This commit is contained in:
Jonathan Barrow
2023-03-04 15:51:28 -05:00
parent ffc4e783a8
commit 498d3838a3
2 changed files with 3 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import crypto from 'node:crypto';
import { HydratedDocument } from 'mongoose';
import { Device } from '@models/device';
import { NEXAccount } from '@models/nex-account';
import util from '@util';
@@ -161,7 +162,7 @@ export async function NASCMiddleware(request, response, next) {
}
}
const nexUser = await NEXAccount.findOne({ pid });
const nexUser = await NEXAccount.findOne({ pid }) as HydratedDocument<INEXAccount, INEXAccountMethods>;
if (!nexUser || nexUser.get('access_level') < 0) {
return response.status(200).send(util.nascError('102'));

1
types/express.d.ts vendored
View File

@@ -5,6 +5,7 @@ declare global {
namespace Express {
interface Request {
pnid?: HydratedDocument<IPNID, IPNIDMethods>;
nexUser?: HydratedDocument<INEXAccount, INEXAccountMethods>;
isCemu?: boolean;
files?: Record<string, any>;
certificate?: NintendoCertificate;