chore: use updateOne for simple inventory field setters
All checks were successful
Build / build (18) (push) Successful in 45s
Build / build (22) (push) Successful in 1m5s
Build / build (20) (push) Successful in 1m2s
Build / build (18) (pull_request) Successful in 47s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (22) (pull_request) Successful in 1m1s
All checks were successful
Build / build (18) (push) Successful in 45s
Build / build (22) (push) Successful in 1m5s
Build / build (20) (push) Successful in 1m2s
Build / build (18) (pull_request) Successful in 47s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (22) (pull_request) Successful in 1m1s
This commit is contained in:
parent
c3a9b42fa2
commit
d9eec90d3c
@ -1,16 +1,25 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
import { IUpdateGlyphRequest } from "@/src/types/requestTypes";
|
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
|
|
||||||
const addFriendImageController: RequestHandler = async (req, res) => {
|
export const addFriendImageController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const json = getJSONfromString<IUpdateGlyphRequest>(String(req.body));
|
const json = getJSONfromString<IUpdateGlyphRequest>(String(req.body));
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
inventory.ActiveAvatarImageType = json.AvatarImageType;
|
await Inventory.updateOne(
|
||||||
await inventory.save();
|
{
|
||||||
|
accountOwnerId: accountId
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ActiveAvatarImageType: json.AvatarImageType
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
res.json({});
|
res.json({});
|
||||||
};
|
};
|
||||||
|
|
||||||
export { addFriendImageController };
|
interface IUpdateGlyphRequest {
|
||||||
|
AvatarImageType: string;
|
||||||
|
AvatarImage: string;
|
||||||
|
}
|
||||||
|
@ -1,14 +1,21 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
|
||||||
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
|
|
||||||
export const setEquippedInstrumentController: RequestHandler = async (req, res) => {
|
export const setEquippedInstrumentController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
const body = getJSONfromString<ISetEquippedInstrumentRequest>(String(req.body));
|
const body = getJSONfromString<ISetEquippedInstrumentRequest>(String(req.body));
|
||||||
inventory.EquippedInstrument = body.Instrument;
|
|
||||||
await inventory.save();
|
await Inventory.updateOne(
|
||||||
|
{
|
||||||
|
accountOwnerId: accountId
|
||||||
|
},
|
||||||
|
{
|
||||||
|
EquippedInstrument: body.Instrument
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
res.end();
|
res.end();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
|
|
||||||
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
|
export const setSupportedSyndicateController: RequestHandler = async (req, res) => {
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
|
||||||
inventory.SupportedSyndicate = req.query.syndicate as string;
|
await Inventory.updateOne(
|
||||||
await inventory.save();
|
{
|
||||||
|
accountOwnerId: accountId
|
||||||
|
},
|
||||||
|
{
|
||||||
|
SupportedSyndicate: req.query.syndicate as string
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
res.end();
|
res.end();
|
||||||
};
|
};
|
||||||
|
@ -132,10 +132,6 @@ export interface IRewardInfo {
|
|||||||
|
|
||||||
export type IMissionStatus = "GS_SUCCESS" | "GS_FAILURE" | "GS_DUMPED" | "GS_QUIT" | "GS_INTERRUPTED";
|
export type IMissionStatus = "GS_SUCCESS" | "GS_FAILURE" | "GS_DUMPED" | "GS_QUIT" | "GS_INTERRUPTED";
|
||||||
|
|
||||||
export interface IUpdateGlyphRequest {
|
|
||||||
AvatarImageType: string;
|
|
||||||
AvatarImage: string;
|
|
||||||
}
|
|
||||||
export interface IUpgradesRequest {
|
export interface IUpgradesRequest {
|
||||||
ItemCategory: TEquipmentKey;
|
ItemCategory: TEquipmentKey;
|
||||||
ItemId: IOid;
|
ItemId: IOid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user