返回提交历史
Modified
src/controllers/api/setBootLocationController.ts
+7
-3
Modified
src/models/personalRoomsModel.ts
+6
-1
Modified
src/types/personalRoomsTypes.ts
+2
-1
Modified
src/types/shipTypes.ts
+3
-1
XFEstudio/SpaceNinjaServer
feat: persist boot location (#159)
984c4ee4
代码差异
4 个文件
+18
-6
@@ -1,6 +1,10 @@
1
import { logger } from "@/src/utils/logger";
2
import { Request, Response } from "express";
1
import { RequestHandler } from "express";
2
import { getPersonalRooms } from "@/src/services/personalRoomsService";
3
import { TBootLocation } from "@/src/types/shipTypes";
3
4
4
export const setBootLocationController = (_req: Request, res: Response) => {
5
export const setBootLocationController: RequestHandler = async (req, res) => {
6
const personalRooms = await getPersonalRooms(req.query.accountId as string);
7
personalRooms.Ship.BootLocation = req.query.bootLocation as string as TBootLocation;
8
await personalRooms.save();
5
9
res.end();
6
10
};
@@ -46,7 +46,12 @@ const apartmentSchema = new Schema<IApartment>(
46
46
);
47
47
48
48
const orbiterSchema = new Schema<IOrbiter>(
49
{ Features: [String], Rooms: [roomSchema], ContentUrlSignature: String },
49
{
50
Features: [String],
51
Rooms: [roomSchema],
52
ContentUrlSignature: String,
53
BootLocation: String
54
},
50
55
{ _id: false }
51
56
);
52
57
@@ -1,10 +1,11 @@
1
import { IApartment, IRooms, IPlacedDecosDatabase } from "@/src/types/shipTypes";
1
import { IApartment, IRooms, IPlacedDecosDatabase, TBootLocation } from "@/src/types/shipTypes";
2
2
import { Model, Types } from "mongoose";
3
3
4
4
export interface IOrbiter {
5
5
Features: string[];
6
6
Rooms: IRooms[];
7
7
ContentUrlSignature: string;
8
BootLocation?: TBootLocation;
8
9
}
9
10
10
11
export interface IPersonalRooms {
@@ -19,13 +19,15 @@ export interface IShipInterior {
19
19
SkinFlavourItem?: string;
20
20
}
21
21
22
export type TBootLocation = "LISET" | "DRIFTER_CAMP" | "APARTMENT";
23
22
24
export interface IShip {
23
25
Features: string[];
24
26
ShipId: IOid;
25
27
ShipInterior: IShipInterior;
26
28
Rooms: IRooms[];
27
29
ContentUrlSignature: string;
28
BootLocation?: "LISET" | "DRIFTER_CAMP" | "APARTMENT";
30
BootLocation?: TBootLocation;
29
31
}
30
32
31
33
export interface IShipDatabase {