XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: respect BuildLabel in getGuildLog (#3488)

Closes #3479 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3488 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

f5efcf77
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +10 -10
Modified src/controllers/api/getGuildLogController.ts +10 -10
@@ -1,13 +1,13 @@
1 import { toMongoDate } from "../../helpers/inventoryHelpers.ts";
1 import { toMongoDate2 } from "../../helpers/inventoryHelpers.ts";
2 2 import { Guild } from "../../models/guildModel.ts";
3 3 import { getInventory } from "../../services/inventoryService.ts";
4 import { getAccountIdForRequest } from "../../services/loginService.ts";
5 import type { IMongoDate } from "../../types/commonTypes.ts";
4 import { getAccountForRequest } from "../../services/loginService.ts";
5 import type { IMongoDateWithLegacySupport } from "../../types/commonTypes.ts";
6 6 import type { RequestHandler } from "express";
7 7
8 8 export const getGuildLogController: RequestHandler = async (req, res) => {
9 const accountId = await getAccountIdForRequest(req);
10 const inventory = await getInventory(accountId, "GuildId");
9 const account = await getAccountForRequest(req);
10 const inventory = await getInventory(account._id.toString(), "GuildId");
11 11 if (inventory.GuildId) {
12 12 const guild = await Guild.findById(inventory.GuildId);
13 13 if (guild) {
@@ -20,28 +20,28 @@ export const getGuildLogController: RequestHandler = async (req, res) => {
20 20 };
21 21 guild.RoomChanges?.forEach(entry => {
22 22 log.RoomChanges.push({
23 dateTime: toMongoDate(entry.dateTime ?? new Date()),
23 dateTime: toMongoDate2(entry.dateTime ?? new Date(), account.BuildLabel),
24 24 entryType: entry.entryType,
25 25 details: entry.details
26 26 });
27 27 });
28 28 guild.TechChanges?.forEach(entry => {
29 29 log.TechChanges.push({
30 dateTime: toMongoDate(entry.dateTime ?? new Date()),
30 dateTime: toMongoDate2(entry.dateTime ?? new Date(), account.BuildLabel),
31 31 entryType: entry.entryType,
32 32 details: entry.details
33 33 });
34 34 });
35 35 guild.RosterActivity?.forEach(entry => {
36 36 log.RosterActivity.push({
37 dateTime: toMongoDate(entry.dateTime),
37 dateTime: toMongoDate2(entry.dateTime, account.BuildLabel),
38 38 entryType: entry.entryType,
39 39 details: entry.details
40 40 });
41 41 });
42 42 guild.ClassChanges?.forEach(entry => {
43 43 log.ClassChanges.push({
44 dateTime: toMongoDate(entry.dateTime),
44 dateTime: toMongoDate2(entry.dateTime, account.BuildLabel),
45 45 entryType: entry.entryType,
46 46 details: entry.details
47 47 });
@@ -54,7 +54,7 @@ export const getGuildLogController: RequestHandler = async (req, res) => {
54 54 };
55 55
56 56 interface IGuildLogEntryClient {
57 dateTime: IMongoDate;
57 dateTime: IMongoDateWithLegacySupport;
58 58 entryType: number;
59 59 details: number | string;
60 60 }