Falukant production, family and administration enhancements
This commit is contained in:
@@ -89,6 +89,43 @@ class AdminController {
|
||||
res.status(error.status || 500).json({ error: error.message || 'Internal Server Error' });
|
||||
}
|
||||
}
|
||||
|
||||
async searchUser(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { userName, characterName } = req.body;
|
||||
const response = await AdminService.getFalukantUser(userId, userName, characterName);
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(403).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async getFalukantUserById(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { id: hashedId } = req.params;
|
||||
const response = await AdminService.getFalukantUserById(userId, hashedId);
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(403).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async changeFalukantUser(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const data = req.body;
|
||||
const { id: falukantUserId, } = req.body;
|
||||
const response = await AdminService.changeFalukantUser(userId, falukantUserId, data);
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
res.status(403).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default AdminController;
|
||||
|
||||
@@ -21,7 +21,10 @@ class FalukantController {
|
||||
this.convertProposalToDirector = this.convertProposalToDirector.bind(this);
|
||||
this.getDirectorForBranch = this.getDirectorForBranch.bind(this);
|
||||
this.setSetting = this.setSetting.bind(this);
|
||||
this.getMarriageProposals = this.getMarriageProposals.bind(this);
|
||||
this.getFamily = this.getFamily.bind(this);
|
||||
this.acceptMarriageProposal = this.acceptMarriageProposal.bind(this);
|
||||
this.getGifts = this.getGifts.bind(this);
|
||||
this.sendGift = this.sendGift.bind(this);
|
||||
}
|
||||
|
||||
async getUser(req, res) {
|
||||
@@ -308,9 +311,6 @@ class FalukantController {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const { branchId } = req.params;
|
||||
const result = await FalukantService.getDirectorForBranch(hashedUserId, branchId);
|
||||
if (!result) {
|
||||
return res.status(404).json({ message: 'No director found for this branch' });
|
||||
}
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
@@ -329,13 +329,74 @@ class FalukantController {
|
||||
}
|
||||
}
|
||||
|
||||
async getMarriageProposals(req, res) {
|
||||
async getFamily(req, res) {
|
||||
try {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const result = await FalukantService.getMarriageProposals(hashedUserId);
|
||||
const result = await FalukantService.getFamily(hashedUserId);
|
||||
if (!result) {
|
||||
res.status(404).json({ error: 'No family data found' });
|
||||
}
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async acceptMarriageProposal(req, res) {
|
||||
try {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const { proposalId } = req.body;
|
||||
const result = await FalukantService.acceptMarriageProposal(hashedUserId, proposalId);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async getGifts(req, res) {
|
||||
try {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const result = await FalukantService.getGifts(hashedUserId);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async sendGift(req, res) {
|
||||
try {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const { giftId} = req.body;
|
||||
const result = await FalukantService.sendGift(hashedUserId, giftId);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async getTitelsOfNobility(req, res) {
|
||||
try {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const result = await FalukantService.getTitlesOfNobility(hashedUserId);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async getHouseTypes(req, res) {
|
||||
try {
|
||||
const { userid: hashedUserId } = req.headers;
|
||||
const result = await FalukantService.getHouseTypes(hashedUserId);
|
||||
res.status(200).json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: error.message });
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,10 +93,6 @@ const menuStructure = {
|
||||
visible: ["hasfalukantaccount"],
|
||||
path: "/falukant/directors"
|
||||
},
|
||||
factory: {
|
||||
visible: ["hasfalukantaccount"],
|
||||
path: "/falukant/factory"
|
||||
},
|
||||
family: {
|
||||
visible: ["hasfalukantaccount"],
|
||||
path: "/falukant/family"
|
||||
|
||||
Reference in New Issue
Block a user