forked from OpenWF/SpaceNinjaServer
		
	chore: fix saveSettingsController
This commit is contained in:
		
							parent
							
								
									fd93f34538
								
							
						
					
					
						commit
						2516af9acc
					
				@ -14,9 +14,9 @@ const saveSettingsController: RequestHandler = async (req, res): Promise<void> =
 | 
				
			|||||||
    const settingResults = getJSONfromString<ISaveSettingsRequest>(String(req.body));
 | 
					    const settingResults = getJSONfromString<ISaveSettingsRequest>(String(req.body));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    inventory.Settings = Object.assign(inventory.Settings, settingResults.Settings);
 | 
					    inventory.Settings = Object.assign(inventory.Settings ?? {}, settingResults.Settings);
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
    res.json(inventory.Settings);
 | 
					    res.json({ Settings: inventory.Settings });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export { saveSettingsController };
 | 
					export { saveSettingsController };
 | 
				
			||||||
 | 
				
			|||||||
@ -496,7 +496,8 @@ const settingsSchema = new Schema<ISettings>({
 | 
				
			|||||||
    GiftMode: String,
 | 
					    GiftMode: String,
 | 
				
			||||||
    GuildInvRestriction: String,
 | 
					    GuildInvRestriction: String,
 | 
				
			||||||
    ShowFriendInvNotifications: Boolean,
 | 
					    ShowFriendInvNotifications: Boolean,
 | 
				
			||||||
    TradingRulesConfirmed: Boolean
 | 
					    TradingRulesConfirmed: Boolean,
 | 
				
			||||||
 | 
					    SubscribedToSurveys: Boolean
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const consumedSchuitsSchema = new Schema<IConsumedSuit>(
 | 
					const consumedSchuitsSchema = new Schema<IConsumedSuit>(
 | 
				
			||||||
 | 
				
			|||||||
@ -295,7 +295,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
				
			|||||||
    Nemesis?: INemesisClient;
 | 
					    Nemesis?: INemesisClient;
 | 
				
			||||||
    NemesisHistory: INemesisBaseClient[];
 | 
					    NemesisHistory: INemesisBaseClient[];
 | 
				
			||||||
    LastNemesisAllySpawnTime?: IMongoDate;
 | 
					    LastNemesisAllySpawnTime?: IMongoDate;
 | 
				
			||||||
    Settings: ISettings;
 | 
					    Settings?: ISettings;
 | 
				
			||||||
    PersonalTechProjects: IPersonalTechProject[];
 | 
					    PersonalTechProjects: IPersonalTechProject[];
 | 
				
			||||||
    PlayerSkills: IPlayerSkills;
 | 
					    PlayerSkills: IPlayerSkills;
 | 
				
			||||||
    CrewShipAmmo: ITypeCount[];
 | 
					    CrewShipAmmo: ITypeCount[];
 | 
				
			||||||
@ -971,11 +971,12 @@ export interface ISentientSpawnChanceBoosters {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ISettings {
 | 
					export interface ISettings {
 | 
				
			||||||
    FriendInvRestriction: string;
 | 
					    FriendInvRestriction: "GIFT_MODE_ALL" | "GIFT_MODE_FRIENDS" | "GIFT_MODE_NONE";
 | 
				
			||||||
    GiftMode: string;
 | 
					    GiftMode: "GIFT_MODE_ALL" | "GIFT_MODE_FRIENDS" | "GIFT_MODE_NONE";
 | 
				
			||||||
    GuildInvRestriction: string;
 | 
					    GuildInvRestriction: "GIFT_MODE_ALL" | "GIFT_MODE_FRIENDS" | "GIFT_MODE_NONE";
 | 
				
			||||||
    ShowFriendInvNotifications: boolean;
 | 
					    ShowFriendInvNotifications: boolean;
 | 
				
			||||||
    TradingRulesConfirmed: boolean;
 | 
					    TradingRulesConfirmed: boolean;
 | 
				
			||||||
 | 
					    SubscribedToSurveys?: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IShipInventory {
 | 
					export interface IShipInventory {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user