Compare commits

...

3 Commits

33 changed files with 18324 additions and 0 deletions

23
abitur_list_client/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,19 @@
# abitur_list_client
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

View File

@ -0,0 +1,32 @@
const db = require('../db')
const AbiturControllerInterface = require('./interfaces/abitur.controller.interface')
class AbiturController extends AbiturControllerInterface{
async createAbitur(req, res) {
const {first_name, last_name, middle_name} = req.body
const newAbitur = await db.query('INSERT INTO abitur (first_name, last_name, middle_name) VALUES ($1, $2, $3) RETURNING *', [first_name, last_name, middle_name])
res.json(newAbitur.rows[0])
}
async getAbiturs(req, res) {
const abiturs = await db.query('SELECT * FROM abitur')
res.json(abiturs.rows)
}
async getOneAbitur(req, res) {
const id = req.params.id
const abiturs = await db.query('SELECT * FROM abitur WHERE id=$1', [id])
res.json(abiturs.rows[0])
}
async updateAbitur(req, res) {
const {id, first_name, last_name, middle_name} = req.body
const newAbitur = await db.query('UPDATE abitur SET first_name=$1, last_name=$2, middle_name=$3 WHERE id=$4 RETURNING *', [first_name, last_name, middle_name, id])
res.json(newAbitur.rows[0])
}
async deleteAbitur(req, res) {
const id = req.params.id
const abiturs = await db.query('DELETE FROM abitur WHERE id=$1', [id])
res.json(abiturs.rows[0])
}
}
module.exports = new AbiturController()

View File

@ -0,0 +1,32 @@
const db = require('../db')
const EducationFormControllerInterface = require('./interfaces/educationform.controller.interface')
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)
}
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()

View File

@ -0,0 +1,32 @@
const db = require('../db')
const EnrollmentControllerInterface = require('./interfaces/enrollment.controller.interface')
class EnrollmentController extends EnrollmentControllerInterface {
async createEnrollment(req, res) {
const {request_id} = req.body
const newEnrollment = await db.query('INSERT INTO enrollment (request_id, date) VALUES ($1, $2) RETURNING *', [request_id, new Date()])
res.json(newEnrollment.rows[0])
}
async getEnrollments(req, res) {
const enrollments = await db.query('SELECT * FROM enrollment')
res.json(enrollments.rows)
}
async getOneEnrollment(req, res) {
const id = req.params.id
const enrollments = await db.query('SELECT * FROM enrollment WHERE id=$1', [id])
res.json(enrollments.rows[0])
}
async updateEnrollment(req, res) {
const {id, request_id, date} = req.body
const newEnrollment = await db.query('UPDATE enrollment SET request_id=$1, date=$2 WHERE id=$3 RETURNING *', [request_id, date, id])
res.json(newEnrollment.rows[0])
}
async deleteEnrollment(req, res) {
const id = req.params.id
const enrollments = await db.query('DELETE FROM enrollment WHERE id=$1', [id])
res.json(enrollments.rows[0])
}
}
module.exports = new EnrollmentController()

View File

@ -0,0 +1,32 @@
const db = require('../db')
const ExamResultControllerInterface = require('./interfaces/examresult.controller.interface')
class ExamResultController extends ExamResultControllerInterface {
async createExamResult(req, res) {
const {title, result, abitur_id} = req.body
const newExamResult = await db.query('INSERT INTO exam_result (title, result, abitur_id) VALUES ($1, $2, $3) RETURNING *', [title, result, abitur_id])
res.json(newExamResult.rows[0])
}
async getExamResults(req, res) {
const results = await db.query('SELECT * FROM exam_result')
res.json(results.rows)
}
async getOneExamResult(req, res) {
const id = req.params.id
const results = await db.query('SELECT * FROM exam_result WHERE id=$1', [id])
res.json(results.rows[0])
}
async updateExamResult(req, res) {
const {id, title, result} = req.body
const newExamResult = await db.query('UPDATE exam_result SET title=$1, result=$2 WHERE id=$3 RETURNING *', [title, result, id])
res.json(newExamResult.rows[0])
}
async deleteExamResult(req, res) {
const id = req.params.id
const results = await db.query('DELETE FROM exam_result WHERE id=$1', [id])
res.json(results.rows[0])
}
}
module.exports = new ExamResultController()

View File

@ -0,0 +1,12 @@
module.exports = class AbiturControllerInterface {
async createAbitur(req, res) {
}
async getAbiturs(req, res) {
}
async getOneAbitur(req, res) {
}
async updateAbitur(req, res) {
}
async deleteAbitur(req, res) {
}
}

View File

@ -0,0 +1,12 @@
module.exports = class EducationFormControllerInterface {
async createEducationForm(req, res) {
}
async getEducationForms(req, res) {
}
async getOneEducationForm(req, res) {
}
async updateEducationForm(req, res) {
}
async deleteEducationForm(req, res) {
}
}

View File

@ -0,0 +1,12 @@
module.exports = class EnrollmentControllerInterface {
async createEnrollment(req, res) {
}
async getEnrollments(req, res) {
}
async getOneEnrollment(req, res) {
}
async updateEnrollment(req, res) {
}
async deleteEnrollment(req, res) {
}
}

View File

@ -0,0 +1,12 @@
module.exports = class ExamResultControllerInterface {
async createExamResult(req, res) {
}
async getExamResults(req, res) {
}
async getOneExamResult(req, res) {
}
async updateExamResult(req, res) {
}
async deleteExamResult(req, res) {
}
}

View File

@ -0,0 +1,12 @@
module.exports = class RequestControllerInterface {
async createRequest(req, res) {
}
async getRequests(req, res) {
}
async getOneRequest(req, res) {
}
async updateRequest(req, res) {
}
async deleteRequest(req, res) {
}
}

View File

@ -0,0 +1,8 @@
module.exports = class Request_ExamResultControllerInterface {
async createRecord(req, res) {
}
async getRecords(req, res) {
}
async deleteRecord(req, res) {
}
}

View File

@ -0,0 +1,12 @@
module.exports = class SpecializationControllerInterface {
async createSpecialization(req, res) {
}
async getSpecializations(req, res) {
}
async getOneSpecialization(req, res) {
}
async updateSpecialization(req, res) {
}
async deleteSpecialization(req, res) {
}
}

View File

@ -0,0 +1,32 @@
const db = require('../db')
const RequestControllerInterface = require('./interfaces/request.controller.interface')
class RequestController extends RequestControllerInterface {
async createRequest(req, res) {
const {abitur_id, education_form_id, specialization_id} = req.body
const newRequest = await db.query('INSERT INTO request (abitur_id, education_form_id, specialization_id, date) VALUES ($1, $2, $3, $4) RETURNING *', [abitur_id, education_form_id, specialization_id, new Date()])
res.json(newRequest.rows[0])
}
async getRequests(req, res) {
const requests = await db.query('SELECT * FROM request')
res.json(requests.rows)
}
async getOneRequest(req, res) {
const id = req.params.id
const requests = await db.query('SELECT * FROM request WHERE id=$1', [id])
res.json(requests.rows[0])
}
async updateRequest(req, res) {
const {id, education_form_id, specialization_id, date} = req.body
const newRequest = await db.query('UPDATE request SET education_form_id=$1, specialization_id=$2, date=$3 WHERE id=$4 RETURNING *', [education_form_id, specialization_id, date, id])
res.json(newRequest.rows[0])
}
async deleteRequest(req, res) {
const id = req.params.id
const requests = await db.query('DELETE FROM request WHERE id=$1', [id])
res.json(requests.rows[0])
}
}
module.exports = new RequestController()

View File

@ -0,0 +1,23 @@
const db = require('../db')
const Request_ExamResultControllerInterface = require('./interfaces/request_examresult.controller.interface')
class Request_ExamResultController extends Request_ExamResultControllerInterface {
async createRecord(req, res) {
const {request_id, exam_result_id} = req.body
const newRecord = await db.query('INSERT INTO request_exam_result (request_id, exam_result_id) VALUES ($1, $2) RETURNING *', [request_id, exam_result_id])
res.json(newRecord.rows[0])
}
async getRecords(req, res) {
const id = req.params.id
const records = await db.query('SELECT * FROM request_exam_result WHERE request_id=$1', [id])
res.json(records.rows)
}
async deleteRecord(req, res) {
const {request_id, exam_result_id} = req.body
const records = await db.query('DELETE FROM request_exam_result WHERE request_id=$1 AND exam_result_id=$2', [request_id, exam_result_id])
res.json(records.rows[0])
}
}
module.exports = new Request_ExamResultController()

View File

@ -0,0 +1,32 @@
const db = require('../db')
const SpecializationControllerInterface = require('./interfaces/specialization.controller.interface')
class SpecializationController extends SpecializationControllerInterface {
async createSpecialization(req, res) {
const {title} = req.body
const newSpecialization = await db.query('INSERT INTO specialization (title) VALUES ($1) RETURNING *', [title])
res.json(newSpecialization.rows[0])
}
async getSpecializations(req, res) {
const specializations = await db.query('SELECT * FROM specialization')
res.json(specializations.rows)
}
async getOneSpecialization(req, res) {
const id = req.params.id
const specializations = await db.query('SELECT * FROM specialization WHERE id=$1', [id])
res.json(specializations.rows[0])
}
async updateSpecialization(req, res) {
const {id, title} = req.body
const newSpecialization = await db.query('UPDATE specialization SET title=$1 WHERE id=$2 RETURNING *', [title, id])
res.json(newSpecialization.rows[0])
}
async deleteSpecialization(req, res) {
const id = req.params.id
const specializations = await db.query('DELETE FROM specialization WHERE id=$1', [id])
res.json(specializations.rows[0])
}
}
module.exports = new SpecializationController()

11
abitur_list_client/db.js Normal file
View File

@ -0,0 +1,11 @@
const Pool = require('pg').Pool
const pool = new Pool({
user: 'postgres',
password: '123',
host: '192.168.56.101',
port: 5432,
database: 'labwork'
})
module.exports = pool

View File

@ -0,0 +1,25 @@
const express = require('express')
const abiturRouter = require('./routes/abitur.routes')
const examResultRouter = require('./routes/examresult.routes')
const specializationRouter = require('./routes/specialization.routes')
const educationFormRouter = require('./routes/educationform.routes')
const requestRouter = require('./routes/request.routes')
const request_examresultRouter = require('./routes/request_examresult.routes')
const enrollmentRouter = require('./routes/enrollment.routes')
const PORT = process.env.PORT || 8080
const app = express()
app.use(express.json())
app.use('/api', abiturRouter)
app.use('/api', examResultRouter)
app.use('/api', specializationRouter)
app.use('/api', educationFormRouter)
app.use('/api', requestRouter)
app.use('/api', request_examresultRouter)
app.use('/api', enrollmentRouter)
app.listen(PORT, () => console.log('server started on port ' + PORT))

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

17779
abitur_list_client/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
{
"name": "abitur_list_client",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"start": "nodemon index.js"
},
"dependencies": {
"core-js": "^3.8.3",
"express": "^4.18.2",
"pg": "^8.10.0",
"vue": "^3.2.13",
"vue-router": "^4.0.3",
"vuex": "^4.0.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"nodemon": "^2.0.22"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Список абитуриентов</title>
</head>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<body>
<div id="app"></div>
</body>
</html>

View File

@ -0,0 +1,12 @@
const Router = require('express')
const router = new Router()
const abiturController = require('../controllers/abitur.controller')
router.post('/abitur', abiturController.createAbitur)
router.get('/abitur', abiturController.getAbiturs)
router.get('/abitur/:id', abiturController.getOneAbitur)
router.put('/abitur', abiturController.updateAbitur)
router.delete('/abitur/:id', abiturController.deleteAbitur)
module.exports = router

View File

@ -0,0 +1,12 @@
const Router = require('express')
const router = new Router()
const educationformController = require('../controllers/educationform.controller')
router.post('/educationform', educationformController.createEducationForm)
router.get('/educationform', educationformController.getEducationForms)
router.get('/educationform/:id', educationformController.getOneEducationForm)
router.put('/educationform', educationformController.updateEducationForm)
router.delete('/educationform/:id', educationformController.deleteEducationForm)
module.exports = router

View File

@ -0,0 +1,12 @@
const Router = require('express')
const router = new Router()
const enrollmentController = require('../controllers/enrollment.controller')
router.post('/enrollment', enrollmentController.createEnrollment)
router.get('/enrollment', enrollmentController.getEnrollments)
router.get('/enrollment/:id', enrollmentController.getOneEnrollment)
router.put('/enrollment', enrollmentController.updateEnrollment)
router.delete('/enrollment/:id', enrollmentController.deleteEnrollment)
module.exports = router

View File

@ -0,0 +1,12 @@
const Router = require('express')
const router = new Router()
const examResultController = require('../controllers/examresult.controller')
router.post('/examresult', examResultController.createExamResult)
router.get('/examresult', examResultController.getExamResults)
router.get('/examresult/:id', examResultController.getOneExamResult)
router.put('/examresult', examResultController.updateExamResult)
router.delete('/examresult/:id', examResultController.deleteExamResult)
module.exports = router

View File

@ -0,0 +1,12 @@
const Router = require('express')
const router = new Router()
const requestController = require('../controllers/request.controller')
router.post('/request', requestController.createRequest)
router.get('/request', requestController.getRequests)
router.get('/request/:id', requestController.getRequests)
router.put('/request', requestController.updateRequest)
router.delete('/request/:id', requestController.deleteRequest)
module.exports = router

View File

@ -0,0 +1,10 @@
const Router = require('express')
const router = new Router()
const request_examresultController = require('../controllers/request_examresult.controller')
router.post('/request_examresult', request_examresultController.createRecord)
router.get('/request_examresult/:id', request_examresultController.getRecords)
router.delete('/request_examresult', request_examresultController.deleteRecord)
module.exports = router

View File

@ -0,0 +1,12 @@
const Router = require('express')
const router = new Router()
const specializationController = require('../controllers/specialization.controller')
router.post('/specialization', specializationController.createSpecialization)
router.get('/specialization', specializationController.getSpecializations)
router.get('/specialization/:id', specializationController.getOneSpecialization)
router.put('/specialization', specializationController.updateSpecialization)
router.delete('/specialization/:id', specializationController.deleteSpecialization)
module.exports = router

View File

@ -0,0 +1,13 @@
<template lang="">
<div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="">
</style>

View File

@ -0,0 +1,4 @@
import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')

View File

@ -0,0 +1,4 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})