Falukant production, family and administration enhancements

This commit is contained in:
Torsten Schulz
2025-04-14 15:17:35 +02:00
parent 90b4f51dcb
commit b15d93a798
77 changed files with 2429 additions and 1093 deletions

View File

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