feat: persist boot location (#159)

This commit is contained in:
Sainan 2024-05-06 15:39:27 +02:00 committed by GitHub
parent fd56203f35
commit 984c4ee43e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,10 @@
import { logger } from "@/src/utils/logger"; import { RequestHandler } from "express";
import { Request, Response } from "express"; import { getPersonalRooms } from "@/src/services/personalRoomsService";
import { TBootLocation } from "@/src/types/shipTypes";
export const setBootLocationController = (_req: Request, res: Response) => { export const setBootLocationController: RequestHandler = async (req, res) => {
const personalRooms = await getPersonalRooms(req.query.accountId as string);
personalRooms.Ship.BootLocation = req.query.bootLocation as string as TBootLocation;
await personalRooms.save();
res.end(); res.end();
}; };

View File

@ -46,7 +46,12 @@ const apartmentSchema = new Schema<IApartment>(
); );
const orbiterSchema = new Schema<IOrbiter>( const orbiterSchema = new Schema<IOrbiter>(
{ Features: [String], Rooms: [roomSchema], ContentUrlSignature: String }, {
Features: [String],
Rooms: [roomSchema],
ContentUrlSignature: String,
BootLocation: String
},
{ _id: false } { _id: false }
); );

View File

@ -1,10 +1,11 @@
import { IApartment, IRooms, IPlacedDecosDatabase } from "@/src/types/shipTypes"; import { IApartment, IRooms, IPlacedDecosDatabase, TBootLocation } from "@/src/types/shipTypes";
import { Model, Types } from "mongoose"; import { Model, Types } from "mongoose";
export interface IOrbiter { export interface IOrbiter {
Features: string[]; Features: string[];
Rooms: IRooms[]; Rooms: IRooms[];
ContentUrlSignature: string; ContentUrlSignature: string;
BootLocation?: TBootLocation;
} }
export interface IPersonalRooms { export interface IPersonalRooms {

View File

@ -19,13 +19,15 @@ export interface IShipInterior {
SkinFlavourItem?: string; SkinFlavourItem?: string;
} }
export type TBootLocation = "LISET" | "DRIFTER_CAMP" | "APARTMENT";
export interface IShip { export interface IShip {
Features: string[]; Features: string[];
ShipId: IOid; ShipId: IOid;
ShipInterior: IShipInterior; ShipInterior: IShipInterior;
Rooms: IRooms[]; Rooms: IRooms[];
ContentUrlSignature: string; ContentUrlSignature: string;
BootLocation?: "LISET" | "DRIFTER_CAMP" | "APARTMENT"; BootLocation?: TBootLocation;
} }
export interface IShipDatabase { export interface IShipDatabase {