fix ignoring static/data files, except .bin #21

Merged
OrdisPrime merged 11 commits from main into main 2023-06-14 07:25:36 -07:00
5 changed files with 32 additions and 5 deletions

2
.gitignore vendored
View File

@ -2,5 +2,5 @@
/build /build
/.env /.env
/static/data/* /static/data/*.bin
yarn.lock yarn.lock

View File

@ -5,6 +5,7 @@ import { Types } from "mongoose";
import { ISuitResponse } from "@/src/types/inventoryTypes/SuitTypes"; import { ISuitResponse } from "@/src/types/inventoryTypes/SuitTypes";
import { SlotType } from "@/src/types/purchaseTypes"; import { SlotType } from "@/src/types/purchaseTypes";
import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes"; import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
import { FlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
const createInventory = async (accountOwnerId: Types.ObjectId) => { const createInventory = async (accountOwnerId: Types.ObjectId) => {
try { try {
@ -97,12 +98,12 @@ export const addWeapon = async (
return changedInventory[weaponType][weaponIndex - 1].toJSON(); return changedInventory[weaponType][weaponIndex - 1].toJSON();
}; };
export const addCustomization = async (customizatonName: string, accountId: string) => { export const addCustomization = async (customizatonName: string, accountId: string): Promise<FlavourItem> => {
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizatonName }) - 1; const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizatonName }) - 1;
const changedInventory = await inventory.save(); const changedInventory = await inventory.save();
return changedInventory.FlavourItems[flavourItemIndex].toJSON(); return changedInventory.FlavourItems[flavourItemIndex].toJSON(); //mongoose bug forces as FlavourItem
}; };
export { createInventory, addPowerSuit }; export { createInventory, addPowerSuit };

View File

@ -1,7 +1,13 @@
import { getWeaponType } from "@/src/helpers/purchaseHelpers"; import { getWeaponType } from "@/src/helpers/purchaseHelpers";
import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers"; import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers";
import { addCustomization, addPowerSuit, addWeapon, updateSlots } from "@/src/services/inventoryService"; import {
import { IPurchaseRequest, SlotType } from "@/src/types/purchaseTypes"; addCustomization,
addPowerSuit,
addWeapon,
updateCurrency,
updateSlots
} from "@/src/services/inventoryService";
import { IPurchaseRequest, IPurchaseResponse, SlotType } from "@/src/types/purchaseTypes";
export const getStoreItemCategory = (storeItem: string) => { export const getStoreItemCategory = (storeItem: string) => {
const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/"); const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");

View File

@ -1,5 +1,6 @@
/* eslint-disable prettier/prettier */ /* eslint-disable prettier/prettier */
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
import { FlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes"; import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
export interface IPurchaseRequest { export interface IPurchaseRequest {
@ -28,6 +29,7 @@ export interface IPurchaseResponse {
Melee?: IWeaponResponse[]; Melee?: IWeaponResponse[];
PremiumCredits?: number; PremiumCredits?: number;
RegularCredits?: number; RegularCredits?: number;
FlavourItems?: FlavourItem[];
}; };
} }

18
static/data/items.ts Normal file
View File

@ -0,0 +1,18 @@
import Items, { Item, Weapon } from "warframe-items";
type MinWeapon = Omit<Weapon, "patchlogs">;
type MinItem = Omit<Item, "patchlogs">;
export const weapons: MinWeapon[] = (new Items({ category: ["Primary", "Secondary", "Melee"] }) as Weapon[]).map(
item => {
const next = { ...item };
delete next.patchlogs;
return next;
}
);
export const items: MinItem[] = new Items({ category: ["All"] }).map(item => {
const next = { ...item };
delete next.patchlogs;
return next;
});