feat: vista suite backdrop and soundscape customisation #2534
							
								
								
									
										22
									
								
								src/controllers/api/apartmentController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/controllers/api/apartmentController.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
 | 
			
		||||
export const apartmentController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
    const personalRooms = await getPersonalRooms(accountId, "Apartment");
 | 
			
		||||
    const response: IApartmentResponse = {};
 | 
			
		||||
    if (req.query.backdrop !== undefined) {
 | 
			
		||||
        response.NewBackdropItem = personalRooms.Apartment.VideoWallBackdrop = req.query.backdrop as string;
 | 
			
		||||
    }
 | 
			
		||||
    if (req.query.soundscape !== undefined) {
 | 
			
		||||
        response.NewSoundscapeItem = personalRooms.Apartment.Soundscape = req.query.soundscape as string;
 | 
			
		||||
    }
 | 
			
		||||
    await personalRooms.save();
 | 
			
		||||
    res.json(response);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
interface IApartmentResponse {
 | 
			
		||||
    NewBackdropItem?: string;
 | 
			
		||||
    NewSoundscapeItem?: string;
 | 
			
		||||
}
 | 
			
		||||
@ -122,7 +122,9 @@ const apartmentSchema = new Schema<IApartmentDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        Rooms: [roomSchema],
 | 
			
		||||
        FavouriteLoadouts: [favouriteLoadoutSchema],
 | 
			
		||||
        Gardening: gardeningSchema
 | 
			
		||||
        Gardening: gardeningSchema,
 | 
			
		||||
        VideoWallBackdrop: String,
 | 
			
		||||
        Soundscape: String
 | 
			
		||||
    },
 | 
			
		||||
    { _id: false }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ import { addPendingFriendController } from "@/src/controllers/api/addPendingFrie
 | 
			
		||||
import { addToAllianceController } from "@/src/controllers/api/addToAllianceController";
 | 
			
		||||
import { addToGuildController } from "@/src/controllers/api/addToGuildController";
 | 
			
		||||
import { adoptPetController } from "@/src/controllers/api/adoptPetController";
 | 
			
		||||
import { apartmentController } from "@/src/controllers/api/apartmentController";
 | 
			
		||||
import { arcaneCommonController } from "@/src/controllers/api/arcaneCommonController";
 | 
			
		||||
import { archonFusionController } from "@/src/controllers/api/archonFusionController";
 | 
			
		||||
import { artifactsController } from "@/src/controllers/api/artifactsController";
 | 
			
		||||
@ -168,6 +169,7 @@ const apiRouter = express.Router();
 | 
			
		||||
// get
 | 
			
		||||
apiRouter.get("/abandonLibraryDailyTask.php", abandonLibraryDailyTaskController);
 | 
			
		||||
apiRouter.get("/abortDojoComponentDestruction.php", abortDojoComponentDestructionController);
 | 
			
		||||
apiRouter.get("/apartment.php", apartmentController);
 | 
			
		||||
apiRouter.get("/cancelGuildAdvertisement.php", cancelGuildAdvertisementController);
 | 
			
		||||
apiRouter.get("/changeDojoRoot.php", changeDojoRootController);
 | 
			
		||||
apiRouter.get("/changeGuildRank.php", changeGuildRankController);
 | 
			
		||||
 | 
			
		||||
@ -91,12 +91,16 @@ export interface IApartmentClient {
 | 
			
		||||
    Gardening: IGardeningClient;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
			
		||||
    VideoWallBackdrop?: string;
 | 
			
		||||
    Soundscape?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IApartmentDatabase {
 | 
			
		||||
    Gardening: IGardeningDatabase;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
			
		||||
    VideoWallBackdrop?: string;
 | 
			
		||||
    Soundscape?: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPlacedDecosDatabase {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user