DBLabs/abitur_list_client/mongo/controllers/educationform.controller.js

37 lines
1.5 KiB
JavaScript
Raw Normal View History

const mymongodb = require('../../mongoIndex')
const EducationFormControllerInterface = require('../../controllers/interfaces/educationform.controller.interface');
const { ObjectId } = require('mongodb');
class EducationFormController extends EducationFormControllerInterface {
async createEducationForm(req, res) {
// const {title} = req.body
// const newEducationForm = await db.query('INSERT INTO education_form (title) VALUES ($1) RETURNING *', [title])
// res.json(newEducationForm.rows[0])
}
async getEducationForms(req, res) {
// const forms = await db.query('SELECT * FROM education_form')
// res.json(forms.rows)
const forms = await mymongodb.collection('educationforms').find().toArray()
res.json(forms)
}
async getOneEducationForm(req, res) {
// const id = req.params.id
// const forms = await db.query('SELECT * FROM education_form WHERE id=$1', [id])
// res.json(forms.rows[0])
}
async updateEducationForm(req, res) {
// const {id, title} = req.body
// const newEducationForm = await db.query('UPDATE education_form SET title=$1 WHERE id=$2 RETURNING *', [title, id])
// res.json(newEducationForm.rows[0])
}
async deleteEducationForm(req, res) {
// const id = req.params.id
// const forms = await db.query('DELETE FROM education_form WHERE id=$1', [id])
// res.json(forms.rows[0])
}
}
module.exports = new EducationFormController()