mongo
This commit is contained in:
parent
fbf3ddc077
commit
401a31ef9a
@ -3,5 +3,6 @@
|
|||||||
"host" : "192.168.56.105",
|
"host" : "192.168.56.105",
|
||||||
"database" : "StudentsMarksBook",
|
"database" : "StudentsMarksBook",
|
||||||
"password" : "password",
|
"password" : "password",
|
||||||
"port" : "5432"
|
"port" : "5432",
|
||||||
|
"mongodb" : "mongodb://127.0.0.1:27017/"
|
||||||
}
|
}
|
@ -1,267 +0,0 @@
|
|||||||
const express = require('express')
|
|
||||||
const cors = require('cors')
|
|
||||||
const faculty = require('./models/faculty')
|
|
||||||
const direction = require('./models/direction')
|
|
||||||
const subject = require('./models/subject')
|
|
||||||
const teacher = require('./models/teacher')
|
|
||||||
const test = require('./models/test')
|
|
||||||
const student = require('./models/student')
|
|
||||||
const score = require('./models/score')
|
|
||||||
|
|
||||||
const app = express()
|
|
||||||
const port = 3001
|
|
||||||
|
|
||||||
app.use(cors())
|
|
||||||
|
|
||||||
app.use(express.json())
|
|
||||||
app.use(function (req, res, next) {
|
|
||||||
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000')
|
|
||||||
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS')
|
|
||||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers')
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
// ФАКУЛЬТЕТ-------------------------------------
|
|
||||||
app.post('/faculty', (req, res) => {
|
|
||||||
faculty.create(req.body.name)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/faculty/tests', (req, res) => {
|
|
||||||
faculty.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/faculty', (req, res) => {
|
|
||||||
faculty.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/faculty/directions/:id', (req, res) => {
|
|
||||||
faculty.getDirections(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/faculty/del/:id', (req, res) => {
|
|
||||||
faculty.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/faculty/upd/:id', (req, res) => {
|
|
||||||
faculty.update(req.params.id, req.body.name)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
// TEST TYPE-------------------------------------
|
|
||||||
app.post('/test', (req, res) => {
|
|
||||||
test.create(req.body.name)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/test/tests', (req, res) => {
|
|
||||||
test.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/test', (req, res) => {
|
|
||||||
test.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/test/del/:id', (req, res) => {
|
|
||||||
test.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/test/upd/:id', (req, res) => {
|
|
||||||
test.update(req.params.id, req.body.name)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
// TEACHER-------------------------------------
|
|
||||||
app.post('/teacher', (req, res) => {
|
|
||||||
teacher.create(req.body.name, req.body.surname,req.body.post)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/teacher/tests', (req, res) => {
|
|
||||||
teacher.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/teacher', (req, res) => {
|
|
||||||
teacher.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/teacher/del/:id', (req, res) => {
|
|
||||||
teacher.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/teacher/upd/:id', (req, res) => {
|
|
||||||
teacher.update(req.params.id, req.body.name, req.body.surname,req.body.post)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
// SUBJECT-------------------------------------
|
|
||||||
app.post('/subject', (req, res) => {
|
|
||||||
subject.create(req.body.name, req.body.hours_count)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/subject/tests', (req, res) => {
|
|
||||||
subject.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/subject', (req, res) => {
|
|
||||||
subject.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/subject/del/:id', (req, res) => {
|
|
||||||
subject.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/subject/upd/:id', (req, res) => {
|
|
||||||
subject.update(req.params.id, req.body.name, req.body.hours_count)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
// DIRECTION-------------------------------------
|
|
||||||
app.post('/direction', (req, res) => {
|
|
||||||
direction.create(req.body.name, req.body.faculty_id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/direction/tests', (req, res) => {
|
|
||||||
direction.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/direction', (req, res) => {
|
|
||||||
direction.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/direction/del/:id', (req, res) => {
|
|
||||||
direction.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/direction/upd/:id', (req, res) => {
|
|
||||||
direction.update(req.params.id, req.body.name, req.body.facultyId)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
// STUDENT-------------------------------------
|
|
||||||
app.post('/student', (req, res) => {
|
|
||||||
student.create(req.body.name, req.body.surname, req.body.record_book, req.body.direction_id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/student/tests', (req, res) => {
|
|
||||||
student.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.post('/student/test', (req, res) => {
|
|
||||||
student.createTest()
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/student', (req, res) => {
|
|
||||||
student.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/student/del/:id', (req, res) => {
|
|
||||||
student.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/student/upd/:id', (req, res) => {
|
|
||||||
student.update(req.params.id, req.body.name, req.body.surname, req.body.record_book, req.body.direction_id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
// SCORE-------------------------------------
|
|
||||||
app.post('/score', (req, res) => {
|
|
||||||
score.create(req.body.value, req.body.subject_id, req.body.test_type_id, req.body.teacher_id, req.body.student_id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/score/tests', (req, res) => {
|
|
||||||
score.timeTests()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/score', (req, res) => {
|
|
||||||
score.get()
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.delete('/score/del/:id', (req, res) => {
|
|
||||||
score.del(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.put('/score/upd/:id', (req, res) => {
|
|
||||||
score.update(req.params.id, req.body.value, req.body.subject_id, req.body.test_type_id, req.body.teacher_id, req.body.student_id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
|
|
||||||
app.get('/score/studMarks/:id', (req, res) => {
|
|
||||||
score.getStudentMarks(req.params.id)
|
|
||||||
.then(response => res.status(200).send(response))
|
|
||||||
.catch(error => res.status(500).send(error))
|
|
||||||
})
|
|
||||||
//----------------------------------------------
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
|
||||||
console.log(`app runnong on port ${port}`)
|
|
||||||
})
|
|
109
all/node-postgres/mongo.js
Normal file
109
all/node-postgres/mongo.js
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
const express = require('express')
|
||||||
|
const config = require('./config.json')
|
||||||
|
const cors = require('cors')
|
||||||
|
const { MongoClient, ObjectId } = require('mongodb')
|
||||||
|
const client = new MongoClient(config.mongodb)
|
||||||
|
|
||||||
|
const app = express()
|
||||||
|
const port = 3002
|
||||||
|
|
||||||
|
app.use(cors())
|
||||||
|
|
||||||
|
app.use(express.json())
|
||||||
|
app.use(function (req, res, next) {
|
||||||
|
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000')
|
||||||
|
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS')
|
||||||
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers')
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await client.connect()
|
||||||
|
}catch(err) {
|
||||||
|
return console.log(err);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
// require('./mongoControllers/scoreC')(app,client)
|
||||||
|
|
||||||
|
app.post('/m/score', async (req, res) =>{
|
||||||
|
const score = {
|
||||||
|
subject: req.body.subject,
|
||||||
|
value: req.body.value,
|
||||||
|
test_type: req.body.test_type,
|
||||||
|
record_book: req.body.record_book,
|
||||||
|
student: req.body.student,
|
||||||
|
teacher: req.body.teacher,
|
||||||
|
date: req.body.date
|
||||||
|
}
|
||||||
|
await client.db("labwork07").collection('score').insertOne(score,(err,result) => {
|
||||||
|
if(err) res.send({'error': 'An error has occurred'})
|
||||||
|
else res.send(result)
|
||||||
|
console.log(res)
|
||||||
|
console.log(res.ops[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/m/score', async (req, res) =>{
|
||||||
|
try{
|
||||||
|
const scores = await client.db("labwork07").collection('score').find({}).toArray()
|
||||||
|
res.send(scores)
|
||||||
|
}catch(err){
|
||||||
|
console.log(err)
|
||||||
|
res.sendStatus(500)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post('/m/score/mStudMarks', async (req, res) =>{
|
||||||
|
try{
|
||||||
|
const scores = await client.db("labwork07").collection('score').find({student: req.body.student}).toArray()
|
||||||
|
res.send(scores)
|
||||||
|
}catch(err){
|
||||||
|
console.log(err)
|
||||||
|
res.sendStatus(500)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete("/m/score/del/:id", async(req, res)=>{
|
||||||
|
try{
|
||||||
|
const result = await client.db("labwork07").collection('score').deleteOne({_id: new ObjectId(req.params.id)})
|
||||||
|
if(result.acknowledged) res.sendStatus(200)
|
||||||
|
else res.sendStatus(404)
|
||||||
|
}
|
||||||
|
catch(err){
|
||||||
|
console.log(err)
|
||||||
|
res.sendStatus(500)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put("/m/score/upd/:id", async(req, res)=>{
|
||||||
|
try{
|
||||||
|
const result = await client.db("labwork07").collection('score').updateOne({_id: new ObjectId(req.params.id)},{ $set: {
|
||||||
|
subject: req.body.subject,
|
||||||
|
value: req.body.value,
|
||||||
|
test_type: req.body.test_type,
|
||||||
|
record_book: req.body.record_book,
|
||||||
|
student: req.body.student,
|
||||||
|
teacher: req.body.teacher,
|
||||||
|
date: req.body.date
|
||||||
|
}})
|
||||||
|
if(result.acknowledged) res.sendStatus(200)
|
||||||
|
else res.sendStatus(404)
|
||||||
|
}
|
||||||
|
catch(err){
|
||||||
|
console.log(err)
|
||||||
|
res.sendStatus(500)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`app running on port ${port}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
// прослушиваем прерывание работы программы (ctrl-c)
|
||||||
|
process.on("SIGINT", async() => {
|
||||||
|
await client.close()
|
||||||
|
console.log("Приложение завершило работу")
|
||||||
|
process.exit()
|
||||||
|
});
|
5
all/node-postgres/mongoControllers/mainC.js
Normal file
5
all/node-postgres/mongoControllers/mainC.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const score = require('./scoreC')
|
||||||
|
|
||||||
|
module.exports = function(app, db){
|
||||||
|
score.all(app)
|
||||||
|
}
|
32
all/node-postgres/mongoControllers/scoreC.js
Normal file
32
all/node-postgres/mongoControllers/scoreC.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const config = require('../config.json')
|
||||||
|
const { MongoClient } = require('mongodb')
|
||||||
|
|
||||||
|
module.exports = function(app, client){
|
||||||
|
app.post('/m/score', async (req, res) =>{
|
||||||
|
|
||||||
|
const score = {
|
||||||
|
subject: req.body.subject,
|
||||||
|
value: req.body.value,
|
||||||
|
test_type: req.body.test_type,
|
||||||
|
record_book: req.body.record_book,
|
||||||
|
student: req.body.student,
|
||||||
|
teacher: req.body.teacher,
|
||||||
|
date: req.body.date
|
||||||
|
}
|
||||||
|
await client.db("labwork07").collection('score').insertOne(score,(err,result) => {
|
||||||
|
if(err) res.send({'error': 'An error has occurred'})
|
||||||
|
else res.send(result)
|
||||||
|
console.log(res)
|
||||||
|
console.log(res.ops[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/m/score', async (req, res) =>{
|
||||||
|
await client.db("labwork07").collection('score').find((err,result) => {
|
||||||
|
if(err) res.send({'error': 'An error has occurred'})
|
||||||
|
else res.send(result)
|
||||||
|
console.log(res)
|
||||||
|
console.log(res.ops[0])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
0
all/node-postgres/mongoControllers/scoreModel.js
Normal file
0
all/node-postgres/mongoControllers/scoreModel.js
Normal file
530
all/node-postgres/package-lock.json
generated
530
all/node-postgres/package-lock.json
generated
@ -11,9 +11,38 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
|
"mongodb": "^5.5.0",
|
||||||
"pg": "^8.10.0"
|
"pg": "^8.10.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^2.0.22"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "20.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.4.tgz",
|
||||||
|
"integrity": "sha512-At4pvmIOki8yuwLtd7BNHl3CiWNbtclUbNtScGx4OHfBd4/oWoJC8KRCIxXwkdndzhxOsPXihrsOoydxBjlE9Q=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/webidl-conversions": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-xTE1E+YF4aWPJJeUzaZI5DRntlkY3+BCVJi0axFptnjGmAoWxkyREIh/XMrfxVLejwQxMCfDXdICo0VLxThrog=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/whatwg-url": {
|
||||||
|
"version": "8.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
|
||||||
|
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"@types/webidl-conversions": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/abbrev": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/accepts": {
|
"node_modules/accepts": {
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||||
@ -26,11 +55,39 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/anymatch": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||||
|
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"picomatch": "^2.0.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/array-flatten": {
|
"node_modules/array-flatten": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/balanced-match": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/binary-extensions": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/body-parser": {
|
"node_modules/body-parser": {
|
||||||
"version": "1.20.1",
|
"version": "1.20.1",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
||||||
@ -54,6 +111,36 @@
|
|||||||
"npm": "1.2.8000 || >= 1.4.16"
|
"npm": "1.2.8000 || >= 1.4.16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/brace-expansion": {
|
||||||
|
"version": "1.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/braces": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"fill-range": "^7.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/bson": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bson/-/bson-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.20.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/buffer-writer": {
|
"node_modules/buffer-writer": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
||||||
@ -82,6 +169,39 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chokidar": {
|
||||||
|
"version": "3.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||||
|
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"anymatch": "~3.1.2",
|
||||||
|
"braces": "~3.0.2",
|
||||||
|
"glob-parent": "~5.1.2",
|
||||||
|
"is-binary-path": "~2.1.0",
|
||||||
|
"is-glob": "~4.0.1",
|
||||||
|
"normalize-path": "~3.0.0",
|
||||||
|
"readdirp": "~3.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.10.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/concat-map": {
|
||||||
|
"version": "0.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
|
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/content-disposition": {
|
"node_modules/content-disposition": {
|
||||||
"version": "0.5.4",
|
"version": "0.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||||
@ -218,6 +338,18 @@
|
|||||||
"node": ">= 0.10.0"
|
"node": ">= 0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fill-range": {
|
||||||
|
"version": "7.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||||
|
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"to-regex-range": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/finalhandler": {
|
"node_modules/finalhandler": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
|
||||||
@ -251,6 +383,20 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fsevents": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/function-bind": {
|
"node_modules/function-bind": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||||
@ -269,6 +415,18 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/glob-parent": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-glob": "^4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/has": {
|
"node_modules/has": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||||
@ -280,6 +438,15 @@
|
|||||||
"node": ">= 0.4.0"
|
"node": ">= 0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/has-flag": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/has-symbols": {
|
"node_modules/has-symbols": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||||
@ -317,11 +484,22 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ignore-by-default": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/ip": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ=="
|
||||||
|
},
|
||||||
"node_modules/ipaddr.js": {
|
"node_modules/ipaddr.js": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
@ -330,6 +508,48 @@
|
|||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-binary-path": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"binary-extensions": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-extglob": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-glob": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-extglob": "^2.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-number": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/media-typer": {
|
"node_modules/media-typer": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
@ -338,6 +558,12 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/memory-pager": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"node_modules/merge-descriptors": {
|
"node_modules/merge-descriptors": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||||
@ -381,6 +607,59 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/minimatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mongodb": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-XgrkUgAAdfnZKQfk5AsYL8j7O99WHd4YXPxYxnh8dZxD+ekYWFRA3JktUsBnfg+455Smf75/+asoU/YLwNGoQQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"bson": "^5.3.0",
|
||||||
|
"mongodb-connection-string-url": "^2.6.0",
|
||||||
|
"socks": "^2.7.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.20.1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"saslprep": "^1.0.3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@aws-sdk/credential-providers": "^3.201.0",
|
||||||
|
"mongodb-client-encryption": ">=2.3.0 <3",
|
||||||
|
"snappy": "^7.2.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@aws-sdk/credential-providers": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"mongodb-client-encryption": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"snappy": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mongodb-connection-string-url": {
|
||||||
|
"version": "2.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
|
||||||
|
"integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/whatwg-url": "^8.2.1",
|
||||||
|
"whatwg-url": "^11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
@ -394,6 +673,73 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nodemon": {
|
||||||
|
"version": "2.0.22",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz",
|
||||||
|
"integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"chokidar": "^3.5.2",
|
||||||
|
"debug": "^3.2.7",
|
||||||
|
"ignore-by-default": "^1.0.1",
|
||||||
|
"minimatch": "^3.1.2",
|
||||||
|
"pstree.remy": "^1.1.8",
|
||||||
|
"semver": "^5.7.1",
|
||||||
|
"simple-update-notifier": "^1.0.7",
|
||||||
|
"supports-color": "^5.5.0",
|
||||||
|
"touch": "^3.1.0",
|
||||||
|
"undefsafe": "^2.0.5"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"nodemon": "bin/nodemon.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/nodemon"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nodemon/node_modules/debug": {
|
||||||
|
"version": "3.2.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||||
|
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nodemon/node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/nopt": {
|
||||||
|
"version": "1.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
|
||||||
|
"integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"abbrev": "1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"nopt": "bin/nopt.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/normalize-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/object-assign": {
|
"node_modules/object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
@ -513,6 +859,18 @@
|
|||||||
"split2": "^4.1.0"
|
"split2": "^4.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/picomatch": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/postgres-array": {
|
"node_modules/postgres-array": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||||
@ -560,6 +918,20 @@
|
|||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pstree.remy": {
|
||||||
|
"version": "1.1.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
|
||||||
|
"integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/punycode": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.11.0",
|
"version": "6.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
||||||
@ -596,6 +968,18 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/readdirp": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"picomatch": "^2.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/safe-buffer": {
|
"node_modules/safe-buffer": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
@ -620,6 +1004,27 @@
|
|||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/saslprep": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"sparse-bitfield": "^3.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/semver": {
|
||||||
|
"version": "5.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||||
|
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/send": {
|
"node_modules/send": {
|
||||||
"version": "0.18.0",
|
"version": "0.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
|
||||||
@ -680,6 +1085,58 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/simple-update-notifier": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"semver": "~7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/simple-update-notifier/node_modules/semver": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/smart-buffer": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/socks": {
|
||||||
|
"version": "2.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
|
||||||
|
"integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"ip": "^2.0.0",
|
||||||
|
"smart-buffer": "^4.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.13.0",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sparse-bitfield": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||||
|
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"memory-pager": "^1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/split2": {
|
"node_modules/split2": {
|
||||||
"version": "4.2.0",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||||
@ -696,6 +1153,30 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/supports-color": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/to-regex-range": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-number": "^7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/toidentifier": {
|
"node_modules/toidentifier": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||||
@ -704,6 +1185,29 @@
|
|||||||
"node": ">=0.6"
|
"node": ">=0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/touch": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"nopt": "~1.0.10"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"nodetouch": "bin/nodetouch.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tr46": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
|
||||||
|
"dependencies": {
|
||||||
|
"punycode": "^2.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/type-is": {
|
"node_modules/type-is": {
|
||||||
"version": "1.6.18",
|
"version": "1.6.18",
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||||
@ -716,6 +1220,12 @@
|
|||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/undefsafe": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/unpipe": {
|
"node_modules/unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
@ -740,6 +1250,26 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/webidl-conversions": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/whatwg-url": {
|
||||||
|
"version": "11.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
|
||||||
|
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"tr46": "^3.0.0",
|
||||||
|
"webidl-conversions": "^7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xtend": {
|
"node_modules/xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
@ -4,13 +4,18 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"dev": "nodemon server.js"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
|
"mongodb": "^5.5.0",
|
||||||
"pg": "^8.10.0"
|
"pg": "^8.10.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"nodemon": "^2.0.22"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
all/node-postgres/postgres.js
Normal file
28
all/node-postgres/postgres.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
const express = require('express')
|
||||||
|
const cors = require('cors')
|
||||||
|
|
||||||
|
const app = express()
|
||||||
|
const port = 3001
|
||||||
|
|
||||||
|
app.use(cors())
|
||||||
|
|
||||||
|
app.use(express.json())
|
||||||
|
app.use(function (req, res, next) {
|
||||||
|
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3000')
|
||||||
|
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS')
|
||||||
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers')
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
require('./postgresControllers/facultyC')(app)
|
||||||
|
require('./postgresControllers/directionC')(app)
|
||||||
|
require('./postgresControllers/scoreC')(app)
|
||||||
|
require('./postgresControllers/studentC')(app)
|
||||||
|
require('./postgresControllers/subjectC')(app)
|
||||||
|
require('./postgresControllers/teacherC')(app)
|
||||||
|
require('./postgresControllers/testC')(app)
|
||||||
|
|
||||||
|
|
||||||
|
app.listen(port, () => {
|
||||||
|
console.log(`app running on port ${port}`)
|
||||||
|
})
|
33
all/node-postgres/postgresControllers/directionC.js
Normal file
33
all/node-postgres/postgresControllers/directionC.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const direction = require('../models/direction')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/direction', (req, res) => {
|
||||||
|
direction.create(req.body.name, req.body.faculty_id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/direction/tests', (req, res) => {
|
||||||
|
direction.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/direction', (req, res) => {
|
||||||
|
direction.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/direction/del/:id', (req, res) => {
|
||||||
|
direction.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/direction/upd/:id', (req, res) => {
|
||||||
|
direction.update(req.params.id, req.body.name, req.body.facultyId)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
39
all/node-postgres/postgresControllers/facultyC.js
Normal file
39
all/node-postgres/postgresControllers/facultyC.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
const faculty = require('../models/faculty')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/faculty', (req, res) => {
|
||||||
|
faculty.create(req.body.name)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/faculty/tests', (req, res) => {
|
||||||
|
faculty.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/faculty', (req, res) => {
|
||||||
|
faculty.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/faculty/directions/:id', (req, res) => {
|
||||||
|
faculty.getDirections(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/faculty/del/:id', (req, res) => {
|
||||||
|
faculty.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/faculty/upd/:id', (req, res) => {
|
||||||
|
faculty.update(req.params.id, req.body.name)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
39
all/node-postgres/postgresControllers/scoreC.js
Normal file
39
all/node-postgres/postgresControllers/scoreC.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
const score = require('../models/score')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/score', (req, res) => {
|
||||||
|
score.create(req.body.value, req.body.subject_id, req.body.test_type_id, req.body.teacher_id, req.body.student_id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/score/tests', (req, res) => {
|
||||||
|
score.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/score', (req, res) => {
|
||||||
|
score.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/score/del/:id', (req, res) => {
|
||||||
|
score.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/score/upd/:id', (req, res) => {
|
||||||
|
score.update(req.params.id, req.body.value, req.body.subject_id, req.body.test_type_id, req.body.teacher_id, req.body.student_id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/score/studMarks/:id', (req, res) => {
|
||||||
|
score.getStudentMarks(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
37
all/node-postgres/postgresControllers/studentC.js
Normal file
37
all/node-postgres/postgresControllers/studentC.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
const student = require('../models/student')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/student', (req, res) => {
|
||||||
|
student.create(req.body.name, req.body.surname, req.body.record_book, req.body.direction_id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/student/tests', (req, res) => {
|
||||||
|
student.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post('/student/test', (req, res) => {
|
||||||
|
student.createTest()
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/student', (req, res) => {
|
||||||
|
student.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/student/del/:id', (req, res) => {
|
||||||
|
student.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/student/upd/:id', (req, res) => {
|
||||||
|
student.update(req.params.id, req.body.name, req.body.surname, req.body.record_book, req.body.direction_id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
33
all/node-postgres/postgresControllers/subjectC.js
Normal file
33
all/node-postgres/postgresControllers/subjectC.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const subject = require('../models/subject')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/subject', (req, res) => {
|
||||||
|
subject.create(req.body.name, req.body.hours_count)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/subject/tests', (req, res) => {
|
||||||
|
subject.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/subject', (req, res) => {
|
||||||
|
subject.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/subject/del/:id', (req, res) => {
|
||||||
|
subject.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/subject/upd/:id', (req, res) => {
|
||||||
|
subject.update(req.params.id, req.body.name, req.body.hours_count)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
33
all/node-postgres/postgresControllers/teacherC.js
Normal file
33
all/node-postgres/postgresControllers/teacherC.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const teacher = require('../models/teacher')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/teacher', (req, res) => {
|
||||||
|
teacher.create(req.body.name, req.body.surname,req.body.post)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/teacher/tests', (req, res) => {
|
||||||
|
teacher.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/teacher', (req, res) => {
|
||||||
|
teacher.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/teacher/del/:id', (req, res) => {
|
||||||
|
teacher.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/teacher/upd/:id', (req, res) => {
|
||||||
|
teacher.update(req.params.id, req.body.name, req.body.surname,req.body.post)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
33
all/node-postgres/postgresControllers/testC.js
Normal file
33
all/node-postgres/postgresControllers/testC.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const test = require('../models/test')
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.post('/test', (req, res) => {
|
||||||
|
test.create(req.body.name)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/test/tests', (req, res) => {
|
||||||
|
test.timeTests()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get('/test', (req, res) => {
|
||||||
|
test.get()
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.delete('/test/del/:id', (req, res) => {
|
||||||
|
test.del(req.params.id)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
|
||||||
|
app.put('/test/upd/:id', (req, res) => {
|
||||||
|
test.update(req.params.id, req.body.name)
|
||||||
|
.then(response => res.status(200).send(response))
|
||||||
|
.catch(error => res.status(500).send(error))
|
||||||
|
})
|
||||||
|
}
|
4
all/react-postgres/src/App.js
vendored
4
all/react-postgres/src/App.js
vendored
@ -11,6 +11,8 @@ import ScorePage from './pages/ScorePage';
|
|||||||
import StudentMarks from './reports/StudentMarks';
|
import StudentMarks from './reports/StudentMarks';
|
||||||
import FacultyDirections from './reports/FacultyDirections';
|
import FacultyDirections from './reports/FacultyDirections';
|
||||||
import Tests from './tests/Test';
|
import Tests from './tests/Test';
|
||||||
|
import MScorePage from './pages/MScorePage';
|
||||||
|
import MStudentMarks from './reports/MStudentsMarks';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
@ -28,6 +30,8 @@ function App() {
|
|||||||
<Route path="/studMarks" element={<StudentMarks/>} />
|
<Route path="/studMarks" element={<StudentMarks/>} />
|
||||||
<Route path="/fDir" element={<FacultyDirections/>} />
|
<Route path="/fDir" element={<FacultyDirections/>} />
|
||||||
<Route path="/tests" element={<Tests/>} />
|
<Route path="/tests" element={<Tests/>} />
|
||||||
|
<Route path="/mscore" element={<MScorePage/>} />
|
||||||
|
<Route path="/mStudMarks" element={<MStudentMarks/>} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -72,6 +72,18 @@ export default function Header() {
|
|||||||
TESTS
|
TESTS
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li className="nav-item">
|
||||||
|
<Link className="nav-link" to="/mscore">
|
||||||
|
MONGO SCORE
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li className="nav-item">
|
||||||
|
<Link className="nav-link" to="/mStudMarks">
|
||||||
|
MONGO STUDENT MARKS
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
48
all/react-postgres/src/common/Service.js
vendored
48
all/react-postgres/src/common/Service.js
vendored
@ -7,12 +7,30 @@ export default class Service{
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async getM(url){
|
||||||
|
const response = await fetch(url)
|
||||||
|
const res = response.json()
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
static async getStudMarks(url, id){
|
static async getStudMarks(url, id){
|
||||||
const response = await fetch(`${this.mainUrl}${url}/studMarks/${id}`)
|
const response = await fetch(`${this.mainUrl}${url}/studMarks/${id}`)
|
||||||
const res = response.json()
|
const res = response.json()
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async getMStudMarks(url, student){
|
||||||
|
const response = await fetch(`${url}/mStudMarks`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({student})
|
||||||
|
})
|
||||||
|
const res = response.json()
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
static async getFacultyDirections(url, id){
|
static async getFacultyDirections(url, id){
|
||||||
const response = await fetch(`${this.mainUrl}${url}/directions/${id}`)
|
const response = await fetch(`${this.mainUrl}${url}/directions/${id}`)
|
||||||
const res = response.json()
|
const res = response.json()
|
||||||
@ -40,6 +58,17 @@ export default class Service{
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async postM(url, item){
|
||||||
|
await fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(item)
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
static async upd(url, item){
|
static async upd(url, item){
|
||||||
await fetch(`${this.mainUrl}${url}/upd/${item.id}`, {
|
await fetch(`${this.mainUrl}${url}/upd/${item.id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
@ -51,10 +80,29 @@ export default class Service{
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async updM(url, item){
|
||||||
|
console.log(item)
|
||||||
|
await fetch(`${url}/upd/${item._id}`, {
|
||||||
|
method: 'PUT',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(item)
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
static async del(url, id){
|
static async del(url, id){
|
||||||
await fetch(`${this.mainUrl}${url}/del/${id}`, {
|
await fetch(`${this.mainUrl}${url}/del/${id}`, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async delM(url, id){
|
||||||
|
await fetch(`${url}/del/${id}`, {
|
||||||
|
method: 'DELETE'
|
||||||
|
})
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
12
all/react-postgres/src/models/MScore.js
vendored
Normal file
12
all/react-postgres/src/models/MScore.js
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export default class MScore {
|
||||||
|
constructor(data) {
|
||||||
|
this._id = data?._id
|
||||||
|
this.subject = data?.subject
|
||||||
|
this.value = data?.value
|
||||||
|
this.test_type = data?.test_type
|
||||||
|
this.record_book = data?.record_book
|
||||||
|
this.student = data?.student
|
||||||
|
this.teacher = data?.teacher
|
||||||
|
this.date = data?.date
|
||||||
|
}
|
||||||
|
}
|
167
all/react-postgres/src/pages/MScorePage.jsx
Normal file
167
all/react-postgres/src/pages/MScorePage.jsx
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
import React, {useState, useEffect} from 'react';
|
||||||
|
import Modal from '../common/Modal';
|
||||||
|
import Score from '../models/MScore';
|
||||||
|
import Service from '../common/Service';
|
||||||
|
|
||||||
|
|
||||||
|
export default function MScorePage() {
|
||||||
|
const url = 'http://localhost:3002/m/score'
|
||||||
|
|
||||||
|
const [items, setItems] = useState([])
|
||||||
|
const [item, setItem] = useState(new Score())
|
||||||
|
|
||||||
|
const [modalHeader, setModalHeader] = useState('')
|
||||||
|
const [modalConfirm, setModalConfirm] = useState('')
|
||||||
|
const [modalVisible, setModalVisible] = useState(false)
|
||||||
|
const [isEdit, setEdit] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
get()
|
||||||
|
//eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
function save(){
|
||||||
|
if(isEdit) upd()
|
||||||
|
else create()
|
||||||
|
get()
|
||||||
|
}
|
||||||
|
|
||||||
|
function get(){
|
||||||
|
Service.getM(url)
|
||||||
|
.then(data => setItems(data))
|
||||||
|
}
|
||||||
|
|
||||||
|
function create(){
|
||||||
|
Service.postM(url, item)
|
||||||
|
.then(() => get())
|
||||||
|
}
|
||||||
|
|
||||||
|
function upd(){
|
||||||
|
Service.updM(url, item)
|
||||||
|
.then(() => get())
|
||||||
|
}
|
||||||
|
|
||||||
|
function del(id){
|
||||||
|
console.log(id)
|
||||||
|
Service.delM(url, id)
|
||||||
|
.then(() => get())
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCreate(){
|
||||||
|
setEdit(false)
|
||||||
|
setModalHeader('Create');
|
||||||
|
setModalConfirm('Add');
|
||||||
|
setModalVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFormChange(event) {
|
||||||
|
setItem(prevState => ({ ...prevState, [event.target.id]: event.target.value }))
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(data){
|
||||||
|
setItem(data)
|
||||||
|
setEdit(true)
|
||||||
|
setModalHeader('Update');
|
||||||
|
setModalConfirm('Save');
|
||||||
|
setModalVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const hideModal = () => setModalVisible(false)
|
||||||
|
const modalDone = () => save()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Modal
|
||||||
|
header={modalHeader}
|
||||||
|
confirm={modalConfirm}
|
||||||
|
visible={modalVisible}
|
||||||
|
onHide={hideModal}
|
||||||
|
onDone={modalDone}>
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="subject" className="form-label">subject</label>
|
||||||
|
<input type="text" id="subject" className="form-control" required
|
||||||
|
value={item.subject} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="value" className="form-label">Value</label>
|
||||||
|
<input type="text" id="value" className="form-control" required
|
||||||
|
value={item.value} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="test_type" className="form-label">test_type</label>
|
||||||
|
<input type="text" id="test_type" className="form-control" required
|
||||||
|
value={item.test_type} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="record_book" className="form-label">record_book</label>
|
||||||
|
<input type="text" id="record_book" className="form-control" required
|
||||||
|
value={item.record_book} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="student" className="form-label">student</label>
|
||||||
|
<input type="text" id="student" className="form-control" required
|
||||||
|
value={item.student} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="teacher" className="form-label">teacher</label>
|
||||||
|
<input type="text" id="teacher" className="form-control" required
|
||||||
|
value={item.teacher} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="date" className="form-label">date</label>
|
||||||
|
<input type="date" id="date" className="form-control" required
|
||||||
|
value={item.date} onChange={handleFormChange}/>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<div className='container'>
|
||||||
|
<button type="button" className="btn btn-success" onClick={handleCreate}>Create</button>
|
||||||
|
|
||||||
|
<table className='table'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">subject</th>
|
||||||
|
<th scope="col">value</th>
|
||||||
|
<th scope="col">test_type</th>
|
||||||
|
<th scope="col">record_book</th>
|
||||||
|
<th scope="col">student</th>
|
||||||
|
<th scope="col">teacher</th>
|
||||||
|
<th scope="col">date</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
items.map((data, index) =>
|
||||||
|
<tr key={data._id}>
|
||||||
|
<th scope="row">{index + 1}</th>
|
||||||
|
<td>{data.subject}</td>
|
||||||
|
<td>{data.value}</td>
|
||||||
|
<td>{data.test_type}</td>
|
||||||
|
<td>{data.record_book}</td>
|
||||||
|
<td>{data.student}</td>
|
||||||
|
<td>{data.teacher}</td>
|
||||||
|
<td>{data.date}</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<button type="button" className="btn btn-warning" onClick={() => handleEdit(data)}>Edit</button>
|
||||||
|
<button type="button" className="btn btn-danger" onClick={() => del(data._id)}>Delete</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
82
all/react-postgres/src/reports/MStudentsMarks.jsx
Normal file
82
all/react-postgres/src/reports/MStudentsMarks.jsx
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import React, {useState, useEffect} from 'react';
|
||||||
|
import Student from '../models/Student';
|
||||||
|
import Service from '../common/Service';
|
||||||
|
|
||||||
|
export default function MStudentMarks() {
|
||||||
|
const url = 'http://localhost:3002/m/score'
|
||||||
|
|
||||||
|
const [items, setItems] = useState([])
|
||||||
|
const [item, setItem] = useState('')
|
||||||
|
|
||||||
|
const [students, setStudents] = useState([])
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
get()
|
||||||
|
//eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
function get(){
|
||||||
|
let studs = []
|
||||||
|
Service.getM(url)
|
||||||
|
.then(data => {
|
||||||
|
console.log(data)
|
||||||
|
setStudents([])
|
||||||
|
data.map(item => setStudents(prevState => [...prevState, item.student]))})
|
||||||
|
console.log(students)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleGetReport(){
|
||||||
|
Service.getMStudMarks(url, item)
|
||||||
|
.then(data => setItems(data))
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFormChange(event) {
|
||||||
|
setItem(event.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className='container'>
|
||||||
|
<div className="mb-3">
|
||||||
|
<p className="h4" htmlFor="id">Student:</p>
|
||||||
|
<select id="id" className="form-select " required
|
||||||
|
value={item} onChange={handleFormChange}>
|
||||||
|
<option disabled value="">select</option>
|
||||||
|
{
|
||||||
|
students.map((student, index) =>
|
||||||
|
<option key={student + index} >{student}</option>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<button type="button" className="btn btn-success" onClick={handleGetReport}>Get</button>
|
||||||
|
<table className='table'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">test type</th>
|
||||||
|
<th scope="col">value</th>
|
||||||
|
<th scope="col">subject</th>
|
||||||
|
<th scope="col">teacher</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
items.map((data, index) =>
|
||||||
|
<tr key={data.id}>
|
||||||
|
<th scope="row">{index + 1}</th>
|
||||||
|
<td>{data.test_type}</td>
|
||||||
|
<td>{data.value}</td>
|
||||||
|
<td>{data.subject}</td>
|
||||||
|
<td>{data.teacher}</td>
|
||||||
|
</tr>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user