feat: persist boot location #159
@ -1,6 +1,10 @@
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { Request, Response } from "express";
 | 
			
		||||
import { RequestHandler } 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();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -46,7 +46,12 @@ const apartmentSchema = new Schema<IApartment>(
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const orbiterSchema = new Schema<IOrbiter>(
 | 
			
		||||
    { Features: [String], Rooms: [roomSchema], ContentUrlSignature: String },
 | 
			
		||||
    {
 | 
			
		||||
        Features: [String],
 | 
			
		||||
        Rooms: [roomSchema],
 | 
			
		||||
        ContentUrlSignature: String,
 | 
			
		||||
        BootLocation: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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";
 | 
			
		||||
 | 
			
		||||
export interface IOrbiter {
 | 
			
		||||
    Features: string[];
 | 
			
		||||
    Rooms: IRooms[];
 | 
			
		||||
    ContentUrlSignature: string;
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPersonalRooms {
 | 
			
		||||
 | 
			
		||||
@ -19,13 +19,15 @@ export interface IShipInterior {
 | 
			
		||||
    SkinFlavourItem?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type TBootLocation = "LISET" | "DRIFTER_CAMP" | "APARTMENT";
 | 
			
		||||
 | 
			
		||||
export interface IShip {
 | 
			
		||||
    Features: string[];
 | 
			
		||||
    ShipId: IOid;
 | 
			
		||||
    ShipInterior: IShipInterior;
 | 
			
		||||
    Rooms: IRooms[];
 | 
			
		||||
    ContentUrlSignature: string;
 | 
			
		||||
    BootLocation?: "LISET" | "DRIFTER_CAMP" | "APARTMENT";
 | 
			
		||||
    BootLocation?: TBootLocation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IShipDatabase {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user