返回提交历史
Added
src/controllers/api/addFriendTitleController.ts
+24
-0
Modified
src/controllers/dynamic/getProfileViewingDataController.ts
+2
-0
Modified
src/models/inventoryModels/inventoryModel.ts
+3
-1
Modified
src/routes/api.ts
+2
-0
Modified
src/services/friendService.ts
+1
-0
Modified
src/services/importService.ts
+2
-1
Modified
src/types/friendTypes.ts
+1
-0
Modified
src/types/inventoryTypes/inventoryTypes.ts
+1
-0
XFEstudio/SpaceNinjaServer
feat: addFriendTitle / honoria (#3125)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3125 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
046692df
代码差异
8 个文件
+36
-2
@@ -0,0 +1,24 @@
1
import type { RequestHandler } from "express";
2
import { getAccountIdForRequest } from "../../services/loginService.ts";
3
import { getJSONfromString } from "../../helpers/stringHelpers.ts";
4
import { Inventory } from "../../models/inventoryModels/inventoryModel.ts";
5
6
export const addFriendTitleController: RequestHandler = async (req, res) => {
7
const accountId = await getAccountIdForRequest(req);
8
const json = getJSONfromString<IUpdateTitleRequest>(String(req.body));
9
10
await Inventory.updateOne(
11
{
12
accountOwnerId: accountId
13
},
14
{
15
TitleType: json.TitleType
16
}
17
);
18
19
res.json({});
20
};
21
22
interface IUpdateTitleRequest {
23
TitleType: string;
24
}
@@ -50,6 +50,7 @@ const getProfileViewingDataByPlayerIdImpl = async (playerId: string): Promise<IP
50
50
Harvestable: inventory.Harvestable,
51
51
DeathSquadable: inventory.DeathSquadable,
52
52
Created: toMongoDate(inventory.Created),
53
TitleType: inventory.TitleType,
53
54
MigratedToConsole: false,
54
55
Missions: inventory.Missions,
55
56
Affiliations: inventory.Affiliations,
@@ -235,6 +236,7 @@ interface IPlayerProfileViewingDataResult extends Partial<IDailyAffiliations> {
235
236
Harvestable?: boolean;
236
237
DeathSquadable?: boolean;
237
238
Created?: IMongoDate;
239
TitleType?: string;
238
240
MigratedToConsole?: boolean;
239
241
Missions?: IMission[];
240
242
Affiliations?: IAffiliation[];
@@ -1729,8 +1729,10 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1729
1729
// Resource Extractor Drones
1730
1730
Drones: [droneSchema],
1731
1731
1732
//Active profile ico
1732
//Active profile icon
1733
1733
ActiveAvatarImageType: String,
1734
// Active profile title
1735
TitleType: String,
1734
1736
1735
1737
// open location store like EidolonPlainsDiscoverable or OrbVallisCaveDiscoverable
1736
1738
DiscoveredMarkers: [discoveredMarkerSchema],
@@ -5,6 +5,7 @@ import { abortDojoComponentDestructionController } from "../controllers/api/abor
5
5
import { activateRandomModController } from "../controllers/api/activateRandomModController.ts";
6
6
import { addFriendController } from "../controllers/api/addFriendController.ts";
7
7
import { addFriendImageGetController, addFriendImagePostController } from "../controllers/api/addFriendImageController.ts";
8
import { addFriendTitleController } from "../controllers/api/addFriendTitleController.ts";
8
9
import { addIgnoredUserController } from "../controllers/api/addIgnoredUserController.ts";
9
10
import { addPendingFriendController } from "../controllers/api/addPendingFriendController.ts";
10
11
import { addToAllianceController } from "../controllers/api/addToAllianceController.ts";
@@ -250,6 +251,7 @@ apiRouter.post("/abortDojoComponent.php", abortDojoComponentController);
250
251
apiRouter.post("/activateRandomMod.php", activateRandomModController);
251
252
apiRouter.post("/addFriend.php", addFriendController);
252
253
apiRouter.post("/addFriendImage.php", addFriendImagePostController);
254
apiRouter.post("/addFriendTitle.php", addFriendTitleController);
253
255
apiRouter.post("/addIgnoredUser.php", addIgnoredUserController);
254
256
apiRouter.post("/addPendingFriend.php", addPendingFriendController);
255
257
apiRouter.post("/addToAlliance.php", addToAllianceController);
@@ -15,6 +15,7 @@ export const addInventoryDataToFriendInfo = async (info: IFriendInfo): Promise<v
15
15
const inventory = await getInventory(fromOid(info._id), "PlayerLevel ActiveAvatarImageType spoofMasteryRank");
16
16
info.PlayerLevel = inventory.spoofMasteryRank == -1 ? inventory.PlayerLevel : inventory.spoofMasteryRank;
17
17
info.ActiveAvatarImageType = inventory.ActiveAvatarImageType;
18
info.TitleType = inventory.TitleType;
18
19
};
19
20
20
21
export const areFriends = async (a: Types.ObjectId | string, b: Types.ObjectId | string): Promise<boolean> => {
@@ -352,7 +352,8 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial<
352
352
"FocusAbility",
353
353
"ActiveQuest",
354
354
"SupportedSyndicate",
355
"ActiveAvatarImageType"
355
"ActiveAvatarImageType",
356
"TitleType"
356
357
] as const) {
357
358
if (client[key] !== undefined) {
358
359
db[key] = client[key];
@@ -8,6 +8,7 @@ export interface IFriendInfo {
8
8
PlatformAccountId?: string;
9
9
Status?: number;
10
10
ActiveAvatarImageType?: string;
11
TitleType?: string;
11
12
LastLogin?: IMongoDate;
12
13
PlayerLevel?: number;
13
14
Suffix?: number;
@@ -355,6 +355,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
355
355
Drones: IDroneClient[];
356
356
StepSequencers: IStepSequencer[];
357
357
ActiveAvatarImageType?: string;
358
TitleType?: string;
358
359
ShipDecorations: ITypeCount[];
359
360
DiscoveredMarkers: IDiscoveredMarker[];
360
361
//CompletedJobs: ICompletedJob[];