cleanup2
This commit is contained in:
parent
647fd85bab
commit
7ac305036c
18
src/app.ts
18
src/app.ts
@ -14,7 +14,6 @@ import { customRouter } from "@/src/routes/custom";
|
|||||||
import { dynamicController } from "@/src/routes/dynamic";
|
import { dynamicController } from "@/src/routes/dynamic";
|
||||||
import { statsRouter } from "@/src/routes/stats";
|
import { statsRouter } from "@/src/routes/stats";
|
||||||
import { connectDatabase } from "@/src/services/mongoService";
|
import { connectDatabase } from "@/src/services/mongoService";
|
||||||
import { LoadoutModel as Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
|
||||||
|
|
||||||
void connectDatabase();
|
void connectDatabase();
|
||||||
|
|
||||||
@ -35,23 +34,6 @@ app.use("/:id/dynamic", dynamicController);
|
|||||||
app.post("/pay/steamPacks.php", steamPacksController);
|
app.post("/pay/steamPacks.php", steamPacksController);
|
||||||
app.use("/stats", statsRouter);
|
app.use("/stats", statsRouter);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
||||||
app.post("/test", async (req, _res) => {
|
|
||||||
console.log("test hit", req.body);
|
|
||||||
const newLoadout = new Loadout({});
|
|
||||||
newLoadout.NORMAL.push({
|
|
||||||
_id: "000000000000000000000000",
|
|
||||||
Favorite: false,
|
|
||||||
PresetIcon: "",
|
|
||||||
s: { ItemId: { $oid: "000000000000000000000000" }, mod: 0, cus: 0 },
|
|
||||||
p: { ItemId: { $oid: "000000000000000000000000" }, mod: 0, cus: 0 },
|
|
||||||
l: { ItemId: { $oid: "000000000000000000000000" }, mod: 0, cus: 0 },
|
|
||||||
m: { ItemId: { $oid: "000000000000000000000000" }, mod: 0, cus: 0 }
|
|
||||||
});
|
|
||||||
await newLoadout.save();
|
|
||||||
_res.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
app.use(unknownEndpointHandler);
|
app.use(unknownEndpointHandler);
|
||||||
|
|
||||||
//app.use(errorHandler)
|
//app.use(errorHandler)
|
||||||
|
@ -16,9 +16,11 @@ const saveLoadoutController: RequestHandler = async (req, res) => {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const { UpgradeVer, ...equipmentChanges } = body;
|
const { UpgradeVer, ...equipmentChanges } = body;
|
||||||
await handleInventoryItemConfigChange(equipmentChanges, accountId);
|
await handleInventoryItemConfigChange(equipmentChanges, accountId);
|
||||||
} catch (error) {
|
} catch (error: unknown) {
|
||||||
|
if (error instanceof Error) {
|
||||||
res.status(400).json({ error: error.message });
|
res.status(400).json({ error: error.message });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export { saveLoadoutController };
|
export { saveLoadoutController };
|
||||||
|
@ -2,7 +2,7 @@ import { IOid } from "@/src/types/commonTypes";
|
|||||||
import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
|
|
||||||
// a schema's toJSON is responsible for changing Oid and Date to their corresponding Response versions __id to "ItemId":{"$oid":"6450f720bc562ebf030222d4"}, and a Date to "date":{"$date":{"$numberLong":"unix timestamp"})
|
//TODO: this needs to be addressed: a schema's toJSON is responsible for changing Oid and Date to their corresponding Response versions __id to "ItemId":{"$oid":"6450f720bc562ebf030222d4"}, and a Date to "date":{"$date":{"$numberLong":"unix timestamp"})
|
||||||
export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => {
|
export const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const { accountOwnerId, ...inventoryResponse } = inventoryDatabase;
|
const { accountOwnerId, ...inventoryResponse } = inventoryDatabase;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user