LMS/E-Learning-Backend-main/app/controllers/mini_masterclass.controller.js
2025-09-01 19:37:35 +05:30

35 lines
1.1 KiB
JavaScript

const db = require("../models");
const API = require('../helper/API_Response');
const db_helper = require("../helper/db_helper");
const helper = require("../helper/helper");
const { MiniMasterClass, Certificate, MiniMasterClassKaqa } = require("../models");
exports.add = async (req, res) => {
const input = await helper.decryptRequest(req.body.data);
res.status(200).send(API._200(await db_helper.addData('MiniMasterClass', input)));
};
exports.delete = async (req, res) => {
const input = await helper.decryptRequest(req.body.data);
res.status(200).send(API._200(await db_helper.statusChange('MiniMasterClass', input.id)));
};
exports.update = async (req, res) => {
const input = await helper.decryptRequest(req.body.data);
res.status(200).send(API._200(await db_helper.update('MiniMasterClass', input)));
};
exports.all = async (req, res) => {
await MiniMasterClassKaqa.findAll({
where: {
status: 0
}
})
const all = await MiniMasterClass.findAll({
where: {
status: 0
},
include: [{
model: Certificate,
attributes: ['id', 'certificate_name']
}]
})
res.status(200).send(API._200(await all));
};