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>(
 | 
					const tailorShopSchema = new Schema<ITailorShopDatabase>(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        FavouriteLoadouts: [favouriteLoadoutSchema],
 | 
					        FavouriteLoadouts: [favouriteLoadoutSchema],
 | 
				
			||||||
 | 
					        Colors: { type: colorSchema, required: false },
 | 
				
			||||||
        CustomJson: String,
 | 
					        CustomJson: String,
 | 
				
			||||||
        LevelDecosVisible: Boolean,
 | 
					        LevelDecosVisible: Boolean,
 | 
				
			||||||
        Rooms: [roomSchema]
 | 
					        Rooms: [roomSchema]
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,13 @@ export const setShipCustomizations = async (
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        const personalRooms = await getPersonalRooms(accountId);
 | 
					        const personalRooms = await getPersonalRooms(accountId);
 | 
				
			||||||
        personalRooms.ShipInteriorColors = shipCustomization.Customization.Colors;
 | 
					        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();
 | 
					        await personalRooms.save();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -84,12 +84,15 @@ export interface ISetShipCustomizationsRequest {
 | 
				
			|||||||
    Customization: Customization;
 | 
					    Customization: Customization;
 | 
				
			||||||
    IsExterior: boolean;
 | 
					    IsExterior: boolean;
 | 
				
			||||||
    AirSupportPower?: string;
 | 
					    AirSupportPower?: string;
 | 
				
			||||||
 | 
					    IsShop?: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Customization {
 | 
					export interface Customization {
 | 
				
			||||||
    SkinFlavourItem: string;
 | 
					    SkinFlavourItem: string;
 | 
				
			||||||
    Colors: IColor;
 | 
					    Colors: IColor;
 | 
				
			||||||
    ShipAttachments: ShipAttachments;
 | 
					    ShipAttachments: ShipAttachments;
 | 
				
			||||||
 | 
					    LevelDecosVisible: boolean;
 | 
				
			||||||
 | 
					    CustomJson: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//TODO: check for more attachments
 | 
					//TODO: check for more attachments
 | 
				
			||||||
@ -155,12 +158,12 @@ export interface IFavouriteLoadoutDatabase {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export interface ITailorShopDatabase {
 | 
					export interface ITailorShopDatabase {
 | 
				
			||||||
    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
					    FavouriteLoadouts: IFavouriteLoadoutDatabase[];
 | 
				
			||||||
    CustomJson: "{}"; // ???
 | 
					    Colors?: IColor;
 | 
				
			||||||
 | 
					    CustomJson: string;
 | 
				
			||||||
    LevelDecosVisible: boolean;
 | 
					    LevelDecosVisible: boolean;
 | 
				
			||||||
    Rooms: IRoom[];
 | 
					    Rooms: IRoom[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ITailorShop extends Omit<ITailorShopDatabase, "FavouriteLoadouts"> {
 | 
					export interface ITailorShop extends Omit<ITailorShopDatabase, "FavouriteLoadouts"> {
 | 
				
			||||||
    FavouriteLoadouts: IFavouriteLoadout[];
 | 
					    FavouriteLoadouts: IFavouriteLoadout[];
 | 
				
			||||||
    Colors?: []; // ???
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user