chore: faithful response to getGuild & getGuildLog when not in a clan
All checks were successful
Build / build (18) (push) Successful in 44s
Build / build (22) (push) Successful in 1m2s
Build / build (20) (push) Successful in 51s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 59s
Build / build (22) (pull_request) Successful in 53s
All checks were successful
Build / build (18) (push) Successful in 44s
Build / build (22) (push) Successful in 1m2s
Build / build (20) (push) Successful in 51s
Build / build (18) (pull_request) Successful in 45s
Build / build (20) (pull_request) Successful in 59s
Build / build (22) (pull_request) Successful in 53s
This commit is contained in:
parent
be6e5ce250
commit
023e95a3c9
@ -28,7 +28,7 @@ const getGuildController: RequestHandler = async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.json({});
|
res.sendStatus(200);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { getGuildController };
|
export { getGuildController };
|
||||||
|
@ -6,18 +6,18 @@ import { IMongoDate } from "@/src/types/commonTypes";
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
export const getGuildLogController: RequestHandler = async (req, res) => {
|
export const getGuildLogController: RequestHandler = async (req, res) => {
|
||||||
const log: Record<string, IGuildLogEntryClient[]> = {
|
|
||||||
RoomChanges: [],
|
|
||||||
TechChanges: [],
|
|
||||||
RosterActivity: [],
|
|
||||||
StandingsUpdates: [],
|
|
||||||
ClassChanges: []
|
|
||||||
};
|
|
||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
if (inventory.GuildId) {
|
if (inventory.GuildId) {
|
||||||
const guild = await Guild.findOne({ _id: inventory.GuildId });
|
const guild = await Guild.findOne({ _id: inventory.GuildId });
|
||||||
if (guild) {
|
if (guild) {
|
||||||
|
const log: Record<string, IGuildLogEntryClient[]> = {
|
||||||
|
RoomChanges: [],
|
||||||
|
TechChanges: [],
|
||||||
|
RosterActivity: [],
|
||||||
|
StandingsUpdates: [],
|
||||||
|
ClassChanges: []
|
||||||
|
};
|
||||||
guild.ClassChanges?.forEach(entry => {
|
guild.ClassChanges?.forEach(entry => {
|
||||||
log.ClassChanges.push({
|
log.ClassChanges.push({
|
||||||
dateTime: toMongoDate(entry.dateTime),
|
dateTime: toMongoDate(entry.dateTime),
|
||||||
@ -25,9 +25,11 @@ export const getGuildLogController: RequestHandler = async (req, res) => {
|
|||||||
details: entry.details
|
details: entry.details
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
res.json(log);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.json(log);
|
res.sendStatus(200);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IGuildLogEntryClient {
|
interface IGuildLogEntryClient {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user