Added movability of dialogs
This commit is contained in:
44
backend/controllers/adminController.js
Normal file
44
backend/controllers/adminController.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import AdminService from '../services/adminService.js';
|
||||
|
||||
export const getOpenInterests = async (req, res) => {
|
||||
try {
|
||||
const { userid: userId} = req.headers;
|
||||
const openInterests = await AdminService.getOpenInterests(userId);
|
||||
res.status(200).json(openInterests);
|
||||
} catch (error) {
|
||||
res.status(403).json({error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
export const changeInterest = async (req, res) => {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { id: interestId, active, adult: adultOnly} = req.body;
|
||||
AdminService.changeInterest(userId, interestId, active, adultOnly);
|
||||
res.status(200).json(AdminService.getOpenInterests(userId));
|
||||
} catch (error) {
|
||||
res.status(403).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
export const deleteInterest = async (req, res) => {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { id: interestId } = req.params;
|
||||
AdminService.deleteInterest(userId, interestId);
|
||||
res.status(200).json(AdminService.getOpenInterests(userId));
|
||||
} catch (error) {
|
||||
res.status(403).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
export const changeTranslation = async (req, res) => {
|
||||
try {
|
||||
const { userid: userId } = req.headers;
|
||||
const { id: interestId, translations } = req.body;
|
||||
AdminService.changeTranslation(userId, interestId, translations);
|
||||
res.status(200).json(AdminService.getOpenInterests(userId))
|
||||
} catch(error) {
|
||||
res.status(403).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user