diff --git a/backend/controllers/falukantController.js b/backend/controllers/falukantController.js index 1c36e67..a248c7a 100644 --- a/backend/controllers/falukantController.js +++ b/backend/controllers/falukantController.js @@ -121,6 +121,7 @@ class FalukantController { }); this.getTitlesOfNobility = this._wrapWithUser((userId) => this.service.getTitlesOfNobility(userId)); + this.getReputationActions = this._wrapWithUser((userId) => this.service.getReputationActions(userId)); this.getHouseTypes = this._wrapWithUser((userId) => this.service.getHouseTypes(userId)); this.getMoodAffect = this._wrapWithUser((userId) => this.service.getMoodAffect(userId)); this.getCharacterAffect = this._wrapWithUser((userId) => this.service.getCharacterAffect(userId)); diff --git a/backend/routers/falukantRouter.js b/backend/routers/falukantRouter.js index 051a70e..8dc3aaa 100644 --- a/backend/routers/falukantRouter.js +++ b/backend/routers/falukantRouter.js @@ -45,6 +45,7 @@ router.get('/family/children', falukantController.getChildren); router.post('/family/gift', falukantController.sendGift); router.get('/family', falukantController.getFamily); router.get('/nobility/titels', falukantController.getTitlesOfNobility); +router.get('/reputation/actions', falukantController.getReputationActions); router.get('/houses/types', falukantController.getHouseTypes); router.get('/houses/buyable', falukantController.getBuyableHouses); router.get('/houses', falukantController.getUserHouse); diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index ecb9f15..de1d370 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -69,6 +69,7 @@ import Weather from '../models/falukant/data/weather.js'; import TownProductWorth from '../models/falukant/data/town_product_worth.js'; import ProductWeatherEffect from '../models/falukant/type/product_weather_effect.js'; import WeatherType from '../models/falukant/type/weather.js'; +import ReputationActionType from '../models/falukant/type/reputation_action.js'; function calcAge(birthdate) { const b = new Date(birthdate); b.setHours(0, 0); @@ -3006,6 +3007,12 @@ class FalukantService extends BaseService { return TitleOfNobility.findAll(); } + async getReputationActions() { + return ReputationActionType.findAll({ + order: [['cost', 'ASC']] + }); + } + async getHouseTypes() { // return House } @@ -3172,7 +3179,9 @@ class FalukantService extends BaseService { attributes: ['id'] }); if (already) { - throw new Error('Diese Party wurde bereits innerhalb der letzten 24 Stunden bestellt'); + const error = new Error('Diese Party wurde bereits innerhalb der letzten 24 Stunden bestellt'); + error.status = 409; + throw error; } const [ptype, music, banquette] = await Promise.all([ PartyType.findByPk(partyTypeId),