chore: fix saveSettingsController
All checks were successful
Build / build (18) (push) Successful in 58s
Build / build (20) (push) Successful in 1m14s
Build / build (22) (push) Successful in 45s
Build Docker image / docker (push) Successful in 45s

This commit is contained in:
Sainan 2025-03-27 12:30:12 +01:00
parent fd93f34538
commit 2516af9acc
3 changed files with 9 additions and 7 deletions

View File

@ -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 };

View File

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

View File

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