返回提交历史
Modified
src/controllers/api/getGuildController.ts
+1
-1
Modified
src/controllers/api/getGuildLogController.ts
+10
-8
XFEstudio/SpaceNinjaServer
chore: faithful response to getGuild & getGuildLog when not in a clan (#1159)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1159
02ce0f57
代码差异
2 个文件
+11
-9
@@ -28,7 +28,7 @@ const getGuildController: RequestHandler = async (req, res) => {
28
28
return;
29
29
}
30
30
}
31
res.json({});
31
res.sendStatus(200);
32
32
};
33
33
34
34
export { getGuildController };
@@ -6,18 +6,18 @@ import { IMongoDate } from "@/src/types/commonTypes";
6
6
import { RequestHandler } from "express";
7
7
8
8
export const getGuildLogController: RequestHandler = async (req, res) => {
9
const log: Record<string, IGuildLogEntryClient[]> = {
10
RoomChanges: [],
11
TechChanges: [],
12
RosterActivity: [],
13
StandingsUpdates: [],
14
ClassChanges: []
15
};
16
9
const accountId = await getAccountIdForRequest(req);
17
10
const inventory = await getInventory(accountId);
18
11
if (inventory.GuildId) {
19
12
const guild = await Guild.findOne({ _id: inventory.GuildId });
20
13
if (guild) {
14
const log: Record<string, IGuildLogEntryClient[]> = {
15
RoomChanges: [],
16
TechChanges: [],
17
RosterActivity: [],
18
StandingsUpdates: [],
19
ClassChanges: []
20
};
21
21
guild.ClassChanges?.forEach(entry => {
22
22
log.ClassChanges.push({
23
23
dateTime: toMongoDate(entry.dateTime),
@@ -25,9 +25,11 @@ export const getGuildLogController: RequestHandler = async (req, res) => {
25
25
details: entry.details
26
26
});
27
27
});
28
res.json(log);
29
return;
28
30
}
29
31
}
30
res.json(log);
32
res.sendStatus(200);
31
33
};
32
34
33
35
interface IGuildLogEntryClient {