feat(admin): implement region renaming functionality and update UI components
This commit is contained in:
@@ -57,6 +57,7 @@ class AdminController {
|
||||
this.getFalukantAllRegions = this.getFalukantAllRegions.bind(this);
|
||||
this.getFalukantRegionTypes = this.getFalukantRegionTypes.bind(this);
|
||||
this.createFalukantRegion = this.createFalukantRegion.bind(this);
|
||||
this.updateFalukantRegion = this.updateFalukantRegion.bind(this);
|
||||
this.deleteFalukantRegion = this.deleteFalukantRegion.bind(this);
|
||||
this.updateFalukantRegionMap = this.updateFalukantRegionMap.bind(this);
|
||||
this.getRegionDistances = this.getRegionDistances.bind(this);
|
||||
@@ -623,6 +624,19 @@ class AdminController {
|
||||
}
|
||||
}
|
||||
|
||||
async updateFalukantRegion(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const region = await AdminService.updateFalukantRegion(userId, req.params.id, req.body || {});
|
||||
res.status(200).json(region);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
const status = error.message === 'noaccess' ? 403
|
||||
: (error.message === 'regionNotFound' ? 404 : 400);
|
||||
res.status(status).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
async deleteFalukantRegion(req, res) {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
|
||||
Reference in New Issue
Block a user