forked from OpenWF/SpaceNinjaServer
		
	fix: save tailorshop customisations (#927)
Reviewed-on: OpenWF/SpaceNinjaServer#927 Co-authored-by: Sainan <sainan@calamity.inc> Co-committed-by: Sainan <sainan@calamity.inc>
This commit is contained in:
		
							parent
							
								
									d4c5e367b4
								
							
						
					
					
						commit
						3d62fc4259
					
				@ -125,6 +125,7 @@ favouriteLoadoutSchema.set("toJSON", {
 | 
			
		||||
const tailorShopSchema = new Schema<ITailorShopDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        FavouriteLoadouts: [favouriteLoadoutSchema],
 | 
			
		||||
        Colors: { type: colorSchema, required: false },
 | 
			
		||||
        CustomJson: String,
 | 
			
		||||
        LevelDecosVisible: Boolean,
 | 
			
		||||
        Rooms: [roomSchema]
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,13 @@ export const setShipCustomizations = async (
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        const personalRooms = await getPersonalRooms(accountId);
 | 
			
		||||
        if (shipCustomization.IsShop) {
 | 
			
		||||
            personalRooms.TailorShop.Colors = shipCustomization.Customization.Colors;
 | 
			
		||||
            personalRooms.TailorShop.LevelDecosVisible = shipCustomization.Customization.LevelDecosVisible;
 | 
			
		||||
            personalRooms.TailorShop.CustomJson = shipCustomization.Customization.CustomJson;
 | 
			
		||||
        } else {
 | 
			
		||||
            personalRooms.ShipInteriorColors = shipCustomization.Customization.Colors;
 | 
			
		||||
        }
 | 
			
		||||
        await personalRooms.save();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -84,12 +84,15 @@ export interface ISetShipCustomizationsRequest {
 | 
			
		||||
    Customization: Customization;
 | 
			
		||||
    IsExterior: boolean;
 | 
			
		||||
    AirSupportPower?: string;
 | 
			
		||||
    IsShop?: boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface Customization {
 | 
			
		||||
    SkinFlavourItem: string;
 | 
			
		||||
    Colors: IColor;
 | 
			
		||||
    ShipAttachments: ShipAttachments;
 | 
			
		||||
    LevelDecosVisible: boolean;
 | 
			
		||||
    CustomJson: string;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//TODO: check for more attachments
 | 
			
		||||
@ -155,12 +158,12 @@ export interface IFavouriteLoadoutDatabase {
 | 
			
		||||
 | 
			
		||||
export interface ITailorShopDatabase {
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
			
		||||
    CustomJson: "{}"; // ???
 | 
			
		||||
    Colors?: IColor;
 | 
			
		||||
    CustomJson: string;
 | 
			
		||||
    LevelDecosVisible: boolean;
 | 
			
		||||
    Rooms: IRoom[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface ITailorShop extends Omit<ITailorShopDatabase, "FavouriteLoadouts"> {
 | 
			
		||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
			
		||||
    Colors?: []; // ???
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user