MissionInventoryUpdate(not completed), Mod upgrade, Booster purchase #49

Merged
holmityd merged 40 commits from interface-names into main 2023-09-06 03:02:54 -07:00
6 changed files with 11 additions and 7 deletions
Showing only changes of commit 2d4b139e0e - Show all commits

View File

@ -52,6 +52,7 @@ import { modNames, relicNames, miscNames, resourceNames, gearNames, blueprintNam
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const missionInventoryUpdateController: RequestHandler = async (req, res) => { const missionInventoryUpdateController: RequestHandler = async (req, res) => {
const [data] = String(req.body).split("\n");
OrdisPrime commented 2023-09-05 05:35:07 -07:00 (Migrated from github.com)
Review

what is the purpose of this?

what is the purpose of this?
OrdisPrime commented 2023-09-05 05:43:03 -07:00 (Migrated from github.com)
Review

can you explain what the difference is between missioncredits and MissionCredits?

can you explain what the difference is between missioncredits and MissionCredits?
OrdisPrime commented 2023-09-05 05:46:03 -07:00 (Migrated from github.com)
Review

can you please use brackets like:
if (something){
expression;
}

can you please use brackets like: if (something){ expression; }
OrdisPrime commented 2023-09-05 05:46:25 -07:00 (Migrated from github.com)
Review

it makes it easier to read

it makes it easier to read
OrdisPrime commented 2023-09-05 05:47:38 -07:00 (Migrated from github.com)
Review

where possible: instead of "i" or "j" use descriptive names such as rawUpgrade or so

where possible: instead of "i" or "j" use descriptive names such as rawUpgrade or so
OrdisPrime commented 2023-09-05 05:49:43 -07:00 (Migrated from github.com)
Review

perhaps make a function for this logic.
A controller should only "control" the calling of functions, with as little logic as possible.
You could make a service/missionInventoryUpdateService and put all the logic there, while you call those functions from the controller. Some logic in the controller is totally fine.

perhaps make a function for this logic. A controller should only "control" the calling of functions, with as little logic as possible. You could make a service/missionInventoryUpdateService and put all the logic there, while you call those functions from the controller. Some logic in the controller is totally fine.
OrdisPrime commented 2023-09-05 05:50:28 -07:00 (Migrated from github.com)
Review

move types and interfaces into types/missionInventoryTypes

move types and interfaces into types/missionInventoryTypes
const id = req.query.accountId as string; const id = req.query.accountId as string;
try { try {

View File

@ -7,7 +7,7 @@ import {
IBooster IBooster
} from "../types/inventoryTypes/inventoryTypes"; } from "../types/inventoryTypes/inventoryTypes";
import { IOid } from "../types/commonTypes"; import { IOid } from "../types/commonTypes";
import { ISuitDatabase, ISuitDocument } from "@/src/types/inventoryTypes/SuitTypes"; import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes"; import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
const abilityOverrideSchema = new Schema({ const abilityOverrideSchema = new Schema({
@ -85,7 +85,7 @@ const RawUpgrades = new Schema({
RawUpgrades.set("toJSON", { RawUpgrades.set("toJSON", {
transform(_document, returnedObject) { transform(_document, returnedObject) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
returnedObject.LastAdded = { $oid: returnedObject._id.toString() } satisfies Oid; returnedObject.LastAdded = { $oid: returnedObject._id.toString() } satisfies IOid;
delete returnedObject._id; delete returnedObject._id;
delete returnedObject.__v; delete returnedObject.__v;
} }
@ -99,7 +99,7 @@ const Upgrade = new Schema({
Upgrade.set("toJSON", { Upgrade.set("toJSON", {
transform(_document, returnedObject) { transform(_document, returnedObject) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies Oid; returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies IOid;
delete returnedObject._id; delete returnedObject._id;
delete returnedObject.__v; delete returnedObject.__v;
} }

View File

@ -15,6 +15,7 @@ import {
IRawUpgrade IRawUpgrade
} from "@/src/types/inventoryTypes/inventoryTypes"; } from "@/src/types/inventoryTypes/inventoryTypes";
import { IMissionInventoryUpdate, IMissionInventoryUpdateGear } from "../types/missionInventoryUpdateType"; import { IMissionInventoryUpdate, IMissionInventoryUpdateGear } from "../types/missionInventoryUpdateType";
import { IGenericUpdate } from "../types/genericUpdate";
const createInventory = async (accountOwnerId: Types.ObjectId) => { const createInventory = async (accountOwnerId: Types.ObjectId) => {
try { try {

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Document, Types } from "mongoose"; import { Document, Types } from "mongoose";
import { IOid } from "../commonTypes"; import { IOid } from "../commonTypes";
import { IAbilityOverride, IColor, FocusSchool, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { IAbilityOverride, IColor, FocusSchool, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
@ -33,7 +34,7 @@ export interface IInventoryResponse {
DailyFocus: number; DailyFocus: number;
GiftsRemaining: number; GiftsRemaining: number;
HandlerPoints: number; HandlerPoints: number;
MiscItems: IConsumable[]; MiscItems: IMiscItem[];
ChallengesFixVersion: number; ChallengesFixVersion: number;
ChallengeProgress: IChallengeProgress[]; ChallengeProgress: IChallengeProgress[];
RawUpgrades: IRawUpgrade[]; RawUpgrades: IRawUpgrade[];
@ -319,7 +320,7 @@ export interface ICrewShipSalvageBinClass {
export interface ICrewShipSalvagedWeaponSkin { export interface ICrewShipSalvagedWeaponSkin {
ItemType: string; ItemType: string;
UpgradeFingerprint?: string; UpgradeFingerprint?: string;
ItemId?: Oid; ItemId?: IOid;
_id?: Types.ObjectId; _id?: Types.ObjectId;
} }
@ -931,7 +932,7 @@ export interface IProgress {
export interface IRawUpgrade { export interface IRawUpgrade {
ItemType: string; ItemType: string;
ItemCount: number; ItemCount: number;
LastAdded?: Oid; LastAdded?: IOid;
} }
export interface IScoop { export interface IScoop {

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export interface ISession { export interface ISession {
sessionId: string; sessionId: string;
creatorId: string; creatorId: string;