fix: save tailorshop customisations (#927)
All checks were successful
Build / build (20) (push) Successful in 38s
Build / build (18) (push) Successful in 59s
Build / build (22) (push) Successful in 1m15s
Build Docker image / docker (push) Successful in 1m16s

Reviewed-on: #927
Co-authored-by: Sainan <sainan@calamity.inc>
Co-committed-by: Sainan <sainan@calamity.inc>
This commit is contained in:
Sainan 2025-02-08 17:41:33 -08:00 committed by OrdisPrime
parent d4c5e367b4
commit 3d62fc4259
3 changed files with 13 additions and 3 deletions

View File

@ -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]

View File

@ -28,7 +28,13 @@ export const setShipCustomizations = async (
}
} else {
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();
}
};

View File

@ -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?: []; // ???
}