Add reputation actions endpoint: Implement getReputationActions method in FalukantService, update FalukantController to wrap the new method, and add corresponding route in falukantRouter for retrieving reputation actions.
This commit is contained in:
@@ -121,6 +121,7 @@ class FalukantController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.getTitlesOfNobility = this._wrapWithUser((userId) => this.service.getTitlesOfNobility(userId));
|
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.getHouseTypes = this._wrapWithUser((userId) => this.service.getHouseTypes(userId));
|
||||||
this.getMoodAffect = this._wrapWithUser((userId) => this.service.getMoodAffect(userId));
|
this.getMoodAffect = this._wrapWithUser((userId) => this.service.getMoodAffect(userId));
|
||||||
this.getCharacterAffect = this._wrapWithUser((userId) => this.service.getCharacterAffect(userId));
|
this.getCharacterAffect = this._wrapWithUser((userId) => this.service.getCharacterAffect(userId));
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ router.get('/family/children', falukantController.getChildren);
|
|||||||
router.post('/family/gift', falukantController.sendGift);
|
router.post('/family/gift', falukantController.sendGift);
|
||||||
router.get('/family', falukantController.getFamily);
|
router.get('/family', falukantController.getFamily);
|
||||||
router.get('/nobility/titels', falukantController.getTitlesOfNobility);
|
router.get('/nobility/titels', falukantController.getTitlesOfNobility);
|
||||||
|
router.get('/reputation/actions', falukantController.getReputationActions);
|
||||||
router.get('/houses/types', falukantController.getHouseTypes);
|
router.get('/houses/types', falukantController.getHouseTypes);
|
||||||
router.get('/houses/buyable', falukantController.getBuyableHouses);
|
router.get('/houses/buyable', falukantController.getBuyableHouses);
|
||||||
router.get('/houses', falukantController.getUserHouse);
|
router.get('/houses', falukantController.getUserHouse);
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ import Weather from '../models/falukant/data/weather.js';
|
|||||||
import TownProductWorth from '../models/falukant/data/town_product_worth.js';
|
import TownProductWorth from '../models/falukant/data/town_product_worth.js';
|
||||||
import ProductWeatherEffect from '../models/falukant/type/product_weather_effect.js';
|
import ProductWeatherEffect from '../models/falukant/type/product_weather_effect.js';
|
||||||
import WeatherType from '../models/falukant/type/weather.js';
|
import WeatherType from '../models/falukant/type/weather.js';
|
||||||
|
import ReputationActionType from '../models/falukant/type/reputation_action.js';
|
||||||
|
|
||||||
function calcAge(birthdate) {
|
function calcAge(birthdate) {
|
||||||
const b = new Date(birthdate); b.setHours(0, 0);
|
const b = new Date(birthdate); b.setHours(0, 0);
|
||||||
@@ -3006,6 +3007,12 @@ class FalukantService extends BaseService {
|
|||||||
return TitleOfNobility.findAll();
|
return TitleOfNobility.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getReputationActions() {
|
||||||
|
return ReputationActionType.findAll({
|
||||||
|
order: [['cost', 'ASC']]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async getHouseTypes() {
|
async getHouseTypes() {
|
||||||
// return House
|
// return House
|
||||||
}
|
}
|
||||||
@@ -3172,7 +3179,9 @@ class FalukantService extends BaseService {
|
|||||||
attributes: ['id']
|
attributes: ['id']
|
||||||
});
|
});
|
||||||
if (already) {
|
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([
|
const [ptype, music, banquette] = await Promise.all([
|
||||||
PartyType.findByPk(partyTypeId),
|
PartyType.findByPk(partyTypeId),
|
||||||
|
|||||||
Reference in New Issue
Block a user