feat(admin): implement pregnancy and birth management features
Some checks failed
Deploy to production / deploy (push) Failing after 2m6s
Some checks failed
Deploy to production / deploy (push) Failing after 2m6s
- Added new admin functionalities to force pregnancy, clear pregnancy, and trigger birth for characters. - Introduced corresponding routes and controller methods in adminRouter and adminController. - Enhanced the FalukantCharacter model to include pregnancy-related fields. - Created database migration for adding pregnancy columns to the character table. - Updated frontend views and internationalization files to support new pregnancy and birth management features. - Improved user feedback and error handling for these new actions.
This commit is contained in:
@@ -13,6 +13,9 @@ class AdminController {
|
||||
this.searchUser = this.searchUser.bind(this);
|
||||
this.getFalukantUserById = this.getFalukantUserById.bind(this);
|
||||
this.changeFalukantUser = this.changeFalukantUser.bind(this);
|
||||
this.adminForceFalukantPregnancy = this.adminForceFalukantPregnancy.bind(this);
|
||||
this.adminClearFalukantPregnancy = this.adminClearFalukantPregnancy.bind(this);
|
||||
this.adminForceFalukantBirth = this.adminForceFalukantBirth.bind(this);
|
||||
this.getFalukantUserBranches = this.getFalukantUserBranches.bind(this);
|
||||
this.updateFalukantStock = this.updateFalukantStock.bind(this);
|
||||
this.addFalukantStock = this.addFalukantStock.bind(this);
|
||||
@@ -372,6 +375,50 @@ class AdminController {
|
||||
}
|
||||
}
|
||||
|
||||
async adminForceFalukantPregnancy(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { characterId, fatherCharacterId, dueInDays } = req.body;
|
||||
const response = await AdminService.adminForceFalukantPregnancy(userId, characterId, {
|
||||
fatherCharacterId,
|
||||
dueInDays,
|
||||
});
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(400).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async adminClearFalukantPregnancy(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { characterId } = req.body;
|
||||
const response = await AdminService.adminClearFalukantPregnancy(userId, characterId);
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(400).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async adminForceFalukantBirth(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { motherCharacterId, fatherCharacterId, birthContext, legitimacy, gender } = req.body;
|
||||
const response = await AdminService.adminForceFalukantBirth(userId, motherCharacterId, {
|
||||
fatherCharacterId,
|
||||
birthContext,
|
||||
legitimacy,
|
||||
gender,
|
||||
});
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(400).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async getFalukantUserBranches(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
|
||||
Reference in New Issue
Block a user