fix return types
This commit is contained in:
parent
4ea70c18ee
commit
4232fad4ac
@ -63,8 +63,12 @@ function getSession(sessionIdOrRequest: string | FindSessionRequest): {
|
|||||||
|
|
||||||
const request = sessionIdOrRequest;
|
const request = sessionIdOrRequest;
|
||||||
const matchingSessions = sessions.filter(session => {
|
const matchingSessions = sessions.filter(session => {
|
||||||
for (const key in request) {
|
for (const key of Object.keys(request)) {
|
||||||
if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) {
|
if (
|
||||||
|
key !== "eloRating" &&
|
||||||
|
key !== "queryId" &&
|
||||||
|
request[key as keyof FindSessionRequest] !== session[key as keyof Session]
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Schema, model } from "mongoose";
|
import { Schema, model } from "mongoose";
|
||||||
import { IInventoryDatabase, ISuitDatabase } from "../types/inventoryTypes";
|
import { IInventoryDatabase, ISuitDatabase } from "../types/inventoryTypes";
|
||||||
import { Oid } from "../types/commonTypes";
|
|
||||||
|
|
||||||
const polaritySchema = new Schema({
|
const polaritySchema = new Schema({
|
||||||
Slot: Number,
|
Slot: Number,
|
||||||
@ -66,9 +65,10 @@ const suitSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
suitSchema.set("toJSON", {
|
suitSchema.set("toJSON", {
|
||||||
transform(_document, returnedObject) {
|
transform(_document, returnedObject: ISuitDatabase) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
if (returnedObject._id) {
|
||||||
returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies Oid;
|
returnedObject.ItemId = { $oid: returnedObject._id.toString() };
|
||||||
|
}
|
||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
delete returnedObject.__v;
|
delete returnedObject.__v;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
import { IShipDatabase, IShipResponse } from "@/src/types/shipTypes";
|
||||||
import { Schema, model } from "mongoose";
|
import { Schema, model } from "mongoose";
|
||||||
import { IShipDatabase } from "../types/shipTypes";
|
|
||||||
import { Oid } from "../types/commonTypes";
|
|
||||||
|
|
||||||
const roomSchema = new Schema({
|
const roomSchema = new Schema({
|
||||||
Name: String,
|
Name: String,
|
||||||
@ -31,9 +30,10 @@ const shipDatabaseSchema = new Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
shipDatabaseSchema.set("toJSON", {
|
shipDatabaseSchema.set("toJSON", {
|
||||||
transform(_document, returnedObject) {
|
transform(_document, returnedObject: IShipResponse) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
if (returnedObject._id) {
|
||||||
returnedObject.Ship.ShipId = { $oid: returnedObject._id.toString() } satisfies Oid;
|
returnedObject.Ship.ShipId = { $oid: returnedObject._id.toString() };
|
||||||
|
}
|
||||||
delete returnedObject._id;
|
delete returnedObject._id;
|
||||||
delete returnedObject.Ship._id;
|
delete returnedObject.Ship._id;
|
||||||
delete returnedObject.Apartment._id;
|
delete returnedObject.Apartment._id;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
import { Document, Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Oid } from "./commonTypes";
|
import { Oid } from "./commonTypes";
|
||||||
|
|
||||||
export interface IInventoryDatabase extends IInventoryResponse {
|
export interface IInventoryDatabase extends IInventoryResponse {
|
||||||
@ -1159,12 +1159,6 @@ export interface NotePacks {
|
|||||||
PERCUSSION: string;
|
PERCUSSION: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISuitDocument extends ISuitDatabase, Document {}
|
|
||||||
|
|
||||||
export interface ISuitResponse extends ISuitDatabase {
|
|
||||||
ItemId: Oid;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ISuitDatabase {
|
export interface ISuitDatabase {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
Configs: SuitConfig[];
|
Configs: SuitConfig[];
|
||||||
@ -1178,6 +1172,8 @@ export interface ISuitDatabase {
|
|||||||
ItemId: Oid;
|
ItemId: Oid;
|
||||||
FocusLens?: string;
|
FocusLens?: string;
|
||||||
UnlockLevel?: number;
|
UnlockLevel?: number;
|
||||||
|
_id?: Oid;
|
||||||
|
__v?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SuitConfig {
|
export interface SuitConfig {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
import { Oid } from "@/src/types/commonTypes";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { Oid } from "./inventoryTypes";
|
|
||||||
|
|
||||||
export type IShipDatabase = IShipResponse;
|
export type IShipDatabase = IShipResponse;
|
||||||
|
|
||||||
@ -9,6 +8,8 @@ export interface IShipResponse {
|
|||||||
ShipOwnerId: Types.ObjectId;
|
ShipOwnerId: Types.ObjectId;
|
||||||
Ship: IShipClass;
|
Ship: IShipClass;
|
||||||
Apartment: IApartmentClass;
|
Apartment: IApartmentClass;
|
||||||
|
_id?: Types.ObjectId;
|
||||||
|
__v?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IShipClass {
|
export interface IShipClass {
|
||||||
@ -16,6 +17,7 @@ export interface IShipClass {
|
|||||||
ShipId: Oid;
|
ShipId: Oid;
|
||||||
Features: string[];
|
Features: string[];
|
||||||
ContentUrlSignature: string;
|
ContentUrlSignature: string;
|
||||||
|
_id?: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRoomsClass {
|
export interface IRoomsClass {
|
||||||
@ -26,4 +28,5 @@ export interface IRoomsClass {
|
|||||||
export interface IApartmentClass {
|
export interface IApartmentClass {
|
||||||
Rooms: IRoomsClass[];
|
Rooms: IRoomsClass[];
|
||||||
FavouriteLoadouts: string[];
|
FavouriteLoadouts: string[];
|
||||||
|
_id?: Types.ObjectId;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user