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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

chore: move inbox types into their own file (#4182)

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

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

代码差异

5 个文件 +112 -108
Modified src/controllers/api/inboxController.ts +2 -1
@@ -1,5 +1,6 @@
1 1 import type { RequestHandler } from "express";
2 import { Inbox, type IMessageClient } from "../../models/inboxModel.ts";
2 import type { IMessageClient } from "../../types/inboxTypes.ts";
3 import { Inbox } from "../../models/inboxModel.ts";
3 4 import {
4 5 createMessage,
5 6 deleteAllMessagesRead,
Modified src/models/inboxModel.ts +1 -105
@@ -2,111 +2,7 @@ import type { Document, Types } from "mongoose";
2 2 import { model, Schema } from "mongoose";
3 3 import { toOid } from "../helpers/inventoryHelpers.ts";
4 4 import { typeCountSchema } from "./inventoryModels/inventoryModel.ts";
5 import type { IMongoDateWithLegacySupport, IOid, IOidWithLegacySupport, ITypeCount } from "../types/commonTypes.ts";
6
7 export interface IMessageClient extends Omit<
8 IMessageDatabase,
9 | "_id"
10 | "globaUpgradeId"
11 | "date"
12 | "startDate"
13 | "endDate"
14 | "ownerId"
15 | "attVisualOnly"
16 | "expiry"
17 | "minBuildVersion"
18 > {
19 _id?: IOid;
20 globaUpgradeId?: IOidWithLegacySupport; // [sic]
21 date: IMongoDateWithLegacySupport;
22 startDate?: IMongoDateWithLegacySupport;
23 endDate?: IMongoDateWithLegacySupport;
24 messageId: IOid;
25 }
26
27 export interface IMessageDatabase extends IMessage {
28 ownerId: Types.ObjectId; // SNS-specific
29 globaUpgradeId?: Types.ObjectId; // [sic]
30 date: Date; //created at
31 attVisualOnly?: boolean; // SNS-specific
32 minBuildVersion?: number; // SNS-specific
33 _id: Types.ObjectId;
34 }
35
36 export interface IMessage {
37 sndr: string;
38 msg: string;
39 cinematic?: string;
40 sub: string;
41 customData?: string;
42 icon?: string;
43 highPriority?: boolean;
44 lowPrioNewPlayers?: boolean;
45 transmission?: string;
46 att?: string[];
47 countedAtt?: ITypeCount[];
48 startDate?: Date;
49 endDate?: Date;
50 QuestReq?: string;
51 goalTag?: string;
52 CrossPlatform?: boolean;
53 arg?: Arg[];
54 gifts?: IGift[];
55 r?: boolean;
56 contextInfo?: string;
57 acceptAction?: string;
58 declineAction?: string;
59 hasAccountAction?: boolean;
60 RegularCredits?: number;
61 PremiumCredits?: number;
62 }
63
64 interface Arg {
65 Key: string;
66 Tag: string | number;
67 }
68
69 interface IGift {
70 GiftType: string;
71 }
72
73 //types are wrong
74 // export interface IMessageDatabase {
75 // _id: Types.ObjectId;
76 // messageId: string;
77 // sub: string;
78 // sndr: string;
79 // msg: string;
80 // startDate: Date;
81 // endDate: Date;
82 // date: Date;
83 // contextInfo: string;
84 // icon: string;
85 // att: string[];
86 // modPacks: string[];
87 // countedAtt: string[];
88 // attSpecial: string[];
89 // transmission: string;
90 // ordisReactionTransmission: string;
91 // arg: string[];
92 // r: string;
93 // acceptAction: string;
94 // declineAction: string;
95 // highPriority: boolean;
96 // lowPrioNewPlayers: boolean
97 // gifts: string[];
98 // teleportLoc: string;
99 // RegularCredits: string;
100 // PremiumCredits: string;
101 // PrimeTokens: string;
102 // Coupons: string[];
103 // syndicateAttachment: string[];
104 // tutorialTag: string;
105 // url: string;
106 // urlButtonText: string;
107 // cinematic: string;
108 // requiredLevel: string;
109 // }
5 import type { IGift, IMessageDatabase } from "../types/inboxTypes.ts";
110 6
111 7 const giftSchema = new Schema<IGift>(
112 8 {
Modified src/services/inboxService.ts +2 -1
@@ -1,5 +1,6 @@
1 1 import { toMongoDate2, toOid2 } from "../helpers/inventoryHelpers.ts";
2 import type { IMessageClient, IMessageDatabase, TMessageDocument } from "../models/inboxModel.ts";
2 import type { IMessageClient, IMessageDatabase } from "../types/inboxTypes.ts";
3 import type { TMessageDocument } from "../models/inboxModel.ts";
3 4 import { Inbox } from "../models/inboxModel.ts";
4 5 import type { QueryFilter, Types } from "mongoose";
5 6 import { buildVersionToInt } from "./loginService.ts";
Modified src/services/itemDataService.ts +1 -1
@@ -51,7 +51,7 @@ import {
51 51 ExportWarframes,
52 52 ExportWeapons
53 53 } from "warframe-public-export-plus";
54 import type { IMessage } from "../models/inboxModel.ts";
54 import type { IMessage } from "../types/inboxTypes.ts";
55 55 import { logger } from "../utils/logger.ts";
56 56 import { version_compare } from "../helpers/inventoryHelpers.ts";
57 57 import vorsPrizePreU40Rewards from "../../static/fixed_responses/vorsPrizePreU40Rewards.json" with { type: "json" };
Added src/types/inboxTypes.ts +106 -0
@@ -0,0 +1,106 @@
1 import type { Types } from "mongoose";
2 import type { IMongoDateWithLegacySupport, IOid, IOidWithLegacySupport, ITypeCount } from "./commonTypes.ts";
3
4 export interface IMessageClient extends Omit<
5 IMessageDatabase,
6 | "_id"
7 | "globaUpgradeId"
8 | "date"
9 | "startDate"
10 | "endDate"
11 | "ownerId"
12 | "attVisualOnly"
13 | "expiry"
14 | "minBuildVersion"
15 > {
16 _id?: IOid;
17 globaUpgradeId?: IOidWithLegacySupport; // [sic]
18 date: IMongoDateWithLegacySupport;
19 startDate?: IMongoDateWithLegacySupport;
20 endDate?: IMongoDateWithLegacySupport;
21 messageId: IOid;
22 }
23
24 export interface IMessageDatabase extends IMessage {
25 ownerId: Types.ObjectId; // SNS-specific
26 globaUpgradeId?: Types.ObjectId; // [sic]
27 date: Date; //created at
28 attVisualOnly?: boolean; // SNS-specific
29 minBuildVersion?: number; // SNS-specific
30 _id: Types.ObjectId;
31 }
32
33 export interface IMessage {
34 sndr: string;
35 msg: string;
36 cinematic?: string;
37 sub: string;
38 customData?: string;
39 icon?: string;
40 highPriority?: boolean;
41 lowPrioNewPlayers?: boolean;
42 transmission?: string;
43 att?: string[];
44 countedAtt?: ITypeCount[];
45 startDate?: Date;
46 endDate?: Date;
47 QuestReq?: string;
48 goalTag?: string;
49 CrossPlatform?: boolean;
50 arg?: Arg[];
51 gifts?: IGift[];
52 r?: boolean;
53 contextInfo?: string;
54 acceptAction?: string;
55 declineAction?: string;
56 hasAccountAction?: boolean;
57 RegularCredits?: number;
58 PremiumCredits?: number;
59 }
60
61 interface Arg {
62 Key: string;
63 Tag: string | number;
64 }
65
66 export interface IGift {
67 GiftType: string;
68 }
69
70 //types are wrong
71 // export interface IMessageDatabase {
72 // _id: Types.ObjectId;
73 // messageId: string;
74 // sub: string;
75 // sndr: string;
76 // msg: string;
77 // startDate: Date;
78 // endDate: Date;
79 // date: Date;
80 // contextInfo: string;
81 // icon: string;
82 // att: string[];
83 // modPacks: string[];
84 // countedAtt: string[];
85 // attSpecial: string[];
86 // transmission: string;
87 // ordisReactionTransmission: string;
88 // arg: string[];
89 // r: string;
90 // acceptAction: string;
91 // declineAction: string;
92 // highPriority: boolean;
93 // lowPrioNewPlayers: boolean
94 // gifts: string[];
95 // teleportLoc: string;
96 // RegularCredits: string;
97 // PremiumCredits: string;
98 // PrimeTokens: string;
99 // Coupons: string[];
100 // syndicateAttachment: string[];
101 // tutorialTag: string;
102 // url: string;
103 // urlButtonText: string;
104 // cinematic: string;
105 // requiredLevel: string;
106 // }