返回提交历史
Modified
src/controllers/api/inventoryController.ts
+4
-0
Modified
src/services/importService.ts
+14
-18
Modified
src/types/inventoryTypes/inventoryTypes.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
fix: convert pending recipe completion date for pre-U19.5 clients (#3804)
Closes #3803 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3804 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
c66d6588
代码差异
3 个文件
+19
-19
@@ -41,6 +41,7 @@ import {
41
41
convertIColorToLegacyColors,
42
42
convertIColorToLegacyColorsWithAtt,
43
43
convertToLegacyFingerprint,
44
fromMongoDate,
44
45
fromOid,
45
46
modernToU5Recipes,
46
47
toLegacyOid,
@@ -680,6 +681,9 @@ export const getInventoryResponse = async (
680
681
if (item.LastAdded) toLegacyOid(item.LastAdded);
681
682
}
682
683
// as well as a different date format
684
for (const pr of inventoryResponse.PendingRecipes) {
685
pr.CompletionDate = toMongoDate2(fromMongoDate(pr.CompletionDate), buildLabel);
686
}
683
687
inventoryResponse.NextRefill = toMongoDate2(inventory.NextRefill!, buildLabel);
684
688
685
689
if (version_compare(buildLabel, "2014.02.05.00.00") < 0) {
@@ -4,7 +4,7 @@ import type {
4
4
IOperatorConfigClient,
5
5
IOperatorConfigDatabase
6
6
} from "../types/inventoryTypes/commonInventoryTypes.ts";
7
import type { IMongoDate } from "../types/commonTypes.ts";
7
import type { IMongoDateWithLegacySupport } from "../types/commonTypes.ts";
8
8
import type {
9
9
IBooster,
10
10
IDialogueClient,
@@ -88,12 +88,8 @@ import { fromMongoDate, fromOid } from "../helpers/inventoryHelpers.ts";
88
88
import { getRecipe } from "./itemDataService.ts";
89
89
import { logger } from "../utils/logger.ts";
90
90
91
const convertDate = (value: IMongoDate): Date => {
92
return new Date(parseInt(value.$date.$numberLong));
93
};
94
95
const convertOptionalDate = (value: IMongoDate | undefined): Date | undefined => {
96
return value ? convertDate(value) : undefined;
91
const convertOptionalDate = (value: IMongoDateWithLegacySupport | undefined): Date | undefined => {
92
return value ? fromMongoDate(value) : undefined;
97
93
};
98
94
99
95
const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => {
@@ -218,10 +214,10 @@ const convertInfestedFoundry = (client: IInfestedFoundryClient): IInfestedFoundr
218
214
const convertDialogue = (client: IDialogueClient): IDialogueDatabase => {
219
215
return {
220
216
...client,
221
AvailableDate: convertDate(client.AvailableDate),
222
AvailableGiftDate: convertDate(client.AvailableGiftDate),
223
RankUpExpiry: convertDate(client.RankUpExpiry),
224
BountyChemExpiry: convertDate(client.BountyChemExpiry)
217
AvailableDate: fromMongoDate(client.AvailableDate),
218
AvailableGiftDate: fromMongoDate(client.AvailableGiftDate),
219
RankUpExpiry: fromMongoDate(client.RankUpExpiry),
220
BountyChemExpiry: fromMongoDate(client.BountyChemExpiry)
225
221
};
226
222
};
227
223
@@ -235,7 +231,7 @@ const convertDialogueHistory = (client: IDialogueHistoryClient): IDialogueHistor
235
231
const convertKubrowDetails = (client: IKubrowPetDetailsClient): IKubrowPetDetailsDatabase => {
236
232
return {
237
233
...client,
238
HatchDate: convertDate(client.HatchDate)
234
HatchDate: fromMongoDate(client.HatchDate)
239
235
};
240
236
};
241
237
@@ -256,14 +252,14 @@ const convertRecentVendorPurchases = (client: IRecentVendorPurchaseClient): IRec
256
252
const convertPurchaseHistory = (client: IVendorPurchaseHistoryEntryClient): IVendorPurchaseHistoryEntryDatabase => {
257
253
return {
258
254
...client,
259
Expiry: convertDate(client.Expiry)
255
Expiry: fromMongoDate(client.Expiry)
260
256
};
261
257
};
262
258
263
259
const convertPendingRecipe = (client: IPendingRecipeClient): IPendingRecipeDatabase => {
264
260
return {
265
261
...client,
266
CompletionDate: convertDate(client.CompletionDate),
262
CompletionDate: fromMongoDate(client.CompletionDate),
267
263
KubrowPet: client.TargetItemId ? new Types.ObjectId(client.TargetItemId) : undefined
268
264
};
269
265
};
@@ -272,7 +268,7 @@ const convertNemesisBase = (client: INemesisBaseClient): INemesisBaseDatabase =>
272
268
return {
273
269
...client,
274
270
fp: BigInt(client.fp),
275
d: convertDate(client.d)
271
d: fromMongoDate(client.d)
276
272
};
277
273
};
278
274
@@ -280,7 +276,7 @@ const convertNemesis = (client: INemesisClient): INemesisDatabase => {
280
276
return {
281
277
...client,
282
278
fp: BigInt(client.fp),
283
d: convertDate(client.d)
279
d: fromMongoDate(client.d)
284
280
};
285
281
};
286
282
@@ -303,7 +299,7 @@ const convertPeriodicMissionCompletion = (
303
299
): IPeriodicMissionCompletionDatabase => {
304
300
return {
305
301
...client,
306
date: convertDate(client.date)
302
date: fromMongoDate(client.date)
307
303
};
308
304
};
309
305
@@ -659,7 +655,7 @@ const convertShip = (client: IOrbiterClient): IOrbiterDatabase => {
659
655
const convertPlant = (client: IPlantClient): IPlantDatabase => {
660
656
return {
661
657
...client,
662
EndTime: convertDate(client.EndTime)
658
EndTime: fromMongoDate(client.EndTime)
663
659
};
664
660
};
665
661
@@ -961,7 +961,7 @@ export interface IPendingRecipeClient extends Omit<
961
961
"CompletionDate" | "LongGuns" | "Pistols" | "Melee" | "SuitToUnbrand" | "KubrowPet"
962
962
> {
963
963
ItemId: IOid;
964
CompletionDate: IMongoDate;
964
CompletionDate: IMongoDateWithLegacySupport;
965
965
TargetItemId?: string;
966
966
}
967
967