chore: simplify updateGeneric

This commit is contained in:
Sainan 2024-10-17 22:24:24 +02:00
parent c6c3e1c005
commit 0398691e01
2 changed files with 3 additions and 4 deletions

View File

@ -11,7 +11,8 @@ import { IGenericUpdate } from "@/src/types/genericUpdate";
const genericUpdateController: RequestHandler = async (request, response) => { const genericUpdateController: RequestHandler = async (request, response) => {
const accountId = await getAccountIdForRequest(request); const accountId = await getAccountIdForRequest(request);
const update = getJSONfromString(String(request.body)) as IGenericUpdate; const update = getJSONfromString(String(request.body)) as IGenericUpdate;
response.json(await updateGeneric(update, accountId)); await updateGeneric(update, accountId);
response.json(update);
}; };
export { genericUpdateController }; export { genericUpdateController };

View File

@ -460,7 +460,7 @@ export const updateCurrency = async (price: number, usePremium: boolean, account
}; };
// TODO: AffiliationMods support (Nightwave). // TODO: AffiliationMods support (Nightwave).
export const updateGeneric = async (data: IGenericUpdate, accountId: string) => { export const updateGeneric = async (data: IGenericUpdate, accountId: string): Promise<void> => {
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
// Make it an array for easier parsing. // Make it an array for easier parsing.
@ -476,8 +476,6 @@ export const updateGeneric = async (data: IGenericUpdate, accountId: string) =>
inventory.NodeIntrosCompleted = nodes; inventory.NodeIntrosCompleted = nodes;
await inventory.save(); await inventory.save();
return data;
}; };
export const updateTheme = async (data: IThemeUpdateRequest, accountId: string) => { export const updateTheme = async (data: IThemeUpdateRequest, accountId: string) => {