24 lines
767 B
JavaScript
24 lines
767 B
JavaScript
import CategoryService from "../services/category.js";
|
|
import translate from "../utils/translate.js";
|
|
|
|
const TAG = "controllers/category.js";
|
|
|
|
class CategoryController {
|
|
async create(req, res) {
|
|
const { localId, categoryName, groupId } = req.body;
|
|
|
|
await CategoryService.create(groupId, localId, categoryName);
|
|
|
|
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
|
}
|
|
|
|
async update(req, res) {
|
|
const { localId, groupId, name } = req.body;
|
|
|
|
await CategoryService.update(groupId, localId, name);
|
|
|
|
return res.status(200).send(translate(req.headers["accept-language"], responseCodes.responses.general.ok));
|
|
}
|
|
};
|
|
|
|
export default new CategoryController(); |