reuse inventory to get account's guild
All checks were successful
Build / build (22) (push) Successful in 39s
Build / build (20) (push) Successful in 1m3s
Build / build (18) (push) Successful in 57s
Build / build (18) (pull_request) Successful in 42s
Build / build (20) (pull_request) Successful in 1m4s
Build / build (22) (pull_request) Successful in 54s

This commit is contained in:
Sainan 2025-03-14 12:53:37 +01:00
parent cb626fcf68
commit f6ecc5cbfb
7 changed files with 19 additions and 19 deletions

View File

@ -13,7 +13,7 @@ import { RequestHandler } from "express";
export const abortDojoComponentController: RequestHandler = async (req, res) => { export const abortDojoComponentController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequestEx(req, inventory); const guild = await getGuildForRequestEx(req, inventory);
const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest; const request = JSON.parse(String(req.body)) as IAbortDojoComponentRequest;

View File

@ -1,4 +1,4 @@
import { getDojoClient, getGuildForRequest, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService"; import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService";
import { getInventory } from "@/src/services/inventoryService"; import { getInventory } from "@/src/services/inventoryService";
import { getAccountIdForRequest } from "@/src/services/loginService"; import { getAccountIdForRequest } from "@/src/services/loginService";
import { GuildPermission } from "@/src/types/guildTypes"; import { GuildPermission } from "@/src/types/guildTypes";
@ -6,8 +6,8 @@ import { RequestHandler } from "express";
export const abortDojoComponentDestructionController: RequestHandler = async (req, res) => { export const abortDojoComponentDestructionController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequest(req); const guild = await getGuildForRequestEx(req, inventory);
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) { if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
res.json({ DojoRequestStatus: -1 }); res.json({ DojoRequestStatus: -1 });
return; return;

View File

@ -1,5 +1,5 @@
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { getDojoClient, getGuildForRequest, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService"; import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { GuildPermission, IDojoComponentDatabase } from "@/src/types/guildTypes"; import { GuildPermission, IDojoComponentDatabase } from "@/src/types/guildTypes";
import { Types } from "mongoose"; import { Types } from "mongoose";
@ -8,8 +8,8 @@ import { getInventory } from "@/src/services/inventoryService";
export const changeDojoRootController: RequestHandler = async (req, res) => { export const changeDojoRootController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequest(req); const guild = await getGuildForRequestEx(req, inventory);
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) { if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
res.json({ DojoRequestStatus: -1 }); res.json({ DojoRequestStatus: -1 });
return; return;

View File

@ -1,6 +1,6 @@
import { import {
getDojoClient, getDojoClient,
getGuildForRequest, getGuildForRequestEx,
hasAccessToDojo, hasAccessToDojo,
hasGuildPermission, hasGuildPermission,
removeDojoDeco removeDojoDeco
@ -12,8 +12,8 @@ import { RequestHandler } from "express";
export const destroyDojoDecoController: RequestHandler = async (req, res) => { export const destroyDojoDecoController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequest(req); const guild = await getGuildForRequestEx(req, inventory);
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Decorator))) { if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Decorator))) {
res.json({ DojoRequestStatus: -1 }); res.json({ DojoRequestStatus: -1 });
return; return;

View File

@ -1,4 +1,4 @@
import { getDojoClient, getGuildForRequest, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService"; import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService";
import { getInventory } from "@/src/services/inventoryService"; import { getInventory } from "@/src/services/inventoryService";
import { getAccountIdForRequest } from "@/src/services/loginService"; import { getAccountIdForRequest } from "@/src/services/loginService";
import { GuildPermission } from "@/src/types/guildTypes"; import { GuildPermission } from "@/src/types/guildTypes";
@ -8,8 +8,8 @@ import { ExportDojoRecipes } from "warframe-public-export-plus";
export const placeDecoInComponentController: RequestHandler = async (req, res) => { export const placeDecoInComponentController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequest(req); const guild = await getGuildForRequestEx(req, inventory);
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Decorator))) { if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Decorator))) {
res.json({ DojoRequestStatus: -1 }); res.json({ DojoRequestStatus: -1 });
return; return;

View File

@ -1,5 +1,5 @@
import { config } from "@/src/services/configService"; import { config } from "@/src/services/configService";
import { getDojoClient, getGuildForRequest, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService"; import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService";
import { getInventory } from "@/src/services/inventoryService"; import { getInventory } from "@/src/services/inventoryService";
import { getAccountIdForRequest } from "@/src/services/loginService"; import { getAccountIdForRequest } from "@/src/services/loginService";
import { GuildPermission } from "@/src/types/guildTypes"; import { GuildPermission } from "@/src/types/guildTypes";
@ -7,8 +7,8 @@ import { RequestHandler } from "express";
export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => { export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequest(req); const guild = await getGuildForRequestEx(req, inventory);
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) { if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
res.json({ DojoRequestStatus: -1 }); res.json({ DojoRequestStatus: -1 });
return; return;

View File

@ -2,7 +2,7 @@ import { RequestHandler } from "express";
import { GuildPermission, IDojoComponentClient } from "@/src/types/guildTypes"; import { GuildPermission, IDojoComponentClient } from "@/src/types/guildTypes";
import { import {
getDojoClient, getDojoClient,
getGuildForRequest, getGuildForRequestEx,
hasAccessToDojo, hasAccessToDojo,
hasGuildPermission, hasGuildPermission,
processDojoBuildMaterialsGathered, processDojoBuildMaterialsGathered,
@ -21,8 +21,8 @@ interface IStartDojoRecipeRequest {
export const startDojoRecipeController: RequestHandler = async (req, res) => { export const startDojoRecipeController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId, "LevelKeys"); const inventory = await getInventory(accountId, "GuildId LevelKeys");
const guild = await getGuildForRequest(req); const guild = await getGuildForRequestEx(req, inventory);
if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) { if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
res.json({ DojoRequestStatus: -1 }); res.json({ DojoRequestStatus: -1 });
return; return;