Added admin functionality.
This commit is contained in:
@@ -66,3 +66,55 @@ exports.createShop = async (req, res) => {
|
||||
res.status(500).json(error);
|
||||
}
|
||||
};
|
||||
exports.updateCounter = async (req, res) => {
|
||||
logger.log("admin-update-counter", "ADMIN", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true,
|
||||
});
|
||||
const { id, counter } = req.body;
|
||||
|
||||
try {
|
||||
const result = await client.request(
|
||||
`mutation UPDATE_COUNTER($id: uuid!, $counter: counters_set_input!) {
|
||||
update_counters_by_pk(pk_columns: { id: $id }, _set: $counter) {
|
||||
id
|
||||
countertype
|
||||
count
|
||||
prefix
|
||||
}
|
||||
}`,
|
||||
{
|
||||
id,
|
||||
counter,
|
||||
}
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json(error);
|
||||
}
|
||||
};
|
||||
exports.updateShop = async (req, res) => {
|
||||
logger.log("admin-update-shop", "ADMIN", req.user.email, null, {
|
||||
request: req.body,
|
||||
ioadmin: true,
|
||||
});
|
||||
const { id, bodyshop } = req.body;
|
||||
|
||||
try {
|
||||
const result = await client.request(
|
||||
`mutation UPDATE_BODYSHOP($id: uuid!, $bodyshop: bodyshops_set_input!) {
|
||||
update_bodyshops_by_pk(pk_columns: { id: $id }, _set: $bodyshop) {
|
||||
id
|
||||
|
||||
}
|
||||
}`,
|
||||
{
|
||||
id,
|
||||
bodyshop,
|
||||
}
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
res.status(500).json(error);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user