Update prettier workflow (#64)
This commit is contained in:
parent
c097154a80
commit
9f634d719c
32 changed files with 1051 additions and 1106 deletions
22
.github/workflows/prettier.yml
vendored
22
.github/workflows/prettier.yml
vendored
|
@ -1,25 +1,17 @@
|
||||||
name: Continuous Integration
|
name: Prettier
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prettier:
|
prettier:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v2
|
||||||
uses: actions/checkout@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
# Make sure the actual branch is checked out when running on pull requests
|
node-version: 17
|
||||||
ref: ${{ github.head_ref }}
|
- run: npm install
|
||||||
# This is important to fetch the changes to the previous commit
|
- run: npm run prettier:check
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Prettify code
|
|
||||||
uses: creyD/prettier_action@v4.3
|
|
||||||
with:
|
|
||||||
# This part is also where you can pass other options, for example:
|
|
||||||
prettier_options: --check **/*
|
|
||||||
dry: True
|
|
||||||
|
|
17
.github/workflows/tests.yml
vendored
17
.github/workflows/tests.yml
vendored
|
@ -1,17 +0,0 @@
|
||||||
name: Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 17
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run test
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"esversion": 11
|
|
||||||
}
|
|
5
.prettierignore
Normal file
5
.prettierignore
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Dockerfile
|
||||||
|
LICENSE
|
||||||
|
fakelog.conf
|
||||||
|
fakelog.nginx
|
||||||
|
bin
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"trailingComma": "es5",
|
"trailingComma": "es5",
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"semi": false,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"printWidth": 120
|
"printWidth": 120
|
||||||
}
|
}
|
||||||
|
|
126
app.js
126
app.js
|
@ -1,98 +1,102 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const path = require('path')
|
const path = require('path');
|
||||||
const logger = require('morgan')
|
const logger = require('morgan');
|
||||||
const cookieParser = require('cookie-parser')
|
const cookieParser = require('cookie-parser');
|
||||||
const bodyParser = require('body-parser')
|
const bodyParser = require('body-parser');
|
||||||
const cors = require('cors')
|
const cors = require('cors');
|
||||||
const protocol = require('./src/utils/connection')
|
const protocol = require('./src/utils/connection');
|
||||||
// const favicon = require('serve-favicon');
|
// const favicon = require('serve-favicon');
|
||||||
|
|
||||||
const subdomain = require('express-subdomain')
|
const subdomain = require('express-subdomain');
|
||||||
const index = require('./src/routes/index')
|
const index = require('./src/routes/index');
|
||||||
const api = require('./src/routes/api')
|
const api = require('./src/routes/api');
|
||||||
const cufs = require('./src/routes/cufs')
|
const cufs = require('./src/routes/cufs');
|
||||||
const uonetplus = require('./src/routes/uonetplus')
|
const uonetplus = require('./src/routes/uonetplus');
|
||||||
const uonetplusOpiekun = require('./src/routes/uonetplus-opiekun')
|
const uonetplusOpiekun = require('./src/routes/uonetplus-opiekun');
|
||||||
const uonetplusUczen = require('./src/routes/uonetplus-uczen')
|
const uonetplusUczen = require('./src/routes/uonetplus-uczen');
|
||||||
const uonetplusUczenplus = require('./src/routes/uonetplus-uczenplus/index')
|
const uonetplusUczenplus = require('./src/routes/uonetplus-uczenplus/index');
|
||||||
const uonetplusUzytkownik = require('./src/routes/uonetplus-uzytkownik')
|
const uonetplusUzytkownik = require('./src/routes/uonetplus-uzytkownik');
|
||||||
const uonetplusWiadomosciplus = require('./src/routes/uonetplus-wiadomosciplus')
|
const uonetplusWiadomosciplus = require('./src/routes/uonetplus-wiadomosciplus');
|
||||||
|
|
||||||
const app = express()
|
const app = express();
|
||||||
|
|
||||||
// view engine setup
|
// view engine setup
|
||||||
app.set('views', path.join(__dirname, 'src/views'))
|
app.set('views', path.join(__dirname, 'src/views'));
|
||||||
app.set('view engine', 'pug')
|
app.set('view engine', 'pug');
|
||||||
|
|
||||||
// uncomment after placing your favicon in /public
|
// uncomment after placing your favicon in /public
|
||||||
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
||||||
app.use(logger('dev'))
|
app.use(logger('dev'));
|
||||||
app.use(bodyParser.json())
|
app.use(bodyParser.json());
|
||||||
app.use(bodyParser.urlencoded({ extended: false }))
|
app.use(bodyParser.urlencoded({ extended: false }));
|
||||||
app.use(cookieParser())
|
app.use(cookieParser());
|
||||||
app.use(express.static(path.join(__dirname, 'public')))
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
res.locals.userInfo = require('./data/api/ListaUczniow')[1]
|
res.locals.userInfo = require('./data/api/ListaUczniow')[1];
|
||||||
res.locals.uonetplusUrl = protocol(req) + '://' + req.get('host').replace('uonetplus-opiekun', 'uonetplus')
|
res.locals.uonetplusUrl = protocol(req) + '://' + req.get('host').replace('uonetplus-opiekun', 'uonetplus');
|
||||||
res.locals.currentHost = protocol(req) + '://' + req.get('host')
|
res.locals.currentHost = protocol(req) + '://' + req.get('host');
|
||||||
res.locals.proto = protocol(req)
|
res.locals.proto = protocol(req);
|
||||||
res.locals.host = req.get('host').replace(/(api|cufs|uonetplus|uonetplus-opiekun|uonetplus-uzytkownik)\./, '')
|
res.locals.host = req.get('host').replace(/(api|cufs|uonetplus|uonetplus-opiekun|uonetplus-uzytkownik)\./, '');
|
||||||
|
|
||||||
res.cookie('UonetPlus_ASP.NET_SessionId', '', {
|
res.cookie('UonetPlus_ASP.NET_SessionId', '', {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
domain: req.get('host'),
|
domain: req.get('host'),
|
||||||
})
|
});
|
||||||
res.cookie('ARR_DS_ARR301302', '', {
|
res.cookie('ARR_DS_ARR301302', '', {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
domain: req.get('host'),
|
domain: req.get('host'),
|
||||||
})
|
});
|
||||||
res.cookie('ARR_' + req.get('host'), '1234567891012131314151617181920212223242526272829303132333435363', {
|
res.cookie('ARR_' + req.get('host'), '1234567891012131314151617181920212223242526272829303132333435363', {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
domain: req.get('host'),
|
domain: req.get('host'),
|
||||||
})
|
});
|
||||||
next()
|
next();
|
||||||
})
|
});
|
||||||
|
|
||||||
const corsOpt = {
|
const corsOpt = {
|
||||||
origin: process.env.CORS_ALLOW_ORIGIN || '*',
|
origin: process.env.CORS_ALLOW_ORIGIN || '*',
|
||||||
}
|
};
|
||||||
app.use(cors(corsOpt))
|
app.use(cors(corsOpt));
|
||||||
app.options('*', cors(corsOpt))
|
app.options('*', cors(corsOpt));
|
||||||
|
|
||||||
app.set('subdomain offset', +process.env.SUBDOMAIN_OFFSET || 2)
|
app.set('subdomain offset', +process.env.SUBDOMAIN_OFFSET || 2);
|
||||||
app.use(subdomain('api', api))
|
app.use(subdomain('api', api));
|
||||||
app.use(subdomain('cufs', cufs))
|
app.use(subdomain('cufs', cufs));
|
||||||
app.use(subdomain('uonetplus', uonetplus))
|
app.use(subdomain('uonetplus', uonetplus));
|
||||||
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun.use('/powiatwulkanowy/123456', uonetplusOpiekun)))
|
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun.use('/powiatwulkanowy/123456', uonetplusOpiekun)));
|
||||||
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun.use('/powiatwulkanowy/123457', uonetplusOpiekun)))
|
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun.use('/powiatwulkanowy/123457', uonetplusOpiekun)));
|
||||||
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun.use('/powiatwulkanowy/123458', uonetplusOpiekun)))
|
app.use(subdomain('uonetplus-opiekun', uonetplusOpiekun.use('/powiatwulkanowy/123458', uonetplusOpiekun)));
|
||||||
app.use(subdomain('uonetplus-uczen', uonetplusUczen.use('/powiatwulkanowy/:customerSymbol', uonetplusUczen)))
|
app.use(subdomain('uonetplus-uczen', uonetplusUczen.use('/powiatwulkanowy/:customerSymbol', uonetplusUczen)));
|
||||||
app.use(subdomain('uonetplus-uczenplus', uonetplusUczenplus.use('/powiatwulkanowy/:customerSymbol', uonetplusUczenplus)))
|
app.use(
|
||||||
app.use(subdomain('uonetplus-uzytkownik', uonetplusUzytkownik.use('/powiatwulkanowy', uonetplusUzytkownik)))
|
subdomain('uonetplus-uczenplus', uonetplusUczenplus.use('/powiatwulkanowy/:customerSymbol', uonetplusUczenplus))
|
||||||
app.use(subdomain('uonetplus-wiadomosciplus', uonetplusWiadomosciplus.use('/powiatwulkanowy', uonetplusWiadomosciplus)))
|
);
|
||||||
app.use('/', index)
|
app.use(subdomain('uonetplus-uzytkownik', uonetplusUzytkownik.use('/powiatwulkanowy', uonetplusUzytkownik)));
|
||||||
|
app.use(
|
||||||
|
subdomain('uonetplus-wiadomosciplus', uonetplusWiadomosciplus.use('/powiatwulkanowy', uonetplusWiadomosciplus))
|
||||||
|
);
|
||||||
|
app.use('/', index);
|
||||||
|
|
||||||
// catch 404 and forward to error handler
|
// catch 404 and forward to error handler
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
const err = new Error('Not Found')
|
const err = new Error('Not Found');
|
||||||
err.status = 404
|
err.status = 404;
|
||||||
next(err)
|
next(err);
|
||||||
})
|
});
|
||||||
|
|
||||||
// error handler
|
// error handler
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
// set locals, only providing error in development
|
// set locals, only providing error in development
|
||||||
res.locals.message = err.message
|
res.locals.message = err.message;
|
||||||
res.locals.error = req.app.get('env') === 'development' ? err : {}
|
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||||
|
|
||||||
// render the error page
|
// render the error page
|
||||||
res.status(err.status || 500)
|
res.status(err.status || 500);
|
||||||
res.render('error')
|
res.render('error');
|
||||||
})
|
});
|
||||||
|
|
||||||
if (typeof PhusionPassenger !== 'undefined') {
|
if (typeof PhusionPassenger !== 'undefined') {
|
||||||
app.listen('passenger')
|
app.listen('passenger');
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app;
|
||||||
|
|
|
@ -9,10 +9,7 @@
|
||||||
"wartosc": 1
|
"wartosc": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 1],
|
||||||
0,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"razem": 1
|
"razem": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -23,10 +20,7 @@
|
||||||
"wartosc": 2
|
"wartosc": 2
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 2],
|
||||||
0,
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"razem": 2
|
"razem": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -37,10 +31,7 @@
|
||||||
"wartosc": 3
|
"wartosc": 3
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 3],
|
||||||
0,
|
|
||||||
3
|
|
||||||
],
|
|
||||||
"razem": 3
|
"razem": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,10 +42,7 @@
|
||||||
"wartosc": 6
|
"wartosc": 6
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 6],
|
||||||
0,
|
|
||||||
6
|
|
||||||
],
|
|
||||||
"razem": 6
|
"razem": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -65,10 +53,7 @@
|
||||||
"wartosc": 4
|
"wartosc": 4
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 4],
|
||||||
0,
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"razem": 4
|
"razem": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -79,10 +64,7 @@
|
||||||
"wartosc": 5
|
"wartosc": 5
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 5],
|
||||||
0,
|
|
||||||
5
|
|
||||||
],
|
|
||||||
"razem": 5
|
"razem": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -93,10 +75,7 @@
|
||||||
"wartosc": 2
|
"wartosc": 2
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"okresy": [
|
"okresy": [0, 2],
|
||||||
0,
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"razem": 2
|
"razem": 2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./bin/www & npm run scss",
|
"start": "node ./bin/www & npm run scss",
|
||||||
"watch": "nodemon ./bin/www & npm run scss",
|
"watch": "nodemon ./bin/www & npm run scss",
|
||||||
"test": "jshint src/ app.js --verbose",
|
|
||||||
"scss": "sass --watch public/stylesheets",
|
"scss": "sass --watch public/stylesheets",
|
||||||
"prettier": "prettier . --write"
|
"prettier:write": "prettier . --write",
|
||||||
|
"prettier:check": "prettier . --check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
"validate-polish": "^2.1.40"
|
"validate-polish": "^2.1.40"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jshint": "^2.13.6",
|
|
||||||
"nodemon": "^3.1.0"
|
"nodemon": "^3.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const router = require('express').Router()
|
const router = require('express').Router();
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
const { format } = require('date-fns')
|
const { format } = require('date-fns');
|
||||||
|
|
||||||
router.all('/', (req, res) => {
|
router.all('/', (req, res) => {
|
||||||
const today = format(new Date(), 'yyyy-MM-dd')
|
const today = format(new Date(), 'yyyy-MM-dd');
|
||||||
|
|
||||||
let base = protocol(req) + '://' + req.get('host')
|
let base = protocol(req) + '://' + req.get('host');
|
||||||
res.json({
|
res.json({
|
||||||
status: 'success',
|
status: 'success',
|
||||||
start: base.replace('api.', ''),
|
start: base.replace('api.', ''),
|
||||||
|
@ -41,26 +41,26 @@ router.all('/', (req, res) => {
|
||||||
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/WiadomosciUsuniete',
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/WiadomosciUsuniete',
|
||||||
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/DodajWiadomosc',
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/DodajWiadomosc',
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
// v3
|
// v3
|
||||||
router.use('/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart', require('./mobile-api/register'))
|
router.use('/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart', require('./mobile-api/register'));
|
||||||
router.use('/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen', require('./mobile-api/student'))
|
router.use('/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen', require('./mobile-api/student'));
|
||||||
router.use('/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen', require('./mobile-api/messages'))
|
router.use('/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen', require('./mobile-api/messages'));
|
||||||
router.use('/powiatwulkanowy/123456/mobile-api/Push.v1.Push', require('./mobile-api/push'))
|
router.use('/powiatwulkanowy/123456/mobile-api/Push.v1.Push', require('./mobile-api/push'));
|
||||||
|
|
||||||
// hebe
|
// hebe
|
||||||
router.use('/powiatwulkanowy/api/mobile/register', require('./api/register'))
|
router.use('/powiatwulkanowy/api/mobile/register', require('./api/register'));
|
||||||
router.use('/powiatwulkanowy/123456/api/mobile/register', require('./api/register'))
|
router.use('/powiatwulkanowy/123456/api/mobile/register', require('./api/register'));
|
||||||
router.use('/powiatwulkanowy/123456/api/mobile', require('./api/student'))
|
router.use('/powiatwulkanowy/123456/api/mobile', require('./api/student'));
|
||||||
router.use('/powiatwulkanowy/123456/api/mobile/school', require('./api/school'))
|
router.use('/powiatwulkanowy/123456/api/mobile/school', require('./api/school'));
|
||||||
|
|
||||||
router.all('/*', (req, res) => {
|
router.all('/*', (req, res) => {
|
||||||
res.status(404).json({
|
res.status(404).json({
|
||||||
status: 'error',
|
status: 'error',
|
||||||
message: 'Not implemented yet',
|
message: 'Not implemented yet',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const protocol = require('../../utils/connection')
|
const protocol = require('../../utils/connection');
|
||||||
const { createEnvelope } = require('./utils')
|
const { createEnvelope } = require('./utils');
|
||||||
|
|
||||||
router.all('/new', (req, res) => {
|
router.all('/new', (req, res) => {
|
||||||
const base = protocol(req) + '://' + req.get('host')
|
const base = protocol(req) + '://' + req.get('host');
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
createEnvelope(0, 'OK', 'AccountPayload', {
|
createEnvelope(0, 'OK', 'AccountPayload', {
|
||||||
|
@ -12,8 +12,8 @@ router.all('/new', (req, res) => {
|
||||||
UserLogin: 'jan@fakelog.cf',
|
UserLogin: 'jan@fakelog.cf',
|
||||||
UserName: 'jan@fakelog.cf',
|
UserName: 'jan@fakelog.cf',
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/hebe', (req, res) => {
|
router.all('/hebe', (req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -223,7 +223,7 @@ router.all('/hebe', (req, res) => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const { createEnvelope } = require('./utils')
|
const { createEnvelope } = require('./utils');
|
||||||
const { format } = require('date-fns')
|
const { format } = require('date-fns');
|
||||||
const { uuid } = require('uuidv4')
|
const { uuid } = require('uuidv4');
|
||||||
const { getByValue } = require('./../../utils/dictMap')
|
const { getByValue } = require('./../../utils/dictMap');
|
||||||
|
|
||||||
router.get('/grade/byPupil', (req, res) => {
|
router.get('/grade/byPupil', (req, res) => {
|
||||||
const subjects = require('../../../data/api/dictionaries/Przedmioty')
|
const subjects = require('../../../data/api/dictionaries/Przedmioty');
|
||||||
const categories = require('../../../data/api/dictionaries/KategorieOcen')
|
const categories = require('../../../data/api/dictionaries/KategorieOcen');
|
||||||
const teachers = require('../../../data/api/dictionaries/Nauczyciele')
|
const teachers = require('../../../data/api/dictionaries/Nauczyciele');
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
createEnvelope(
|
createEnvelope(
|
||||||
|
@ -71,11 +71,11 @@ router.get('/grade/byPupil', (req, res) => {
|
||||||
Denominator: item.Mianownik,
|
Denominator: item.Mianownik,
|
||||||
PupilId: 111,
|
PupilId: 111,
|
||||||
Value: item.Wartosc,
|
Value: item.Wartosc,
|
||||||
}
|
};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/lucky', (req, res) => {
|
router.all('/lucky', (req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -83,7 +83,7 @@ router.all('/lucky', (req, res) => {
|
||||||
Day: format(new Date(), 'yyyy-MM-dd'),
|
Day: format(new Date(), 'yyyy-MM-dd'),
|
||||||
Number: format(new Date(), 'd'),
|
Number: format(new Date(), 'd'),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const { createEnvelope } = require('./utils')
|
const { createEnvelope } = require('./utils');
|
||||||
const { getTime, format } = require('date-fns')
|
const { getTime, format } = require('date-fns');
|
||||||
|
|
||||||
router.all('/version', (req, res) => {
|
router.all('/version', (req, res) => {
|
||||||
res.json(createEnvelope(105, 'Podany czas jest nieprawidłowy', 'Object', null))
|
res.json(createEnvelope(105, 'Podany czas jest nieprawidłowy', 'Object', null));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/internal/time', (req, res) => {
|
router.all('/internal/time', (req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -14,11 +14,11 @@ router.all('/internal/time', (req, res) => {
|
||||||
Time: format(new Date(), 'HH:mm:ss'),
|
Time: format(new Date(), 'HH:mm:ss'),
|
||||||
Timestamp: getTime(new Date()),
|
Timestamp: getTime(new Date()),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/heartbeat', (req, res) => {
|
router.all('/heartbeat', (req, res) => {
|
||||||
res.json(createEnvelope(0, 'OK', 'Boolean', true))
|
res.json(createEnvelope(0, 'OK', 'Boolean', true));
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { uuid } = require('uuidv4')
|
const { uuid } = require('uuidv4');
|
||||||
const { getTime, format } = require('date-fns')
|
const { getTime, format } = require('date-fns');
|
||||||
|
|
||||||
exports.createEnvelope = (statusCode, statusMessage, type, body) => {
|
exports.createEnvelope = (statusCode, statusMessage, type, body) => {
|
||||||
return {
|
return {
|
||||||
|
@ -13,5 +13,5 @@ exports.createEnvelope = (statusCode, statusMessage, type, body) => {
|
||||||
},
|
},
|
||||||
Timestamp: getTime(new Date()),
|
Timestamp: getTime(new Date()),
|
||||||
TimestampFormatted: format(new Date(), 'yyyy-MM-dd HH:mm:ss'),
|
TimestampFormatted: format(new Date(), 'yyyy-MM-dd HH:mm:ss'),
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const fs = require('fs')
|
const fs = require('fs');
|
||||||
const router = express.Router()
|
const router = express.Router();
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.redirect('/powiatwulkanowy/Account/LogOn')
|
res.redirect('/powiatwulkanowy/Account/LogOn');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/powiatwulkanowy(/)?', (req, res) => {
|
router.get('/powiatwulkanowy(/)?', (req, res) => {
|
||||||
res.redirect('/powiatwulkanowy/Account/LogOn')
|
res.redirect('/powiatwulkanowy/Account/LogOn');
|
||||||
})
|
});
|
||||||
|
|
||||||
// GET login page
|
// GET login page
|
||||||
router.get('/:symbol/Account/LogOn', (req, res) => {
|
router.get('/:symbol/Account/LogOn', (req, res) => {
|
||||||
res.render('login-form', {
|
res.render('login-form', {
|
||||||
title: 'Logowanie (' + req.param('symbol') + ')',
|
title: 'Logowanie (' + req.param('symbol') + ')',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
// POST login
|
// POST login
|
||||||
router.post('/:symbol/Account/LogOn', (req, res) => {
|
router.post('/:symbol/Account/LogOn', (req, res) => {
|
||||||
if ('jan@fakelog.cf' === req.body.LoginName && 'jan123' === req.body.Password) {
|
if ('jan@fakelog.cf' === req.body.LoginName && 'jan123' === req.body.Password) {
|
||||||
res.cookie('Vulcan.CUFS.WebFrontEndCookie', '1234567891012131314151617181920212223242526+')
|
res.cookie('Vulcan.CUFS.WebFrontEndCookie', '1234567891012131314151617181920212223242526+');
|
||||||
res.cookie('ARR_cufs.vulcan.net.pl', '1234567891012131314151617181920212223242526272829303132333435363')
|
res.cookie('ARR_cufs.vulcan.net.pl', '1234567891012131314151617181920212223242526272829303132333435363');
|
||||||
return res.redirect(
|
return res.redirect(
|
||||||
'/' +
|
'/' +
|
||||||
req.param('symbol') +
|
req.param('symbol') +
|
||||||
|
@ -38,37 +38,37 @@ router.post('/:symbol/Account/LogOn', (req, res) => {
|
||||||
'%3a%2f%2fuonetplus.fakelog.localhost%3A300%2f' +
|
'%3a%2f%2fuonetplus.fakelog.localhost%3A300%2f' +
|
||||||
req.param('symbol') +
|
req.param('symbol') +
|
||||||
'%2fLoginEndpoint.aspx'
|
'%2fLoginEndpoint.aspx'
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('login-form', {
|
res.render('login-form', {
|
||||||
title: 'Logowanie (' + req.param('symbol') + ')',
|
title: 'Logowanie (' + req.param('symbol') + ')',
|
||||||
message: 'Zła nazwa użytkownika lub hasło',
|
message: 'Zła nazwa użytkownika lub hasło',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/:symbol/FS/LS', (req, res) => {
|
router.get('/:symbol/FS/LS', (req, res) => {
|
||||||
res.render('login-cert', {
|
res.render('login-cert', {
|
||||||
symbol: req.param('symbol'),
|
symbol: req.param('symbol'),
|
||||||
cert: fs.readFileSync('public/cert.xml', 'utf8'),
|
cert: fs.readFileSync('public/cert.xml', 'utf8'),
|
||||||
uonetplusOpiekun: protocol(req) + '://' + req.get('host').replace('cufs.', 'uonetplus.'),
|
uonetplusOpiekun: protocol(req) + '://' + req.get('host').replace('cufs.', 'uonetplus.'),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/:symbol/AccountManage/UnlockAccount', (req, res) => {
|
router.get('/:symbol/AccountManage/UnlockAccount', (req, res) => {
|
||||||
res.render('login-recover', { title: 'Przywracanie dostępu' })
|
res.render('login-recover', { title: 'Przywracanie dostępu' });
|
||||||
})
|
});
|
||||||
|
|
||||||
router.post('/:symbol/AccountManage/UnlockAccount', (req, res) => {
|
router.post('/:symbol/AccountManage/UnlockAccount', (req, res) => {
|
||||||
if (req.body['g-recaptcha-response']) {
|
if (req.body['g-recaptcha-response']) {
|
||||||
return res.render('summary', { title: 'Podsumowanie operacji' })
|
return res.render('summary', { title: 'Podsumowanie operacji' });
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('login-recover', {
|
res.render('login-recover', {
|
||||||
title: 'Przywracanie dostępu',
|
title: 'Przywracanie dostępu',
|
||||||
message:
|
message:
|
||||||
'Mechanizm zabezpieczający przeciw robotom i robakom internetowym sygnalizuje, że żądanie nie zostało poprawnie autoryzowane',
|
'Mechanizm zabezpieczający przeciw robotom i robakom internetowym sygnalizuje, że żądanie nie zostało poprawnie autoryzowane',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const router = express.Router()
|
const router = express.Router();
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
|
|
||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
|
@ -8,7 +8,7 @@ router.get('/', (req, res) => {
|
||||||
title: 'fake-log',
|
title: 'fake-log',
|
||||||
proto: protocol(req),
|
proto: protocol(req),
|
||||||
domain: req.get('host'),
|
domain: req.get('host'),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const api = require('../../utils/api')
|
const api = require('../../utils/api');
|
||||||
|
|
||||||
router.all('/ZmienStatusWiadomosci', (req, res) => {
|
router.all('/ZmienStatusWiadomosci', (req, res) => {
|
||||||
res.json(api.createResponse('Zmiana statusu wiadomości.'))
|
res.json(api.createResponse('Zmiana statusu wiadomości.'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/WiadomosciOdebrane', (req, res) => {
|
router.all('/WiadomosciOdebrane', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/messages/WiadomosciOdebrane')))
|
res.json(api.createResponse(require('../../../data/api/messages/WiadomosciOdebrane')));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/WiadomosciWyslane', (req, res) => {
|
router.all('/WiadomosciWyslane', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/messages/WiadomosciWyslane')))
|
res.json(api.createResponse(require('../../../data/api/messages/WiadomosciWyslane')));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/WiadomosciUsuniete', (req, res) => {
|
router.all('/WiadomosciUsuniete', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/messages/WiadomosciUsuniete')))
|
res.json(api.createResponse(require('../../../data/api/messages/WiadomosciUsuniete')));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/DodajWiadomosc', (req, res) => {
|
router.all('/DodajWiadomosc', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/messages/DodajWiadomosc')))
|
res.json(api.createResponse(require('../../../data/api/messages/DodajWiadomosc')));
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const api = require('../../utils/api')
|
const api = require('../../utils/api');
|
||||||
|
|
||||||
router.all('/GetCertificatePushConfig', (req, res) => {
|
router.all('/GetCertificatePushConfig', (req, res) => {
|
||||||
res.json(api.createResponse('not implemented')) //TODO
|
res.json(api.createResponse('not implemented')); //TODO
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const protocol = require('../../utils/connection')
|
const protocol = require('../../utils/connection');
|
||||||
const { getUnixTime, format } = require('date-fns')
|
const { getUnixTime, format } = require('date-fns');
|
||||||
const api = require('../../utils/api')
|
const api = require('../../utils/api');
|
||||||
|
|
||||||
router.all('/Certyfikat', (req, res) => {
|
router.all('/Certyfikat', (req, res) => {
|
||||||
const base = protocol(req) + '://' + req.get('host')
|
const base = protocol(req) + '://' + req.get('host');
|
||||||
|
|
||||||
// key gen
|
// key gen
|
||||||
// keytool -genkeypair -keystore myKeystore.p12 -storetype PKCS12 -storepass 012345678901234567890123456789AB -alias LoginCert -keyalg RSA -keysize 2048 -sigalg SHA1WithRSA -validity 99999 -dname "CN=Wulkanowy, OU=Wulkanowy, O=Wulkanowy, L=Jaroslaw, ST=podkarpackie, C=WLKNW" -ext san=dns:fakelog.cf,dns:localhost,ip:127.0.0.1
|
// keytool -genkeypair -keystore myKeystore.p12 -storetype PKCS12 -storepass 012345678901234567890123456789AB -alias LoginCert -keyalg RSA -keysize 2048 -sigalg SHA1WithRSA -validity 99999 -dname "CN=Wulkanowy, OU=Wulkanowy, O=Wulkanowy, L=Jaroslaw, ST=podkarpackie, C=WLKNW" -ext san=dns:fakelog.cf,dns:localhost,ip:127.0.0.1
|
||||||
|
@ -28,23 +28,23 @@ router.all('/Certyfikat', (req, res) => {
|
||||||
UzytkownikNazwa: 'admin',
|
UzytkownikNazwa: 'admin',
|
||||||
TypKonta: null,
|
TypKonta: null,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/ListaUczniow', (req, res) => {
|
router.all('/ListaUczniow', (req, res) => {
|
||||||
const currDate = new Date()
|
const currDate = new Date();
|
||||||
|
|
||||||
let semesterNumber
|
let semesterNumber;
|
||||||
let semesterStart
|
let semesterStart;
|
||||||
let semesterEnd
|
let semesterEnd;
|
||||||
if (currDate.getMonth() >= 8) {
|
if (currDate.getMonth() >= 8) {
|
||||||
semesterNumber = 1
|
semesterNumber = 1;
|
||||||
semesterStart = new Date(currDate.getFullYear(), 8, 1)
|
semesterStart = new Date(currDate.getFullYear(), 8, 1);
|
||||||
semesterEnd = new Date(currDate.getFullYear() + 1, 0, 30)
|
semesterEnd = new Date(currDate.getFullYear() + 1, 0, 30);
|
||||||
} else {
|
} else {
|
||||||
semesterNumber = 2
|
semesterNumber = 2;
|
||||||
semesterStart = new Date(currDate.getFullYear(), 0, 30)
|
semesterStart = new Date(currDate.getFullYear(), 0, 30);
|
||||||
semesterEnd = new Date(currDate.getFullYear(), 7, 31)
|
semesterEnd = new Date(currDate.getFullYear(), 7, 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -57,10 +57,10 @@ router.all('/ListaUczniow', (req, res) => {
|
||||||
OkresDataDo: getUnixTime(semesterEnd),
|
OkresDataDo: getUnixTime(semesterEnd),
|
||||||
OkresDataOdTekst: format(semesterStart, 'yyyy-MM-dd'),
|
OkresDataOdTekst: format(semesterStart, 'yyyy-MM-dd'),
|
||||||
OkresDataDoTekst: format(semesterEnd, 'yyyy-MM-dd'),
|
OkresDataDoTekst: format(semesterEnd, 'yyyy-MM-dd'),
|
||||||
}
|
};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
const router = require('express').Router({})
|
const router = require('express').Router({});
|
||||||
const api = require('../../utils/api')
|
const api = require('../../utils/api');
|
||||||
const converter = require('../../utils/converter')
|
const converter = require('../../utils/converter');
|
||||||
const { addDays, differenceInDays, parseISO, startOfWeek, getTime } = require('date-fns')
|
const { addDays, differenceInDays, parseISO, startOfWeek, getTime } = require('date-fns');
|
||||||
|
|
||||||
router.all('/LogAppStart', (req, res) => {
|
router.all('/LogAppStart', (req, res) => {
|
||||||
res.json(api.createResponse('Log'))
|
res.json(api.createResponse('Log'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/UstawPushToken', (req, res) => {
|
router.all('/UstawPushToken', (req, res) => {
|
||||||
res.json(api.createResponse('Zapisano tokenId dla powiadomien PUSH'))
|
res.json(api.createResponse('Zapisano tokenId dla powiadomien PUSH'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Slowniki', (req, res) => {
|
router.all('/Slowniki', (req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -24,69 +24,69 @@ router.all('/Slowniki', (req, res) => {
|
||||||
KategorieFrekwencji: require('../../../data/api/dictionaries/KategorieFrekwencji'),
|
KategorieFrekwencji: require('../../../data/api/dictionaries/KategorieFrekwencji'),
|
||||||
TypyFrekwencji: require('../../../data/api/dictionaries/TypyFrekwencji'),
|
TypyFrekwencji: require('../../../data/api/dictionaries/TypyFrekwencji'),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/PlanLekcjiZeZmianami', (req, res) => {
|
router.all('/PlanLekcjiZeZmianami', (req, res) => {
|
||||||
const timetable = require('../../../data/api/student/PlanLekcjiZeZmianami')
|
const timetable = require('../../../data/api/student/PlanLekcjiZeZmianami');
|
||||||
const requestDate = req.body.DataPoczatkowa
|
const requestDate = req.body.DataPoczatkowa
|
||||||
? parseISO(req.body.DataPoczatkowa)
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
: startOfWeek(new Date(), { weekStartsOn: 1 });
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(timetable[0].DzienTekst))
|
const baseOffset = differenceInDays(requestDate, parseISO(timetable[0].DzienTekst));
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
api.createResponse(
|
api.createResponse(
|
||||||
timetable.map((item) => {
|
timetable.map((item) => {
|
||||||
const date = addDays(parseISO(item.DzienTekst), baseOffset)
|
const date = addDays(parseISO(item.DzienTekst), baseOffset);
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
Dzien: getTime(date) / 1000,
|
Dzien: getTime(date) / 1000,
|
||||||
DzienTekst: converter.formatDate(date, true),
|
DzienTekst: converter.formatDate(date, true),
|
||||||
}
|
};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Oceny', (req, res) => {
|
router.all('/Oceny', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/student/Oceny')))
|
res.json(api.createResponse(require('../../../data/api/student/Oceny')));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/OcenyPodsumowanie', (req, res) => {
|
router.all('/OcenyPodsumowanie', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/student/OcenyPodsumowanie')))
|
res.json(api.createResponse(require('../../../data/api/student/OcenyPodsumowanie')));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Sprawdziany', (req, res) => {
|
router.all('/Sprawdziany', (req, res) => {
|
||||||
const exams = require('../../../data/api/student/Sprawdziany')
|
const exams = require('../../../data/api/student/Sprawdziany');
|
||||||
const requestDate = req.body.DataPoczatkowa
|
const requestDate = req.body.DataPoczatkowa
|
||||||
? parseISO(req.body.DataPoczatkowa)
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
: startOfWeek(new Date(), { weekStartsOn: 1 });
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(exams[0].DataTekst))
|
const baseOffset = differenceInDays(requestDate, parseISO(exams[0].DataTekst));
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
api.createResponse(
|
api.createResponse(
|
||||||
exams.map((item) => {
|
exams.map((item) => {
|
||||||
const date = addDays(parseISO(item.DataTekst), baseOffset)
|
const date = addDays(parseISO(item.DataTekst), baseOffset);
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
Data: getTime(date) / 1000,
|
Data: getTime(date) / 1000,
|
||||||
DataTekst: converter.formatDate(date, true),
|
DataTekst: converter.formatDate(date, true),
|
||||||
}
|
};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/UwagiUcznia', (req, res) => {
|
router.all('/UwagiUcznia', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/student/UwagiUcznia')))
|
res.json(api.createResponse(require('../../../data/api/student/UwagiUcznia')));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Frekwencje', (req, res) => {
|
router.all('/Frekwencje', (req, res) => {
|
||||||
const attendance = require('../../../data/api/student/Frekwencje')
|
const attendance = require('../../../data/api/student/Frekwencje');
|
||||||
const requestDate = req.body.DataPoczatkowa
|
const requestDate = req.body.DataPoczatkowa
|
||||||
? parseISO(req.body.DataPoczatkowa)
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
: startOfWeek(new Date(), { weekStartsOn: 1 });
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(attendance[0].DzienTekst))
|
const baseOffset = differenceInDays(requestDate, parseISO(attendance[0].DzienTekst));
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
api.createResponse({
|
api.createResponse({
|
||||||
|
@ -95,40 +95,40 @@ router.all('/Frekwencje', (req, res) => {
|
||||||
DataPoczatkowaTekst: req.body.DataPoczatkowa,
|
DataPoczatkowaTekst: req.body.DataPoczatkowa,
|
||||||
DataKoncowaTekst: req.body.DataKoncowa,
|
DataKoncowaTekst: req.body.DataKoncowa,
|
||||||
Frekwencje: attendance.map((item) => {
|
Frekwencje: attendance.map((item) => {
|
||||||
const date = addDays(parseISO(item.DzienTekst), baseOffset)
|
const date = addDays(parseISO(item.DzienTekst), baseOffset);
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
Dzien: getTime(date) / 1000,
|
Dzien: getTime(date) / 1000,
|
||||||
DzienTekst: converter.formatDate(date, true),
|
DzienTekst: converter.formatDate(date, true),
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/ZadaniaDomowe', (req, res) => {
|
router.all('/ZadaniaDomowe', (req, res) => {
|
||||||
const homework = require('../../../data/api/student/ZadaniaDomowe')
|
const homework = require('../../../data/api/student/ZadaniaDomowe');
|
||||||
const requestDate = req.body.DataPoczatkowa
|
const requestDate = req.body.DataPoczatkowa
|
||||||
? parseISO(req.body.DataPoczatkowa)
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
: startOfWeek(new Date(), { weekStartsOn: 1 });
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(homework[0].DataTekst))
|
const baseOffset = differenceInDays(requestDate, parseISO(homework[0].DataTekst));
|
||||||
|
|
||||||
res.json(
|
res.json(
|
||||||
api.createResponse(
|
api.createResponse(
|
||||||
homework.map((item) => {
|
homework.map((item) => {
|
||||||
const date = addDays(parseISO(item.DataTekst), baseOffset)
|
const date = addDays(parseISO(item.DataTekst), baseOffset);
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
Data: getTime(date) / 1000,
|
Data: getTime(date) / 1000,
|
||||||
DataTekst: converter.formatDate(date, true),
|
DataTekst: converter.formatDate(date, true),
|
||||||
}
|
};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Nauczyciele', (req, res) => {
|
router.all('/Nauczyciele', (req, res) => {
|
||||||
res.json(api.createResponse(require('../../../data/api/student/Nauczyciele')))
|
res.json(api.createResponse(require('../../../data/api/student/Nauczyciele')));
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const router = express.Router()
|
const router = express.Router();
|
||||||
const converter = require('../utils/converter')
|
const converter = require('../utils/converter');
|
||||||
const dictMap = require('../utils/dictMap')
|
const dictMap = require('../utils/dictMap');
|
||||||
const { getGradeColorByCategoryName } = require('../utils/gradeColor')
|
const { getGradeColorByCategoryName } = require('../utils/gradeColor');
|
||||||
const _ = require('lodash')
|
const _ = require('lodash');
|
||||||
|
|
||||||
global.opiekunRoot = '/powiatwulkanowy/123456'
|
global.opiekunRoot = '/powiatwulkanowy/123456';
|
||||||
|
|
||||||
router.all('/', (req, res) => {
|
router.all('/', (req, res) => {
|
||||||
res.render('log-exception', {
|
res.render('log-exception', {
|
||||||
title: 'Dziennik FakeUONET+',
|
title: 'Dziennik FakeUONET+',
|
||||||
message: 'Podany identyfikator klienta jest niepoprawny.',
|
message: 'Podany identyfikator klienta jest niepoprawny.',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy(/12345[678])?', (req, res) => {
|
router.all('/powiatwulkanowy(/12345[678])?', (req, res) => {
|
||||||
if (req.header('Referer') || 'true' === req.query.login) {
|
if (req.header('Referer') || 'true' === req.query.login) {
|
||||||
return res.redirect('/powiatwulkanowy/123456/Start/Index/')
|
return res.redirect('/powiatwulkanowy/123456/Start/Index/');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('login', {
|
res.render('login', {
|
||||||
title: 'Uczeń',
|
title: 'Uczeń',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Start/Index/', (req, res) => {
|
router.get('/Start/Index/', (req, res) => {
|
||||||
res.cookie('EfebSsoAuthCookie', 'asdfasdfasdfasdfasdfasdfas', {
|
res.cookie('EfebSsoAuthCookie', 'asdfasdfasdfasdfasdfasdfas', {
|
||||||
domain: req.get('host').replace('uonetplus-opiekun', ''),
|
domain: req.get('host').replace('uonetplus-opiekun', ''),
|
||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
})
|
});
|
||||||
res.cookie('idBiezacyDziennik', '1234')
|
res.cookie('idBiezacyDziennik', '1234');
|
||||||
res.render('opiekun/start', {
|
res.render('opiekun/start', {
|
||||||
title: 'Witryna ucznia i rodzica – Strona główna',
|
title: 'Witryna ucznia i rodzica – Strona główna',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Uczen/UczenOnChange', (req, res) => {
|
router.get('/Uczen/UczenOnChange', (req, res) => {
|
||||||
res.cookie('idBiezacyUczen', req.query.id)
|
res.cookie('idBiezacyUczen', req.query.id);
|
||||||
|
|
||||||
res.redirect(req.header('Referer') ? req.header('Referer') : '../?login=true')
|
res.redirect(req.header('Referer') ? req.header('Referer') : '../?login=true');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Dziennik/DziennikOnChange', (req, res) => {
|
router.get('/Dziennik/DziennikOnChange', (req, res) => {
|
||||||
res.cookie('idBiezacyDziennik', req.query.id)
|
res.cookie('idBiezacyDziennik', req.query.id);
|
||||||
|
|
||||||
res.redirect(req.header('Referer') ? req.header('Referer') : '../')
|
res.redirect(req.header('Referer') ? req.header('Referer') : '../');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Uczen.mvc/DanePodstawowe', (req, res) => {
|
router.get('/Uczen.mvc/DanePodstawowe', (req, res) => {
|
||||||
res.render('opiekun/dane', {
|
res.render('opiekun/dane', {
|
||||||
title: 'Witryna ucznia i rodzica – Dane ucznia',
|
title: 'Witryna ucznia i rodzica – Dane ucznia',
|
||||||
data: require('../../data/opiekun/dane.json'),
|
data: require('../../data/opiekun/dane.json'),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Oceny(.mvc|)/Wszystkie', (req, res) => {
|
router.get('/Oceny(.mvc|)/Wszystkie', (req, res) => {
|
||||||
let data
|
let data;
|
||||||
let viewPath
|
let viewPath;
|
||||||
|
|
||||||
const teachers = require('../../data/api/dictionaries/Nauczyciele')
|
const teachers = require('../../data/api/dictionaries/Nauczyciele');
|
||||||
const subjects = require('../../data/api/dictionaries/Przedmioty')
|
const subjects = require('../../data/api/dictionaries/Przedmioty');
|
||||||
const details = require('../../data/api/student/Oceny')
|
const details = require('../../data/api/student/Oceny');
|
||||||
const subjectCategories = require('../../data/api/dictionaries/KategorieOcen')
|
const subjectCategories = require('../../data/api/dictionaries/KategorieOcen');
|
||||||
const summary = require('../../data/api/student/OcenyPodsumowanie')
|
const summary = require('../../data/api/student/OcenyPodsumowanie');
|
||||||
const descriptiveGrades = require('../../data/api/student/OcenyOpisowe')
|
const descriptiveGrades = require('../../data/api/student/OcenyOpisowe');
|
||||||
|
|
||||||
if (req.query.details === '2') {
|
if (req.query.details === '2') {
|
||||||
data = details.map((item) => {
|
data = details.map((item) => {
|
||||||
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownikD)
|
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownikD);
|
||||||
const category = dictMap.getByValue(subjectCategories, 'Id', item.IdKategoria)
|
const category = dictMap.getByValue(subjectCategories, 'Id', item.IdKategoria);
|
||||||
return {
|
return {
|
||||||
subject: dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot).Nazwa,
|
subject: dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot).Nazwa,
|
||||||
value: item.Wpis === '' ? item.Komentarz : item.Wpis,
|
value: item.Wpis === '' ? item.Komentarz : item.Wpis,
|
||||||
|
@ -79,11 +79,11 @@ router.get('/Oceny(.mvc|)/Wszystkie', (req, res) => {
|
||||||
weight: item.Waga,
|
weight: item.Waga,
|
||||||
date: converter.formatDate(new Date(item.DataUtworzenia * 1000)),
|
date: converter.formatDate(new Date(item.DataUtworzenia * 1000)),
|
||||||
teacher: teacher.Imie + ' ' + teacher.Nazwisko,
|
teacher: teacher.Imie + ' ' + teacher.Nazwisko,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
viewPath = 'opiekun/oceny-szczegolowy'
|
viewPath = 'opiekun/oceny-szczegolowy';
|
||||||
} else {
|
} else {
|
||||||
viewPath = 'opiekun/oceny-skrocony'
|
viewPath = 'opiekun/oceny-skrocony';
|
||||||
data = {
|
data = {
|
||||||
normalGrades: subjects.map((item) => {
|
normalGrades: subjects.map((item) => {
|
||||||
return {
|
return {
|
||||||
|
@ -91,24 +91,24 @@ router.get('/Oceny(.mvc|)/Wszystkie', (req, res) => {
|
||||||
average: dictMap.getByValue(summary.SrednieOcen, 'IdPrzedmiot', item.Id).SredniaOcen,
|
average: dictMap.getByValue(summary.SrednieOcen, 'IdPrzedmiot', item.Id).SredniaOcen,
|
||||||
predictedRating: dictMap.getByValue(summary.OcenyPrzewidywane, 'IdPrzedmiot', item.Id).Wpis,
|
predictedRating: dictMap.getByValue(summary.OcenyPrzewidywane, 'IdPrzedmiot', item.Id).Wpis,
|
||||||
finalRating: dictMap.getByValue(summary.OcenyPrzewidywane, 'IdPrzedmiot', item.Id).Wpis,
|
finalRating: dictMap.getByValue(summary.OcenyPrzewidywane, 'IdPrzedmiot', item.Id).Wpis,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
descriptiveGrades,
|
descriptiveGrades,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render(viewPath, {
|
res.render(viewPath, {
|
||||||
title: 'Witryna ucznia i rodzica – Oceny',
|
title: 'Witryna ucznia i rodzica – Oceny',
|
||||||
data: data,
|
data: data,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Statystyki.mvc/Uczen', (req, res) => {
|
router.get('/Statystyki.mvc/Uczen', (req, res) => {
|
||||||
let data
|
let data;
|
||||||
let viewPath
|
let viewPath;
|
||||||
|
|
||||||
if (req.query.rodzajWidoku === '1') {
|
if (req.query.rodzajWidoku === '1') {
|
||||||
viewPath = 'opiekun/oceny-statystyki-czastkowe'
|
viewPath = 'opiekun/oceny-statystyki-czastkowe';
|
||||||
data = require('../../data/opiekun/oceny-statystyki-czastkowe').map((item) => {
|
data = require('../../data/opiekun/oceny-statystyki-czastkowe').map((item) => {
|
||||||
return {
|
return {
|
||||||
subject: item.subject,
|
subject: item.subject,
|
||||||
|
@ -117,25 +117,25 @@ router.get('/Statystyki.mvc/Uczen', (req, res) => {
|
||||||
pupilPercent: item.pupilAmount !== 0 ? 25.000003 : 0,
|
pupilPercent: item.pupilAmount !== 0 ? 25.000003 : 0,
|
||||||
classAmount: item.classAmount,
|
classAmount: item.classAmount,
|
||||||
classPercent: item.classAmount !== 0 ? 25.000003 : 0,
|
classPercent: item.classAmount !== 0 ? 25.000003 : 0,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
viewPath = 'opiekun/oceny-statystyki-roczne'
|
viewPath = 'opiekun/oceny-statystyki-roczne';
|
||||||
data = require('../../data/opiekun/oceny-statystyki-roczne').map((item) => {
|
data = require('../../data/opiekun/oceny-statystyki-roczne').map((item) => {
|
||||||
return {
|
return {
|
||||||
subject: item.subject,
|
subject: item.subject,
|
||||||
grade: item.grade,
|
grade: item.grade,
|
||||||
amount: item.amount,
|
amount: item.amount,
|
||||||
percent: item.amount !== 0 ? 25.000003 : 0,
|
percent: item.amount !== 0 ? 25.000003 : 0,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render(viewPath, {
|
res.render(viewPath, {
|
||||||
title: 'Witryna ucznia i rodzica – Statystyki ucznia',
|
title: 'Witryna ucznia i rodzica – Statystyki ucznia',
|
||||||
data: data,
|
data: data,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Frekwencja.mvc', (req, res) => {
|
router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
const sumStats = require('../../data/opiekun/frekwencja-statystyki').reduce((prev, current) => {
|
const sumStats = require('../../data/opiekun/frekwencja-statystyki').reduce((prev, current) => {
|
||||||
|
@ -147,8 +147,8 @@ router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
lateness: prev.lateness + current.lateness,
|
lateness: prev.lateness + current.lateness,
|
||||||
latenessExcused: prev.latenessExcused + current.latenessExcused,
|
latenessExcused: prev.latenessExcused + current.latenessExcused,
|
||||||
exemption: prev.exemption + current.exemption,
|
exemption: prev.exemption + current.exemption,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
res.render('opiekun/frekwencja', {
|
res.render('opiekun/frekwencja', {
|
||||||
title: 'Witryna ucznia i rodzica – Frekwencja',
|
title: 'Witryna ucznia i rodzica – Frekwencja',
|
||||||
subjects: require('../../data/api/dictionaries/Przedmioty'),
|
subjects: require('../../data/api/dictionaries/Przedmioty'),
|
||||||
|
@ -158,7 +158,7 @@ router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
require('../../data/api/dictionaries/KategorieFrekwencji'),
|
require('../../data/api/dictionaries/KategorieFrekwencji'),
|
||||||
'Id',
|
'Id',
|
||||||
item.IdKategoria
|
item.IdKategoria
|
||||||
)
|
);
|
||||||
return {
|
return {
|
||||||
number: item.Numer,
|
number: item.Numer,
|
||||||
subject: item.PrzedmiotNazwa,
|
subject: item.PrzedmiotNazwa,
|
||||||
|
@ -170,7 +170,7 @@ router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
excused: category.Usprawiedliwione,
|
excused: category.Usprawiedliwione,
|
||||||
deleted: category.Usuniete,
|
deleted: category.Usuniete,
|
||||||
attendanceInfo: _.capitalize(category.Nazwa),
|
attendanceInfo: _.capitalize(category.Nazwa),
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
'number'
|
'number'
|
||||||
),
|
),
|
||||||
|
@ -190,35 +190,37 @@ router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
prev: converter.getPrevWeekTick(req.query.data),
|
prev: converter.getPrevWeekTick(req.query.data),
|
||||||
next: converter.getNextWeekTick(req.query.data),
|
next: converter.getNextWeekTick(req.query.data),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/UwagiOsiagniecia.mvc/Wszystkie', (req, res) => {
|
router.get('/UwagiOsiagniecia.mvc/Wszystkie', (req, res) => {
|
||||||
const teachers = require('../../data/api/dictionaries/Nauczyciele')
|
const teachers = require('../../data/api/dictionaries/Nauczyciele');
|
||||||
const categories = require('../../data/api/dictionaries/KategorieUwag')
|
const categories = require('../../data/api/dictionaries/KategorieUwag');
|
||||||
|
|
||||||
res.render('opiekun/uwagi', {
|
res.render('opiekun/uwagi', {
|
||||||
title: 'Witryna ucznia i rodzica – Uwagi i osiągnięcia',
|
title: 'Witryna ucznia i rodzica – Uwagi i osiągnięcia',
|
||||||
notes: require('../../data/api/student/UwagiUcznia').map((item) => {
|
notes: require('../../data/api/student/UwagiUcznia').map((item) => {
|
||||||
return {
|
return {
|
||||||
date: converter.formatDate(new Date(item.DataWpisuTekst)),
|
date: converter.formatDate(new Date(item.DataWpisuTekst)),
|
||||||
teacher: `${item.PracownikImie} ${item.PracownikNazwisko} [${dictMap.getByValue(teachers, 'Id', item.IdPracownik).Kod}]`,
|
teacher: `${item.PracownikImie} ${item.PracownikNazwisko} [${
|
||||||
|
dictMap.getByValue(teachers, 'Id', item.IdPracownik).Kod
|
||||||
|
}]`,
|
||||||
category: dictMap.getByValue(categories, 'Id', item.IdKategoriaUwag).Nazwa,
|
category: dictMap.getByValue(categories, 'Id', item.IdKategoriaUwag).Nazwa,
|
||||||
content: item.TrescUwagi,
|
content: item.TrescUwagi,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Lekcja(.mvc|)/PlanZajec', (req, res) => {
|
router.get('/Lekcja(.mvc|)/PlanZajec', (req, res) => {
|
||||||
const teachers = require('../../data/api/dictionaries/Nauczyciele')
|
const teachers = require('../../data/api/dictionaries/Nauczyciele');
|
||||||
const days = _.groupBy(
|
const days = _.groupBy(
|
||||||
require('../../data/api/student/PlanLekcjiZeZmianami')
|
require('../../data/api/student/PlanLekcjiZeZmianami')
|
||||||
.filter((item) => item.PlanUcznia)
|
.filter((item) => item.PlanUcznia)
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownik)
|
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownik);
|
||||||
const oldTeacher = dictMap.getByValue(teachers, 'Id', item.IdPracownikOld)
|
const oldTeacher = dictMap.getByValue(teachers, 'Id', item.IdPracownikOld);
|
||||||
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Id', item.IdPoraLekcji)
|
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Id', item.IdPoraLekcji);
|
||||||
return {
|
return {
|
||||||
number: item.NumerLekcji,
|
number: item.NumerLekcji,
|
||||||
id: item.IdPoraLekcji,
|
id: item.IdPoraLekcji,
|
||||||
|
@ -234,70 +236,70 @@ router.get('/Lekcja(.mvc|)/PlanZajec', (req, res) => {
|
||||||
changes: item.PogrubionaNazwa,
|
changes: item.PogrubionaNazwa,
|
||||||
canceled: item.PrzekreslonaNazwa,
|
canceled: item.PrzekreslonaNazwa,
|
||||||
date: converter.formatDate(new Date(item.DzienTekst)),
|
date: converter.formatDate(new Date(item.DzienTekst)),
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
'date'
|
'date'
|
||||||
)
|
);
|
||||||
|
|
||||||
const firstLesson = _.min(_.flatten(_.values(days)).map((e) => e.number))
|
const firstLesson = _.min(_.flatten(_.values(days)).map((e) => e.number));
|
||||||
const lastLesson = _.max(_.flatten(_.values(days)).map((e) => e.number))
|
const lastLesson = _.max(_.flatten(_.values(days)).map((e) => e.number));
|
||||||
|
|
||||||
const daysWithGaps = _.mapValues(days, (day) => {
|
const daysWithGaps = _.mapValues(days, (day) => {
|
||||||
const dayWithGaps = []
|
const dayWithGaps = [];
|
||||||
let prevNumber = null
|
let prevNumber = null;
|
||||||
|
|
||||||
const beforeGap = day[0].number - firstLesson
|
const beforeGap = day[0].number - firstLesson;
|
||||||
|
|
||||||
for (i = 0; i < beforeGap; i++) {
|
for (i = 0; i < beforeGap; i++) {
|
||||||
const number = firstLesson + i
|
const number = firstLesson + i;
|
||||||
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Numer', number)
|
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Numer', number);
|
||||||
dayWithGaps.push({
|
dayWithGaps.push({
|
||||||
number,
|
number,
|
||||||
gap: true,
|
gap: true,
|
||||||
start: times.PoczatekTekst,
|
start: times.PoczatekTekst,
|
||||||
end: times.KoniecTekst,
|
end: times.KoniecTekst,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
day.forEach((lesson) => {
|
day.forEach((lesson) => {
|
||||||
let gap = 0
|
let gap = 0;
|
||||||
if (prevNumber !== null) {
|
if (prevNumber !== null) {
|
||||||
gap = lesson.number - prevNumber - 1
|
gap = lesson.number - prevNumber - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < gap; i++) {
|
for (i = 0; i < gap; i++) {
|
||||||
const number = prevNumber + i + 1
|
const number = prevNumber + i + 1;
|
||||||
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Numer', number)
|
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Numer', number);
|
||||||
dayWithGaps.push({
|
dayWithGaps.push({
|
||||||
number,
|
number,
|
||||||
gap: true,
|
gap: true,
|
||||||
start: times.PoczatekTekst,
|
start: times.PoczatekTekst,
|
||||||
end: times.KoniecTekst,
|
end: times.KoniecTekst,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
prevNumber = lesson.number
|
prevNumber = lesson.number;
|
||||||
|
|
||||||
dayWithGaps.push(lesson)
|
dayWithGaps.push(lesson);
|
||||||
})
|
});
|
||||||
|
|
||||||
const afterGap = lastLesson - prevNumber
|
const afterGap = lastLesson - prevNumber;
|
||||||
|
|
||||||
for (i = 0; i < afterGap; i++) {
|
for (i = 0; i < afterGap; i++) {
|
||||||
const number = prevNumber + i + 1
|
const number = prevNumber + i + 1;
|
||||||
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Numer', number)
|
const times = dictMap.getByValue(require('../../data/api/dictionaries/PoryLekcji'), 'Numer', number);
|
||||||
dayWithGaps.push({
|
dayWithGaps.push({
|
||||||
number,
|
number,
|
||||||
gap: true,
|
gap: true,
|
||||||
start: times.PoczatekTekst,
|
start: times.PoczatekTekst,
|
||||||
end: times.KoniecTekst,
|
end: times.KoniecTekst,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return dayWithGaps
|
return dayWithGaps;
|
||||||
})
|
});
|
||||||
|
|
||||||
const data = _.groupBy(_.flatten(_.values(daysWithGaps)), 'number')
|
const data = _.groupBy(_.flatten(_.values(daysWithGaps)), 'number');
|
||||||
|
|
||||||
res.render('opiekun/plan-zajec', {
|
res.render('opiekun/plan-zajec', {
|
||||||
title: 'Witryna ucznia i rodzica – Plan lekcji',
|
title: 'Witryna ucznia i rodzica – Plan lekcji',
|
||||||
|
@ -307,8 +309,8 @@ router.get('/Lekcja(.mvc|)/PlanZajec', (req, res) => {
|
||||||
prev: converter.getPrevWeekTick(req.query.data),
|
prev: converter.getPrevWeekTick(req.query.data),
|
||||||
next: converter.getNextWeekTick(req.query.data),
|
next: converter.getNextWeekTick(req.query.data),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Lekcja(.mvc|)/Zrealizowane', (req, res) => {
|
router.get('/Lekcja(.mvc|)/Zrealizowane', (req, res) => {
|
||||||
res.render('opiekun/plan-zrealizowane', {
|
res.render('opiekun/plan-zrealizowane', {
|
||||||
|
@ -321,36 +323,36 @@ router.get('/Lekcja(.mvc|)/Zrealizowane', (req, res) => {
|
||||||
...item,
|
...item,
|
||||||
// jshint ignore:end
|
// jshint ignore:end
|
||||||
date: converter.formatDate(new Date(item.date)),
|
date: converter.formatDate(new Date(item.date)),
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
'date'
|
'date'
|
||||||
),
|
),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Sprawdziany.mvc/Terminarz', (req, res) => {
|
router.get('/Sprawdziany.mvc/Terminarz', (req, res) => {
|
||||||
const subjects = require('../../data/api/dictionaries/Przedmioty')
|
const subjects = require('../../data/api/dictionaries/Przedmioty');
|
||||||
const teachers = require('../../data/api/dictionaries/Nauczyciele')
|
const teachers = require('../../data/api/dictionaries/Nauczyciele');
|
||||||
const days = converter.getWeekDaysFrom(req.query.data)
|
const days = converter.getWeekDaysFrom(req.query.data);
|
||||||
res.render('opiekun/sprawdziany', {
|
res.render('opiekun/sprawdziany', {
|
||||||
title: 'Witryna ucznia i rodzica – Terminarz sprawdzianów',
|
title: 'Witryna ucznia i rodzica – Terminarz sprawdzianów',
|
||||||
data: _.groupBy(
|
data: _.groupBy(
|
||||||
require('../../data/api/student/Sprawdziany').map((item, index) => {
|
require('../../data/api/student/Sprawdziany').map((item, index) => {
|
||||||
const subject = dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot)
|
const subject = dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot);
|
||||||
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownik)
|
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownik);
|
||||||
let examType
|
let examType;
|
||||||
switch (item.RodzajNumer) {
|
switch (item.RodzajNumer) {
|
||||||
case 1:
|
case 1:
|
||||||
examType = 'Sprawdzian'
|
examType = 'Sprawdzian';
|
||||||
break
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
examType = 'Kartkówka'
|
examType = 'Kartkówka';
|
||||||
break
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
examType = 'Praca klasowa'
|
examType = 'Praca klasowa';
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
examType = 'Nieznany'
|
examType = 'Nieznany';
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
entryDate: '01.01.1970',
|
entryDate: '01.01.1970',
|
||||||
|
@ -358,12 +360,14 @@ router.get('/Sprawdziany.mvc/Terminarz', (req, res) => {
|
||||||
// date: converter.formatDate(new Date(item.DataTekst)),
|
// date: converter.formatDate(new Date(item.DataTekst)),
|
||||||
// dayName: converter.getDayName(item.DataTekst),
|
// dayName: converter.getDayName(item.DataTekst),
|
||||||
dayName: days[index][0],
|
dayName: days[index][0],
|
||||||
subject: `${subject.Nazwa} ${res.locals.userInfo.OddzialKod}${item.PodzialSkrot ? '|' + item.PodzialSkrot : ''}`,
|
subject: `${subject.Nazwa} ${res.locals.userInfo.OddzialKod}${
|
||||||
|
item.PodzialSkrot ? '|' + item.PodzialSkrot : ''
|
||||||
|
}`,
|
||||||
type: examType,
|
type: examType,
|
||||||
description: item.Opis,
|
description: item.Opis,
|
||||||
teacher: `${teacher.Imie} ${teacher.Nazwisko}`,
|
teacher: `${teacher.Imie} ${teacher.Nazwisko}`,
|
||||||
teacherSymbol: teacher.Kod,
|
teacherSymbol: teacher.Kod,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
'date'
|
'date'
|
||||||
),
|
),
|
||||||
|
@ -372,16 +376,16 @@ router.get('/Sprawdziany.mvc/Terminarz', (req, res) => {
|
||||||
prev: converter.getPrevWeekTick(req.query.data),
|
prev: converter.getPrevWeekTick(req.query.data),
|
||||||
next: converter.getNextWeekTick(req.query.data),
|
next: converter.getNextWeekTick(req.query.data),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/ZadaniaDomowe.mvc', (req, res) => {
|
router.get('/ZadaniaDomowe.mvc', (req, res) => {
|
||||||
const subjects = require('../../data/api/dictionaries/Przedmioty')
|
const subjects = require('../../data/api/dictionaries/Przedmioty');
|
||||||
res.render('opiekun/zadania', {
|
res.render('opiekun/zadania', {
|
||||||
title: 'Witryna ucznia i rodzica – Zadania domowe',
|
title: 'Witryna ucznia i rodzica – Zadania domowe',
|
||||||
homework: require('../../data/api/student/ZadaniaDomowe').map((item) => {
|
homework: require('../../data/api/student/ZadaniaDomowe').map((item) => {
|
||||||
const teacher = dictMap.getByValue(require('../../data/api/dictionaries/Nauczyciele'), 'Id', item.IdPracownik)
|
const teacher = dictMap.getByValue(require('../../data/api/dictionaries/Nauczyciele'), 'Id', item.IdPracownik);
|
||||||
const date = converter.getDateString(req.query.data)
|
const date = converter.getDateString(req.query.data);
|
||||||
return {
|
return {
|
||||||
date: converter.formatDate(date),
|
date: converter.formatDate(date),
|
||||||
dayName: converter.getDayName(date),
|
dayName: converter.getDayName(date),
|
||||||
|
@ -390,68 +394,68 @@ router.get('/ZadaniaDomowe.mvc', (req, res) => {
|
||||||
teacherSymbol: teacher.Kod,
|
teacherSymbol: teacher.Kod,
|
||||||
subject: dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot).Nazwa,
|
subject: dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot).Nazwa,
|
||||||
content: item.Opis,
|
content: item.Opis,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
tics: {
|
tics: {
|
||||||
prev: converter.getPrevDayTick(req.query.data),
|
prev: converter.getPrevDayTick(req.query.data),
|
||||||
next: converter.getNextDayTick(req.query.data),
|
next: converter.getNextDayTick(req.query.data),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Szkola.mvc/Nauczyciele', (req, res) => {
|
router.get('/Szkola.mvc/Nauczyciele', (req, res) => {
|
||||||
const teachers = require('../../data/api/student/Nauczyciele')
|
const teachers = require('../../data/api/student/Nauczyciele');
|
||||||
const subjectsDict = require('../../data/api/dictionaries/Przedmioty')
|
const subjectsDict = require('../../data/api/dictionaries/Przedmioty');
|
||||||
const teachersDict = require('../../data/api/dictionaries/Pracownicy')
|
const teachersDict = require('../../data/api/dictionaries/Pracownicy');
|
||||||
|
|
||||||
const headmaster = dictMap.getByValue(teachersDict, 'Id', teachers.NauczycieleSzkola[0].IdPracownik)
|
const headmaster = dictMap.getByValue(teachersDict, 'Id', teachers.NauczycieleSzkola[0].IdPracownik);
|
||||||
const tutor = dictMap.getByValue(teachersDict, 'Id', teachers.NauczycieleSzkola[3].IdPracownik)
|
const tutor = dictMap.getByValue(teachersDict, 'Id', teachers.NauczycieleSzkola[3].IdPracownik);
|
||||||
res.render('opiekun/szkola', {
|
res.render('opiekun/szkola', {
|
||||||
title: 'Witryna ucznia i rodzica – Szkoła i nauczyciele',
|
title: 'Witryna ucznia i rodzica – Szkoła i nauczyciele',
|
||||||
headMaster: `${headmaster.Imie} ${headmaster.Nazwisko}`,
|
headMaster: `${headmaster.Imie} ${headmaster.Nazwisko}`,
|
||||||
tutor: `${tutor.Imie} ${tutor.Nazwisko}`,
|
tutor: `${tutor.Imie} ${tutor.Nazwisko}`,
|
||||||
teachers: teachers.NauczycielePrzedmioty.map((item) => {
|
teachers: teachers.NauczycielePrzedmioty.map((item) => {
|
||||||
const teacher = dictMap.getByValue(teachersDict, 'Id', item.IdPracownik)
|
const teacher = dictMap.getByValue(teachersDict, 'Id', item.IdPracownik);
|
||||||
return {
|
return {
|
||||||
subject: dictMap.getByValue(subjectsDict, 'Id', item.IdPrzedmiot).Nazwa,
|
subject: dictMap.getByValue(subjectsDict, 'Id', item.IdPrzedmiot).Nazwa,
|
||||||
name: `${teacher.Imie} ${teacher.Nazwisko} [${teacher.Kod}]`,
|
name: `${teacher.Imie} ${teacher.Nazwisko} [${teacher.Kod}]`,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/DostepMobilny.mvc', (req, res) => {
|
router.get('/DostepMobilny.mvc', (req, res) => {
|
||||||
res.render('opiekun/mobilny', {
|
res.render('opiekun/mobilny', {
|
||||||
title: 'Witryna ucznia i rodzica – Dostęp mobilny',
|
title: 'Witryna ucznia i rodzica – Dostęp mobilny',
|
||||||
devices: require('../../data/opiekun/zarejestrowane-urzadzenia').map((item) => {
|
devices: require('../../data/opiekun/zarejestrowane-urzadzenia').map((item) => {
|
||||||
const created = item.DataUtworzenia.split(' ')
|
const created = item.DataUtworzenia.split(' ');
|
||||||
return {
|
return {
|
||||||
// jshint ignore:start
|
// jshint ignore:start
|
||||||
...item,
|
...item,
|
||||||
// jshint ignore:end
|
// jshint ignore:end
|
||||||
DataUtworzenia: `${converter.formatDate(new Date(created[0]))} godz: ${created[1]}`,
|
DataUtworzenia: `${converter.formatDate(new Date(created[0]))} godz: ${created[1]}`,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/DostepMobilny.mvc/Rejestruj', (req, res) => {
|
router.get('/DostepMobilny.mvc/Rejestruj', (req, res) => {
|
||||||
res.render('opiekun/mobilny-rejestruj')
|
res.render('opiekun/mobilny-rejestruj');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/DostepMobilny.mvc/PingForCertGeneratedToken', (req, res) => {
|
router.all('/DostepMobilny.mvc/PingForCertGeneratedToken', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: req.body.idToken % 2 === 0,
|
data: req.body.idToken % 2 === 0,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/DostepMobilny.mvc/Wyrejestruj/:id', (req, res) => {
|
router.get('/DostepMobilny.mvc/Wyrejestruj/:id', (req, res) => {
|
||||||
res.render('opiekun/mobilny-wyrejestruj')
|
res.render('opiekun/mobilny-wyrejestruj');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.post('/DostepMobilny.mvc/PotwierdzWyrejestrowanie', (req, res) => {
|
router.post('/DostepMobilny.mvc/PotwierdzWyrejestrowanie', (req, res) => {
|
||||||
res.redirect('/DostepMobilny.mvc')
|
res.redirect('/DostepMobilny.mvc');
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,10 @@
|
||||||
const { Router } = require('express')
|
const { Router } = require('express');
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
|
|
||||||
const router = Router()
|
const router = Router();
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456'
|
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456';
|
||||||
res.json({
|
res.json({
|
||||||
loginEndpoint: base + '/LoginEndpoint.aspx',
|
loginEndpoint: base + '/LoginEndpoint.aspx',
|
||||||
app: base + '/App',
|
app: base + '/App',
|
||||||
|
@ -32,121 +32,121 @@ router.get('/', (req, res) => {
|
||||||
base + '/api/PlanZajec',
|
base + '/api/PlanZajec',
|
||||||
base + '/api/DniWolne',
|
base + '/api/DniWolne',
|
||||||
].sort(),
|
].sort(),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/LoginEndpoint.aspx', (req, res) => {
|
router.all('/LoginEndpoint.aspx', (req, res) => {
|
||||||
res.redirect(protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456/App')
|
res.redirect(protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456/App');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/App', (_req, res) => {
|
router.all('/App', (_req, res) => {
|
||||||
res.render('uczenplus/app')
|
res.render('uczenplus/app');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Context', (_req, res) => {
|
router.all('/api/Context', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Context.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Context.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Cache', (_req, res) => {
|
router.all('/api/Cache', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Cache.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Cache.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/OkresyKlasyfikacyjne', (_req, res) => {
|
router.all('/api/OkresyKlasyfikacyjne', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/OkresyKlasyfikacyjne.json'))
|
res.json(require('../../data/uonetplus-uczenplus/OkresyKlasyfikacyjne.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Zebrania', (_req, res) => {
|
router.all('/api/Zebrania', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Zebrania.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Zebrania.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/SprawdzianyZadaniaDomowe', (_req, res) => {
|
router.all('/api/SprawdzianyZadaniaDomowe', (_req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
require('../../data/uonetplus-uczenplus/SprawdzianyZadaniaDomowe.json').map((event) => {
|
require('../../data/uonetplus-uczenplus/SprawdzianyZadaniaDomowe.json').map((event) => {
|
||||||
event.data = new Date().toISOString()
|
event.data = new Date().toISOString();
|
||||||
return event
|
return event;
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.all('/api/SprawdzianSzczegoly', (_req, res) => {
|
router.all('/api/SprawdzianSzczegoly', (_req, res) => {
|
||||||
const data = require('../../data/uonetplus-uczenplus/SprawdzianSzczegoly.json')
|
const data = require('../../data/uonetplus-uczenplus/SprawdzianSzczegoly.json');
|
||||||
data.data = new Date().toISOString()
|
data.data = new Date().toISOString();
|
||||||
res.json(data)
|
res.json(data);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/ZadanieDomoweSzczegoly', (_req, res) => {
|
router.all('/api/ZadanieDomoweSzczegoly', (_req, res) => {
|
||||||
const data = require('../../data/uonetplus-uczenplus/ZadanieDomoweSzczegoly.json')
|
const data = require('../../data/uonetplus-uczenplus/ZadanieDomoweSzczegoly.json');
|
||||||
data.data = new Date().toISOString()
|
data.data = new Date().toISOString();
|
||||||
res.json(data)
|
res.json(data);
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Oceny', (_req, res) => {
|
router.all('/api/Oceny', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Oceny.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Oceny.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Frekwencja', (_req, res) => {
|
router.all('/api/Frekwencja', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Frekwencja.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Frekwencja.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Uwagi', (_req, res) => {
|
router.all('/api/Uwagi', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Uwagi.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Uwagi.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Nauczyciele', (_req, res) => {
|
router.all('/api/Nauczyciele', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Nauczyciele.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Nauczyciele.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Informacje', (_req, res) => {
|
router.all('/api/Informacje', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/Informacje.json'))
|
res.json(require('../../data/uonetplus-uczenplus/Informacje.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/WiadomosciNieodczytane', (_req, res) => {
|
router.all('/api/WiadomosciNieodczytane', (_req, res) => {
|
||||||
res.json({ liczbaNieodczytanychWiadomosci: 2 })
|
res.json({ liczbaNieodczytanychWiadomosci: 2 });
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/DostepOffice', (_req, res) => {
|
router.all('/api/DostepOffice', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/DostepOffice.json'))
|
res.json(require('../../data/uonetplus-uczenplus/DostepOffice.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/ZarejestrowaneUrzadzenia', (_req, res) => {
|
router.all('/api/ZarejestrowaneUrzadzenia', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/ZarejestrowaneUrzadzenia.json'))
|
res.json(require('../../data/uonetplus-uczenplus/ZarejestrowaneUrzadzenia.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/PodrecznikiLataSzkolne', (_req, res) => {
|
router.all('/api/PodrecznikiLataSzkolne', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/PodrecznikiLataSzkolne.json'))
|
res.json(require('../../data/uonetplus-uczenplus/PodrecznikiLataSzkolne.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/SzczesliwyNumerTablica', (_req, res) => {
|
router.all('/api/SzczesliwyNumerTablica', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/SzczesliwyNumerTablica.json'))
|
res.json(require('../../data/uonetplus-uczenplus/SzczesliwyNumerTablica.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/WazneDzisiajTablica', (_req, res) => {
|
router.all('/api/WazneDzisiajTablica', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/WazneDzisiajTablica.json'))
|
res.json(require('../../data/uonetplus-uczenplus/WazneDzisiajTablica.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/WychowawcyTablica', (_req, res) => {
|
router.all('/api/WychowawcyTablica', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/WychowawcyTablica.json'))
|
res.json(require('../../data/uonetplus-uczenplus/WychowawcyTablica.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/RealizacjaZajec', (_req, res) => {
|
router.all('/api/RealizacjaZajec', (_req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
require('../../data/uonetplus-uczenplus/RealizacjaZajec.json').map((lesson) => {
|
require('../../data/uonetplus-uczenplus/RealizacjaZajec.json').map((lesson) => {
|
||||||
lesson.data = new Date().toISOString()
|
lesson.data = new Date().toISOString();
|
||||||
return lesson
|
return lesson;
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.all('/api/PlanZajec', (_req, res) => {
|
router.all('/api/PlanZajec', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/PlanZajec.json'))
|
res.json(require('../../data/uonetplus-uczenplus/PlanZajec.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/DniWolne', (_req, res) => {
|
router.all('/api/DniWolne', (_req, res) => {
|
||||||
res.json(require('../../data/uonetplus-uczenplus/DniWolne.json'))
|
res.json(require('../../data/uonetplus-uczenplus/DniWolne.json'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/*', (_req, res) => {
|
router.all('/api/*', (_req, res) => {
|
||||||
res.status(404).send({ message: 'Nie odnaleziono zasobu.' })
|
res.status(404).send({ message: 'Nie odnaleziono zasobu.' });
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,135 +1,124 @@
|
||||||
const { Router } = require("express");
|
const { Router } = require('express');
|
||||||
|
|
||||||
const router = Router({ mergeParams: true });
|
const router = Router({ mergeParams: true });
|
||||||
|
|
||||||
router.use((req, res, next) => {
|
router.use((req, res, next) => {
|
||||||
if (req.params.customerSymbol !== "123456")
|
if (req.params.customerSymbol !== '123456') res.status(409).json({ message: 'Brak uprawnień.' });
|
||||||
res.status(409).json({ message: "Brak uprawnień." });
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Context", (_req, res) => {
|
router.all('/Context', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Context.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Context.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Cache", (_req, res) => {
|
router.all('/Cache', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Cache.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Cache.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/OkresyKlasyfikacyjne", (_req, res) => {
|
router.all('/OkresyKlasyfikacyjne', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/OkresyKlasyfikacyjne.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/OkresyKlasyfikacyjne.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Zebrania", (_req, res) => {
|
router.all('/Zebrania', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Zebrania.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Zebrania.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/SprawdzianyZadaniaDomowe", (_req, res) => {
|
router.all('/SprawdzianyZadaniaDomowe', (_req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
require("../../../data/uonetplus-uczenplus/SprawdzianyZadaniaDomowe.json").map(
|
require('../../../data/uonetplus-uczenplus/SprawdzianyZadaniaDomowe.json').map((event) => {
|
||||||
(event) => {
|
|
||||||
event.data = new Date().toISOString();
|
event.data = new Date().toISOString();
|
||||||
return event;
|
return event;
|
||||||
}
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/SprawdzianSzczegoly", (_req, res) => {
|
router.all('/SprawdzianSzczegoly', (_req, res) => {
|
||||||
const data = require("../../../data/uonetplus-uczenplus/SprawdzianSzczegoly.json");
|
const data = require('../../../data/uonetplus-uczenplus/SprawdzianSzczegoly.json');
|
||||||
data.data = new Date().toISOString();
|
data.data = new Date().toISOString();
|
||||||
res.json(data);
|
res.json(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/ZadanieDomoweSzczegoly", (_req, res) => {
|
router.all('/ZadanieDomoweSzczegoly', (_req, res) => {
|
||||||
const data = require("../../../data/uonetplus-uczenplus/ZadanieDomoweSzczegoly.json");
|
const data = require('../../../data/uonetplus-uczenplus/ZadanieDomoweSzczegoly.json');
|
||||||
data.data = new Date().toISOString();
|
data.data = new Date().toISOString();
|
||||||
res.json(data);
|
res.json(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Oceny", (_req, res) => {
|
router.all('/Oceny', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Oceny.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Oceny.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Frekwencja", (_req, res) => {
|
router.all('/Frekwencja', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Frekwencja.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Frekwencja.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/FrekwencjaStatystyki", (_req, res) => {
|
router.all('/FrekwencjaStatystyki', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/FrekwencjaStatystyki.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/FrekwencjaStatystyki.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Usprawiedliwienia", (_req, res) => {
|
router.all('/Usprawiedliwienia', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Usprawiedliwienia.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Usprawiedliwienia.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Uwagi", (_req, res) => {
|
router.all('/Uwagi', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Uwagi.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Uwagi.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Nauczyciele", (_req, res) => {
|
router.all('/Nauczyciele', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Nauczyciele.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Nauczyciele.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/Informacje", (_req, res) => {
|
router.all('/Informacje', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/Informacje.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/Informacje.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/WiadomosciNieodczytane", (_req, res) => {
|
router.all('/WiadomosciNieodczytane', (_req, res) => {
|
||||||
res.json({ liczbaNieodczytanychWiadomosci: 2 });
|
res.json({ liczbaNieodczytanychWiadomosci: 2 });
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/DostepOffice", (_req, res) => {
|
router.all('/DostepOffice', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/DostepOffice.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/DostepOffice.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/ZarejestrowaneUrzadzenia", (_req, res) => {
|
router.all('/ZarejestrowaneUrzadzenia', (_req, res) => {
|
||||||
|
res.json(require('../../../data/uonetplus-uczenplus/ZarejestrowaneUrzadzenia.json'));
|
||||||
|
});
|
||||||
|
|
||||||
|
router.all('/PodrecznikiLataSzkolne', (_req, res) => {
|
||||||
|
res.json(require('../../../data/uonetplus-uczenplus/PodrecznikiLataSzkolne.json'));
|
||||||
|
});
|
||||||
|
|
||||||
|
router.all('/SzczesliwyNumerTablica', (_req, res) => {
|
||||||
|
res.json(require('../../../data/uonetplus-uczenplus/SzczesliwyNumerTablica.json'));
|
||||||
|
});
|
||||||
|
|
||||||
|
router.all('/WazneDzisiajTablica', (_req, res) => {
|
||||||
|
res.json(require('../../../data/uonetplus-uczenplus/WazneDzisiajTablica.json'));
|
||||||
|
});
|
||||||
|
|
||||||
|
router.all('/WychowawcyTablica', (_req, res) => {
|
||||||
|
res.json(require('../../../data/uonetplus-uczenplus/WychowawcyTablica.json'));
|
||||||
|
});
|
||||||
|
|
||||||
|
router.all('/RealizacjaZajec', (_req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
require("../../../data/uonetplus-uczenplus/ZarejestrowaneUrzadzenia.json")
|
require('../../../data/uonetplus-uczenplus/RealizacjaZajec.json').map((lesson) => {
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/PodrecznikiLataSzkolne", (_req, res) => {
|
|
||||||
res.json(
|
|
||||||
require("../../../data/uonetplus-uczenplus/PodrecznikiLataSzkolne.json")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/SzczesliwyNumerTablica", (_req, res) => {
|
|
||||||
res.json(
|
|
||||||
require("../../../data/uonetplus-uczenplus/SzczesliwyNumerTablica.json")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/WazneDzisiajTablica", (_req, res) => {
|
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/WazneDzisiajTablica.json"));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/WychowawcyTablica", (_req, res) => {
|
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/WychowawcyTablica.json"));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/RealizacjaZajec", (_req, res) => {
|
|
||||||
res.json(
|
|
||||||
require("../../../data/uonetplus-uczenplus/RealizacjaZajec.json").map(
|
|
||||||
(lesson) => {
|
|
||||||
lesson.data = new Date().toISOString();
|
lesson.data = new Date().toISOString();
|
||||||
return lesson;
|
return lesson;
|
||||||
}
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/PlanZajec", (_req, res) => {
|
router.all('/PlanZajec', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/PlanZajec.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/PlanZajec.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/DniWolne", (_req, res) => {
|
router.all('/DniWolne', (_req, res) => {
|
||||||
res.json(require("../../../data/uonetplus-uczenplus/DniWolne.json"));
|
res.json(require('../../../data/uonetplus-uczenplus/DniWolne.json'));
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/*", (_req, res) => {
|
router.all('/*', (_req, res) => {
|
||||||
res.status(404).send({ message: "Nie odnaleziono zasobu." });
|
res.status(404).send({ message: 'Nie odnaleziono zasobu.' });
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -1,68 +1,65 @@
|
||||||
const { Router } = require("express");
|
const { Router } = require('express');
|
||||||
const protocol = require("../../utils/connection");
|
const protocol = require('../../utils/connection');
|
||||||
const apiRouter = require("./api");
|
const apiRouter = require('./api');
|
||||||
|
|
||||||
const router = Router({ mergeParams: true });
|
const router = Router({ mergeParams: true });
|
||||||
|
|
||||||
router.use("/api", apiRouter);
|
router.use('/api', apiRouter);
|
||||||
|
|
||||||
router.get("/", (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
const base =
|
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456';
|
||||||
protocol(req) + "://" + req.get("host") + "/powiatwulkanowy/123456";
|
|
||||||
res.json({
|
res.json({
|
||||||
loginEndpoint: base + "/LoginEndpoint.aspx",
|
loginEndpoint: base + '/LoginEndpoint.aspx',
|
||||||
app: base + "/App",
|
app: base + '/App',
|
||||||
api: [
|
api: [
|
||||||
base + "/api/Context",
|
base + '/api/Context',
|
||||||
base + "/api/Cache",
|
base + '/api/Cache',
|
||||||
base + "/api/OkresyKlasyfikacyjne",
|
base + '/api/OkresyKlasyfikacyjne',
|
||||||
base + "/api/Zebrania",
|
base + '/api/Zebrania',
|
||||||
base + "/api/SprawdzianyZadaniaDomowe",
|
base + '/api/SprawdzianyZadaniaDomowe',
|
||||||
base + "/api/SprawdzianSzczegoly",
|
base + '/api/SprawdzianSzczegoly',
|
||||||
base + "/api/ZadanieDomoweSzczegoly",
|
base + '/api/ZadanieDomoweSzczegoly',
|
||||||
base + "/api/Uwagi",
|
base + '/api/Uwagi',
|
||||||
base + "/api/Frekwencja",
|
base + '/api/Frekwencja',
|
||||||
base + "/api/FrekwencjaStatystyki",
|
base + '/api/FrekwencjaStatystyki',
|
||||||
base + "/api/Usprawiedliwienia",
|
base + '/api/Usprawiedliwienia',
|
||||||
base + "/api/Oceny",
|
base + '/api/Oceny',
|
||||||
base + "/api/Nauczyciele",
|
base + '/api/Nauczyciele',
|
||||||
base + "/api/Informacje",
|
base + '/api/Informacje',
|
||||||
base + "/api/NieprzeczytaneWiadomosci",
|
base + '/api/NieprzeczytaneWiadomosci',
|
||||||
base + "/api/DostepOffice",
|
base + '/api/DostepOffice',
|
||||||
base + "/api/ZarejestrowaneUrzadzenia",
|
base + '/api/ZarejestrowaneUrzadzenia',
|
||||||
base + "/api/PodrecznikiLataSzkolne",
|
base + '/api/PodrecznikiLataSzkolne',
|
||||||
base + "/api/SzczesliwyNumerTablica",
|
base + '/api/SzczesliwyNumerTablica',
|
||||||
base + "/api/WazneDzisiajTablica",
|
base + '/api/WazneDzisiajTablica',
|
||||||
base + "/api/WychowawcyTablica",
|
base + '/api/WychowawcyTablica',
|
||||||
base + "/api/RealizacjaZajec",
|
base + '/api/RealizacjaZajec',
|
||||||
base + "/api/PlanZajec",
|
base + '/api/PlanZajec',
|
||||||
base + "/api/DniWolne",
|
base + '/api/DniWolne',
|
||||||
].sort(),
|
].sort(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/LoginEndpoint.aspx", (req, res) => {
|
router.all('/LoginEndpoint.aspx', (req, res) => {
|
||||||
if (req.params.customerSymbol !== "123456")
|
if (req.params.customerSymbol !== '123456')
|
||||||
res.redirect(
|
res.redirect(
|
||||||
protocol(req) +
|
protocol(req) +
|
||||||
"://" +
|
'://' +
|
||||||
req.get("host").replace("uczenplus", "uczen") +
|
req.get('host').replace('uczenplus', 'uczen') +
|
||||||
`/powiatwulkanowy/${req.params.customerSymbol}/LoginEndpoint.aspx`
|
`/powiatwulkanowy/${req.params.customerSymbol}/LoginEndpoint.aspx`
|
||||||
);
|
);
|
||||||
res.redirect(
|
res.redirect(protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456/App');
|
||||||
protocol(req) + "://" + req.get("host") + "/powiatwulkanowy/123456/App"
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
router.all("/App", (req, res) => {
|
router.all('/App', (req, res) => {
|
||||||
if (req.params.customerSymbol !== "123456")
|
if (req.params.customerSymbol !== '123456')
|
||||||
res.redirect(
|
res.redirect(
|
||||||
protocol(req) +
|
protocol(req) +
|
||||||
"://" +
|
'://' +
|
||||||
req.get("host").replace("uczenplus", "uczen") +
|
req.get('host').replace('uczenplus', 'uczen') +
|
||||||
`/powiatwulkanowy/${req.params.customerSymbol}/LoginEndpoint.aspx`
|
`/powiatwulkanowy/${req.params.customerSymbol}/LoginEndpoint.aspx`
|
||||||
);
|
);
|
||||||
res.render("uczenplus/app");
|
res.render('uczenplus/app');
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const router = express.Router()
|
const router = express.Router();
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
const converter = require('../utils/converter')
|
const converter = require('../utils/converter');
|
||||||
const { getRandomInt } = require('../utils/api')
|
const { getRandomInt } = require('../utils/api');
|
||||||
const md5 = require('md5')
|
const md5 = require('md5');
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.render('messages')
|
res.render('messages');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/-endpoints', (req, res) => {
|
router.get('/-endpoints', (req, res) => {
|
||||||
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy'
|
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy';
|
||||||
res.json({
|
res.json({
|
||||||
status: 'sucess',
|
status: 'sucess',
|
||||||
data: {
|
data: {
|
||||||
|
@ -33,19 +33,19 @@ router.get('/-endpoints', (req, res) => {
|
||||||
'/NowaWiadomosc.mvc/GetJednostkiUzytkownika',
|
'/NowaWiadomosc.mvc/GetJednostkiUzytkownika',
|
||||||
'/NowaWiadomosc.mvc/InsertWiadomosc',
|
'/NowaWiadomosc.mvc/InsertWiadomosc',
|
||||||
].map((item) => {
|
].map((item) => {
|
||||||
return base + item
|
return base + item;
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Wiadomosc.mvc/GetInboxMessages', (req, res) => {
|
router.get('/Wiadomosc.mvc/GetInboxMessages', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: require('../../data/api/messages/WiadomosciOdebrane').map((item) => {
|
data: require('../../data/api/messages/WiadomosciOdebrane').map((item) => {
|
||||||
const recipientsNumber = getRandomInt(60, 100)
|
const recipientsNumber = getRandomInt(60, 100);
|
||||||
const readBy = getRandomInt(20, 60)
|
const readBy = getRandomInt(20, 60);
|
||||||
const unreadBy = recipientsNumber - readBy
|
const unreadBy = recipientsNumber - readBy;
|
||||||
return {
|
return {
|
||||||
Id: item.WiadomoscId * 2,
|
Id: item.WiadomoscId * 2,
|
||||||
Nieprzeczytana: !item.GodzinaPrzeczytania,
|
Nieprzeczytana: !item.GodzinaPrzeczytania,
|
||||||
|
@ -69,10 +69,10 @@ router.get('/Wiadomosc.mvc/GetInboxMessages', (req, res) => {
|
||||||
HasZalaczniki: true,
|
HasZalaczniki: true,
|
||||||
FolderWiadomosci: 1,
|
FolderWiadomosci: 1,
|
||||||
Adresaci: [],
|
Adresaci: [],
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Wiadomosc.mvc/GetOutboxMessages', (req, res) => {
|
router.get('/Wiadomosc.mvc/GetOutboxMessages', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -101,10 +101,10 @@ router.get('/Wiadomosc.mvc/GetOutboxMessages', (req, res) => {
|
||||||
HasZalaczniki: false,
|
HasZalaczniki: false,
|
||||||
FolderWiadomosci: 2,
|
FolderWiadomosci: 2,
|
||||||
Adresaci: [],
|
Adresaci: [],
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/Wiadomosc.mvc/GetTrashboxMessages', (req, res) => {
|
router.get('/Wiadomosc.mvc/GetTrashboxMessages', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -133,13 +133,13 @@ router.get('/Wiadomosc.mvc/GetTrashboxMessages', (req, res) => {
|
||||||
HasZalaczniki: false,
|
HasZalaczniki: false,
|
||||||
FolderWiadomosci: 3,
|
FolderWiadomosci: 3,
|
||||||
Adresaci: [],
|
Adresaci: [],
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/NowaWiadomosc.mvc/GetJednostkiUzytkownika', (req, res) => {
|
router.get('/NowaWiadomosc.mvc/GetJednostkiUzytkownika', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: [
|
data: [
|
||||||
|
@ -152,11 +152,11 @@ router.get('/NowaWiadomosc.mvc/GetJednostkiUzytkownika', (req, res) => {
|
||||||
Id: user.Id,
|
Id: user.Id,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Adresaci.mvc/GetAddressee', (req, res) => {
|
router.all('/Adresaci.mvc/GetAddressee', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: require('../../data/api/dictionaries/Pracownicy').map((item) => {
|
data: require('../../data/api/dictionaries/Pracownicy').map((item) => {
|
||||||
|
@ -168,13 +168,13 @@ router.all('/Adresaci.mvc/GetAddressee', (req, res) => {
|
||||||
Role: 2,
|
Role: 2,
|
||||||
PushMessage: null,
|
PushMessage: null,
|
||||||
Hash: Buffer.from(md5(item.Id)).toString('base64'),
|
Hash: Buffer.from(md5(item.Id)).toString('base64'),
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get(['/Wiadomosc.mvc/GetAdresaciWiadomosci', '/Wiadomosc.mvc/GetMessageSenderRoles'], (req, res) => {
|
router.get(['/Wiadomosc.mvc/GetAdresaciWiadomosci', '/Wiadomosc.mvc/GetMessageSenderRoles'], (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: require('../../data/api/dictionaries/Pracownicy')
|
data: require('../../data/api/dictionaries/Pracownicy')
|
||||||
|
@ -188,10 +188,10 @@ router.get(['/Wiadomosc.mvc/GetAdresaciWiadomosci', '/Wiadomosc.mvc/GetMessageSe
|
||||||
Role: 2,
|
Role: 2,
|
||||||
PushMessage: null,
|
PushMessage: null,
|
||||||
Hash: Buffer.from(md5(item.Id)).toString('base64'),
|
Hash: Buffer.from(md5(item.Id)).toString('base64'),
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all(
|
router.all(
|
||||||
[
|
[
|
||||||
|
@ -200,7 +200,7 @@ router.all(
|
||||||
'/Wiadomosc.mvc/GetTrashboxMessageDetails',
|
'/Wiadomosc.mvc/GetTrashboxMessageDetails',
|
||||||
],
|
],
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
const message = require('../../data/api/messages/WiadomosciOdebrane')[0]
|
const message = require('../../data/api/messages/WiadomosciOdebrane')[0];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
|
@ -230,13 +230,13 @@ router.all(
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
||||||
router.all('/Wiadomosc.mvc/GetAdresaciNiePrzeczytaliWiadomosci', (req, res) => {
|
router.all('/Wiadomosc.mvc/GetAdresaciNiePrzeczytaliWiadomosci', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
const recipient = require('../../data/api/dictionaries/Pracownicy')[0]
|
const recipient = require('../../data/api/dictionaries/Pracownicy')[0];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: [
|
data: [
|
||||||
|
@ -250,12 +250,12 @@ router.all('/Wiadomosc.mvc/GetAdresaciNiePrzeczytaliWiadomosci', (req, res) => {
|
||||||
Hash: Buffer.from(md5(recipient.Id)).toString('base64'),
|
Hash: Buffer.from(md5(recipient.Id)).toString('base64'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Wiadomosc.mvc/GetAdresaciPrzeczytaliWiadomosc', (req, res) => {
|
router.all('/Wiadomosc.mvc/GetAdresaciPrzeczytaliWiadomosc', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
const recipient = require('../../data/api/dictionaries/Pracownicy')[1]
|
const recipient = require('../../data/api/dictionaries/Pracownicy')[1];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: [
|
data: [
|
||||||
|
@ -265,12 +265,12 @@ router.all('/Wiadomosc.mvc/GetAdresaciPrzeczytaliWiadomosc', (req, res) => {
|
||||||
Id: recipient.Id * 8, // ¯\_(ツ)_/¯
|
Id: recipient.Id * 8, // ¯\_(ツ)_/¯
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/Wiadomosc.mvc/GetMessageAddressee', (req, res) => {
|
router.all('/Wiadomosc.mvc/GetMessageAddressee', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
const recipient = require('../../data/api/dictionaries/Pracownicy')[1]
|
const recipient = require('../../data/api/dictionaries/Pracownicy')[1];
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: [
|
data: [
|
||||||
|
@ -282,8 +282,8 @@ router.all('/Wiadomosc.mvc/GetMessageAddressee', (req, res) => {
|
||||||
Hash: 'abcd==',
|
Hash: 'abcd==',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all(
|
router.all(
|
||||||
[
|
[
|
||||||
|
@ -294,18 +294,18 @@ router.all(
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
|
||||||
router.all('/NowaWiadomosc.mvc/InsertWiadomosc', (req, res) => {
|
router.all('/NowaWiadomosc.mvc/InsertWiadomosc', (req, res) => {
|
||||||
let data = req.body.incomming
|
let data = req.body.incomming;
|
||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
Adresaci: data.Adresaci.map((item) => {
|
Adresaci: data.Adresaci.map((item) => {
|
||||||
item.PushMessage = false
|
item.PushMessage = false;
|
||||||
return item
|
return item;
|
||||||
}),
|
}),
|
||||||
Temat: data.Temat,
|
Temat: data.Temat,
|
||||||
Tresc: data.Tresc,
|
Tresc: data.Tresc,
|
||||||
|
@ -321,7 +321,7 @@ router.all('/NowaWiadomosc.mvc/InsertWiadomosc', (req, res) => {
|
||||||
WiadomoscPowitalna: false,
|
WiadomoscPowitalna: false,
|
||||||
Id: data.Id,
|
Id: data.Id,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const router = express.Router()
|
const router = express.Router();
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
const { timestampToIsoTzFormat, dateToTimestamp } = require('../utils/converter')
|
const { timestampToIsoTzFormat, dateToTimestamp } = require('../utils/converter');
|
||||||
const { fromString } = require('uuidv4')
|
const { fromString } = require('uuidv4');
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.render('messages')
|
res.render('messages');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/LoginEndpoint.aspx', (req, res) => {
|
router.get('/LoginEndpoint.aspx', (req, res) => {
|
||||||
res.redirect('/')
|
res.redirect('/');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/-endpoints', (req, res) => {
|
router.get('/-endpoints', (req, res) => {
|
||||||
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy'
|
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy';
|
||||||
res.json({
|
res.json({
|
||||||
status: 'sucess',
|
status: 'sucess',
|
||||||
data: {
|
data: {
|
||||||
|
@ -32,19 +32,19 @@ router.get('/-endpoints', (req, res) => {
|
||||||
'/api/MoveTrash',
|
'/api/MoveTrash',
|
||||||
'/api/Delete',
|
'/api/Delete',
|
||||||
].map((item) => {
|
].map((item) => {
|
||||||
return base + item
|
return base + item;
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get(['/api/Odebrane', '/api/OdebraneSkrzynka'], (req, res) => {
|
router.get(['/api/Odebrane', '/api/OdebraneSkrzynka'], (req, res) => {
|
||||||
const currentTimestamp = dateToTimestamp(new Date())
|
const currentTimestamp = dateToTimestamp(new Date());
|
||||||
res.json(
|
res.json(
|
||||||
require('../../data/api/messages/WiadomosciOdebrane').map((item, i) => {
|
require('../../data/api/messages/WiadomosciOdebrane').map((item, i) => {
|
||||||
let itemTimestamp = item.DataWyslaniaUnixEpoch
|
let itemTimestamp = item.DataWyslaniaUnixEpoch;
|
||||||
if (i < 7) {
|
if (i < 7) {
|
||||||
itemTimestamp = currentTimestamp - i * i * 3600 * 6
|
itemTimestamp = currentTimestamp - i * i * 3600 * 6;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
apiGlobalKey: fromString(item.WiadomoscId.toString()),
|
apiGlobalKey: fromString(item.WiadomoscId.toString()),
|
||||||
|
@ -58,10 +58,10 @@ router.get(['/api/Odebrane', '/api/OdebraneSkrzynka'], (req, res) => {
|
||||||
wazna: false,
|
wazna: false,
|
||||||
uzytkownikRola: 2,
|
uzytkownikRola: 2,
|
||||||
id: item.WiadomoscId,
|
id: item.WiadomoscId,
|
||||||
}
|
};
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.get(['/api/Wyslane', '/api/WyslaneSkrzynka'], (req, res) => {
|
router.get(['/api/Wyslane', '/api/WyslaneSkrzynka'], (req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -78,10 +78,10 @@ router.get(['/api/Wyslane', '/api/WyslaneSkrzynka'], (req, res) => {
|
||||||
wazna: false,
|
wazna: false,
|
||||||
uzytkownikRola: 2,
|
uzytkownikRola: 2,
|
||||||
id: item.WiadomoscId,
|
id: item.WiadomoscId,
|
||||||
}
|
};
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.get(['/api/Usuniete', '/api/UsunieteSkrzynka'], (req, res) => {
|
router.get(['/api/Usuniete', '/api/UsunieteSkrzynka'], (req, res) => {
|
||||||
res.json(
|
res.json(
|
||||||
|
@ -98,26 +98,26 @@ router.get(['/api/Usuniete', '/api/UsunieteSkrzynka'], (req, res) => {
|
||||||
wazna: false,
|
wazna: false,
|
||||||
uzytkownikRola: 2,
|
uzytkownikRola: 2,
|
||||||
id: item.WiadomoscId,
|
id: item.WiadomoscId,
|
||||||
}
|
};
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.get('/api/Skrzynki', (req, res) => {
|
router.get('/api/Skrzynki', (req, res) => {
|
||||||
const users = require('../../data/api/ListaUczniow')
|
const users = require('../../data/api/ListaUczniow');
|
||||||
res.json(
|
res.json(
|
||||||
users.map((user) => {
|
users.map((user) => {
|
||||||
return {
|
return {
|
||||||
globalKey: fromString(user.UzytkownikLoginId.toString()),
|
globalKey: fromString(user.UzytkownikLoginId.toString()),
|
||||||
nazwa: `${user.Imie} ${user.Nazwisko} - U - (${user.JednostkaSprawozdawczaSkrot})`,
|
nazwa: `${user.Imie} ${user.Nazwisko} - U - (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
typUzytkownika: 3,
|
typUzytkownika: 3,
|
||||||
}
|
};
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.all('/api/WiadomoscSzczegoly', (req, res) => {
|
router.all('/api/WiadomoscSzczegoly', (req, res) => {
|
||||||
const message = require('../../data/api/messages/WiadomosciOdebrane')[0]
|
const message = require('../../data/api/messages/WiadomosciOdebrane')[0];
|
||||||
res.json({
|
res.json({
|
||||||
data: timestampToIsoTzFormat(message.DataWyslaniaUnixEpoch),
|
data: timestampToIsoTzFormat(message.DataWyslaniaUnixEpoch),
|
||||||
apiGlobalKey: fromString(message.WiadomoscId.toString()),
|
apiGlobalKey: fromString(message.WiadomoscId.toString()),
|
||||||
|
@ -141,12 +141,12 @@ router.all('/api/WiadomoscSzczegoly', (req, res) => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
id: message.WiadomoscId,
|
id: message.WiadomoscId,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/WiadomoscOdpowiedzPrzekaz', (req, res) => {
|
router.all('/api/WiadomoscOdpowiedzPrzekaz', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
const message = require('../../data/api/messages/WiadomosciOdebrane')[0]
|
const message = require('../../data/api/messages/WiadomosciOdebrane')[0];
|
||||||
res.json({
|
res.json({
|
||||||
data: timestampToIsoTzFormat(message.DataWyslaniaUnixEpoch),
|
data: timestampToIsoTzFormat(message.DataWyslaniaUnixEpoch),
|
||||||
apiGlobalKey: fromString(message.WiadomoscId.toString()),
|
apiGlobalKey: fromString(message.WiadomoscId.toString()),
|
||||||
|
@ -168,28 +168,28 @@ router.all('/api/WiadomoscOdpowiedzPrzekaz', (req, res) => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
id: message.WiadomoscId,
|
id: message.WiadomoscId,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/Pracownicy', (req, res) => {
|
router.all('/api/Pracownicy', (req, res) => {
|
||||||
const user = require('../../data/api/ListaUczniow')[1]
|
const user = require('../../data/api/ListaUczniow')[1];
|
||||||
const recipients = require('../../data/api/dictionaries/Pracownicy')
|
const recipients = require('../../data/api/dictionaries/Pracownicy');
|
||||||
res.json(
|
res.json(
|
||||||
recipients.map((item) => {
|
recipients.map((item) => {
|
||||||
return {
|
return {
|
||||||
skrzynkaGlobalKey: fromString(item.Id.toString()),
|
skrzynkaGlobalKey: fromString(item.Id.toString()),
|
||||||
nazwa: `${item.Nazwisko} ${item.Imie} - P - (${user.JednostkaSprawozdawczaSkrot})`,
|
nazwa: `${item.Nazwisko} ${item.Imie} - P - (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
}
|
};
|
||||||
})
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
router.all(['/api/MoveTrash', '/api/Delete'], (req, res) => {
|
router.all(['/api/MoveTrash', '/api/Delete'], (req, res) => {
|
||||||
res.status(204).send()
|
res.status(204).send();
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/api/WiadomoscNowa', (req, res) => {
|
router.all('/api/WiadomoscNowa', (req, res) => {
|
||||||
res.status(204).send()
|
res.status(204).send();
|
||||||
})
|
});
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
const express = require('express')
|
const express = require('express');
|
||||||
const router = express.Router()
|
const router = express.Router();
|
||||||
const protocol = require('../utils/connection')
|
const protocol = require('../utils/connection');
|
||||||
|
|
||||||
router.get('/powiatwulkanowy/Start.mvc/Endpoints', (req, res) => {
|
router.get('/powiatwulkanowy/Start.mvc/Endpoints', (req, res) => {
|
||||||
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/Start.mvc'
|
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/Start.mvc';
|
||||||
res.json({
|
res.json({
|
||||||
status: 'success',
|
status: 'success',
|
||||||
data: {
|
data: {
|
||||||
|
@ -22,11 +22,11 @@ router.get('/powiatwulkanowy/Start.mvc/Endpoints', (req, res) => {
|
||||||
'/GetLastAnnouncements',
|
'/GetLastAnnouncements',
|
||||||
'/GetStudentDirectorInformations',
|
'/GetStudentDirectorInformations',
|
||||||
].map((item) => {
|
].map((item) => {
|
||||||
return base + item
|
return base + item;
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetSelfGovernments', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetSelfGovernments', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -34,8 +34,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetSelfGovernments', (req, res) => {
|
||||||
success: true,
|
success: true,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetStudentTrips', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetStudentTrips', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -43,20 +43,20 @@ router.all('/powiatwulkanowy/Start.mvc/GetStudentTrips', (req, res) => {
|
||||||
success: true,
|
success: true,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetLastNotes', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetLastNotes', (req, res) => {
|
||||||
res.json(require('../../data/uonetplus/GetLastNotes'))
|
res.json(require('../../data/uonetplus/GetLastNotes'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetFreeDays', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetFreeDays', (req, res) => {
|
||||||
res.json(require('../../data/uonetplus/GetFreeDays'))
|
res.json(require('../../data/uonetplus/GetFreeDays'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetKidsLuckyNumbers', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetKidsLuckyNumbers', (req, res) => {
|
||||||
res.json(require('../../data/uonetplus/GetKidsLuckyNumbers'))
|
res.json(require('../../data/uonetplus/GetKidsLuckyNumbers'));
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetKidsLessonPlan', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetKidsLessonPlan', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -64,8 +64,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetKidsLessonPlan', (req, res) => {
|
||||||
success: true,
|
success: true,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetNumberOfUnreadMessages', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetNumberOfUnreadMessages', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -73,8 +73,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetNumberOfUnreadMessages', (req, res) =>
|
||||||
success: false,
|
success: false,
|
||||||
errorMessage: 'Not implemented yet',
|
errorMessage: 'Not implemented yet',
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetLastHomeworks', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetLastHomeworks', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -82,8 +82,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetLastHomeworks', (req, res) => {
|
||||||
success: true,
|
success: true,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetLastTests', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetLastTests', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -91,8 +91,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetLastTests', (req, res) => {
|
||||||
success: true,
|
success: true,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetStudentConferences', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetStudentConferences', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -100,8 +100,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetStudentConferences', (req, res) => {
|
||||||
success: false,
|
success: false,
|
||||||
errorMessage: 'Not implemented yet',
|
errorMessage: 'Not implemented yet',
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetLastStudentLessons', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetLastStudentLessons', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -109,8 +109,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetLastStudentLessons', (req, res) => {
|
||||||
success: true,
|
success: true,
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetStudentDirectorInformations', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetStudentDirectorInformations', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -118,8 +118,8 @@ router.all('/powiatwulkanowy/Start.mvc/GetStudentDirectorInformations', (req, re
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
success: true,
|
success: true,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all('/powiatwulkanowy/Start.mvc/GetLastAnnouncements', (req, res) => {
|
router.all('/powiatwulkanowy/Start.mvc/GetLastAnnouncements', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
|
@ -127,58 +127,46 @@ router.all('/powiatwulkanowy/Start.mvc/GetLastAnnouncements', (req, res) => {
|
||||||
errorMessage: null,
|
errorMessage: null,
|
||||||
feedback: null,
|
feedback: null,
|
||||||
success: true,
|
success: true,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
res.render('log-exception', {
|
res.render('log-exception', {
|
||||||
title: 'Dziennik FakeUONET+',
|
title: 'Dziennik FakeUONET+',
|
||||||
message: 'Podany identyfikator klienta jest niepoprawny.',
|
message: 'Podany identyfikator klienta jest niepoprawny.',
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
router.all(/^\/([a-z0-9]+)(?:\/LoginEndpoint\.aspx|\/)?$/i, (req, res) => {
|
router.all(/^\/([a-z0-9]+)(?:\/LoginEndpoint\.aspx|\/)?$/i, (req, res) => {
|
||||||
let hasCert = req.body.wa && req.body.wresult
|
let hasCert = req.body.wa && req.body.wresult;
|
||||||
|
|
||||||
if (req.params[0] != 'powiatwulkanowy') {
|
if (req.params[0] != 'powiatwulkanowy') {
|
||||||
if (hasCert)
|
if (hasCert)
|
||||||
res.render('permission-error', {
|
res.render('permission-error', {
|
||||||
title: 'Logowanie',
|
title: 'Logowanie',
|
||||||
})
|
});
|
||||||
else
|
else
|
||||||
res.render('log-exception', {
|
res.render('log-exception', {
|
||||||
title: 'Dziennik FakeUONET+',
|
title: 'Dziennik FakeUONET+',
|
||||||
message: 'Podany identyfikator klienta jest niepoprawny.',
|
message: 'Podany identyfikator klienta jest niepoprawny.',
|
||||||
})
|
});
|
||||||
|
|
||||||
return
|
return;
|
||||||
} else if (hasCert) {
|
} else if (hasCert) {
|
||||||
return res.redirect('/powiatwulkanowy/Start.mvc/Index')
|
return res.redirect('/powiatwulkanowy/Start.mvc/Index');
|
||||||
}
|
}
|
||||||
|
|
||||||
res.redirect(protocol(req) + '://' + req.get('host').replace('uonetplus', 'cufs') + '/powiatwulkanowy/Account/LogOn')
|
res.redirect(protocol(req) + '://' + req.get('host').replace('uonetplus', 'cufs') + '/powiatwulkanowy/Account/LogOn');
|
||||||
})
|
});
|
||||||
|
|
||||||
router.get(["/powiatwulkanowy/Start.mvc", "/powiatwulkanowy/Start.mvc/Index"], (req, res) => {
|
router.get(['/powiatwulkanowy/Start.mvc', '/powiatwulkanowy/Start.mvc/Index'], (req, res) => {
|
||||||
res.render("homepage", {
|
res.render('homepage', {
|
||||||
title: "Uonet+",
|
title: 'Uonet+',
|
||||||
uonetplusOpiekun:
|
uonetplusOpiekun: protocol(req) + '://' + req.get('host').replace('uonetplus', 'uonetplus-opiekun'),
|
||||||
protocol(req) +
|
uonetplusUczen: protocol(req) + '://' + req.get('host').replace('uonetplus', 'uonetplus-uczen'),
|
||||||
"://" +
|
uonetplusUczenplus: protocol(req) + '://' + req.get('host').replace('uonetplus', 'uonetplus-uczenplus'),
|
||||||
req.get("host").replace("uonetplus", "uonetplus-opiekun"),
|
uonetplusWiadomosciplus: protocol(req) + '://' + req.get('host').replace('uonetplus', 'uonetplus-wiadomosciplus'),
|
||||||
uonetplusUczen:
|
});
|
||||||
protocol(req) +
|
});
|
||||||
"://" +
|
|
||||||
req.get("host").replace("uonetplus", "uonetplus-uczen"),
|
|
||||||
uonetplusUczenplus:
|
|
||||||
protocol(req) +
|
|
||||||
"://" +
|
|
||||||
req.get("host").replace("uonetplus", "uonetplus-uczenplus"),
|
|
||||||
uonetplusWiadomosciplus:
|
|
||||||
protocol(req) +
|
|
||||||
"://" +
|
|
||||||
req.get("host").replace("uonetplus", "uonetplus-wiadomosciplus"),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { uuid } = require('uuidv4')
|
const { uuid } = require('uuidv4');
|
||||||
|
|
||||||
function createResponse(data) {
|
function createResponse(data) {
|
||||||
return {
|
return {
|
||||||
|
@ -9,14 +9,14 @@ function createResponse(data) {
|
||||||
DayOfWeek: new Date().getDay(),
|
DayOfWeek: new Date().getDay(),
|
||||||
AppVersion: '17.09.0009.26859',
|
AppVersion: '17.09.0009.26859',
|
||||||
Data: data,
|
Data: data,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomInt(min, max) {
|
function getRandomInt(min, max) {
|
||||||
min = Math.ceil(min)
|
min = Math.ceil(min);
|
||||||
max = Math.floor(max)
|
max = Math.floor(max);
|
||||||
return Math.floor(Math.random() * (max - min)) + min
|
return Math.floor(Math.random() * (max - min)) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.createResponse = createResponse
|
exports.createResponse = createResponse;
|
||||||
exports.getRandomInt = getRandomInt
|
exports.getRandomInt = getRandomInt;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
module.exports = function (req) {
|
module.exports = function (req) {
|
||||||
const isConnectionEncrypted = req.connection.encrypted
|
const isConnectionEncrypted = req.connection.encrypted;
|
||||||
const isSslEnvSet = process.env.SSL === 'true'
|
const isSslEnvSet = process.env.SSL === 'true';
|
||||||
const isHeaderSsl = req.header('x-forwarded-proto') === 'https'
|
const isHeaderSsl = req.header('x-forwarded-proto') === 'https';
|
||||||
|
|
||||||
const proto = isConnectionEncrypted || isSslEnvSet || isHeaderSsl ? 'https' : 'http'
|
const proto = isConnectionEncrypted || isSslEnvSet || isHeaderSsl ? 'https' : 'http';
|
||||||
|
|
||||||
return proto.split(/\s*,\s*/)[0]
|
return proto.split(/\s*,\s*/)[0];
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,99 +1,99 @@
|
||||||
const { addDays, toDate, format, getTime } = require('date-fns')
|
const { addDays, toDate, format, getTime } = require('date-fns');
|
||||||
const WEEK_TICK = 6048000000000
|
const WEEK_TICK = 6048000000000;
|
||||||
const DAY_TICK = 864000000000
|
const DAY_TICK = 864000000000;
|
||||||
|
|
||||||
function getDateFromTick(tick) {
|
function getDateFromTick(tick) {
|
||||||
if (tick === '' || tick === undefined) {
|
if (tick === '' || tick === undefined) {
|
||||||
return getMonday(new Date())
|
return getMonday(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Date((tick - 621355968000000000) / 10000)
|
return new Date((tick - 621355968000000000) / 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTickFromDate(date) {
|
function getTickFromDate(date) {
|
||||||
return date.getTime() * 10000 + 621355968000000000
|
return date.getTime() * 10000 + 621355968000000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(today, iso = false) {
|
function formatDate(today, iso = false) {
|
||||||
let dd = today.getDate()
|
let dd = today.getDate();
|
||||||
let mm = today.getMonth() + 1 //January is 0!
|
let mm = today.getMonth() + 1; //January is 0!
|
||||||
|
|
||||||
let yyyy = today.getFullYear()
|
let yyyy = today.getFullYear();
|
||||||
|
|
||||||
if (dd < 10) {
|
if (dd < 10) {
|
||||||
dd = '0' + dd
|
dd = '0' + dd;
|
||||||
}
|
}
|
||||||
if (mm < 10) {
|
if (mm < 10) {
|
||||||
mm = '0' + mm
|
mm = '0' + mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iso) return `${yyyy}-${mm}-${dd}`
|
if (iso) return `${yyyy}-${mm}-${dd}`;
|
||||||
|
|
||||||
return `${dd}.${mm}.${yyyy}`
|
return `${dd}.${mm}.${yyyy}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function timestampToIsoTzFormat(timestamp) {
|
function timestampToIsoTzFormat(timestamp) {
|
||||||
return format(new Date(timestamp * 1000), "yyyy-MM-dd'T'HH:mm:ss.SSXXX")
|
return format(new Date(timestamp * 1000), "yyyy-MM-dd'T'HH:mm:ss.SSXXX");
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateToTimestamp(date) {
|
function dateToTimestamp(date) {
|
||||||
return getTime(date) / 1000
|
return getTime(date) / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMonday(date) {
|
function getMonday(date) {
|
||||||
let day = date.getDate() - date.getDay() + 1
|
let day = date.getDate() - date.getDay() + 1;
|
||||||
return new Date(date.getFullYear(), date.getMonth(), day)
|
return new Date(date.getFullYear(), date.getMonth(), day);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDayName(dateStr) {
|
function getDayName(dateStr) {
|
||||||
return new Date(dateStr).toLocaleDateString('pl', { weekday: 'long' })
|
return new Date(dateStr).toLocaleDateString('pl', { weekday: 'long' });
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWeekDaysFrom(startDate, number = 5) {
|
function getWeekDaysFrom(startDate, number = 5) {
|
||||||
if (!(startDate instanceof Date)) startDate = getDateFromTick(startDate)
|
if (!(startDate instanceof Date)) startDate = getDateFromTick(startDate);
|
||||||
|
|
||||||
const days = []
|
const days = [];
|
||||||
for (let i = 0; i < number; i++) {
|
for (let i = 0; i < number; i++) {
|
||||||
let date = addDays(startDate, i)
|
let date = addDays(startDate, i);
|
||||||
days.push([getDayName(date), formatDate(toDate(date)), date])
|
days.push([getDayName(date), formatDate(toDate(date)), date]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return days
|
return days;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPrevWeekTick(tick) {
|
function getPrevWeekTick(tick) {
|
||||||
return getPrevTick(tick, WEEK_TICK)
|
return getPrevTick(tick, WEEK_TICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPrevDayTick(tick) {
|
function getPrevDayTick(tick) {
|
||||||
return getPrevTick(tick, DAY_TICK)
|
return getPrevTick(tick, DAY_TICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextWeekTick(tick) {
|
function getNextWeekTick(tick) {
|
||||||
return getNextTick(tick, WEEK_TICK)
|
return getNextTick(tick, WEEK_TICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextDayTick(tick) {
|
function getNextDayTick(tick) {
|
||||||
return getNextTick(tick, DAY_TICK)
|
return getNextTick(tick, DAY_TICK);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextTick(tick, plus) {
|
function getNextTick(tick, plus) {
|
||||||
tick = tick ? tick : getTickFromDate(new Date())
|
tick = tick ? tick : getTickFromDate(new Date());
|
||||||
return parseInt(tick) + plus
|
return parseInt(tick) + plus;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPrevTick(tick, minus) {
|
function getPrevTick(tick, minus) {
|
||||||
tick = tick ? tick : getTickFromDate(new Date())
|
tick = tick ? tick : getTickFromDate(new Date());
|
||||||
return parseInt(tick) - minus
|
return parseInt(tick) - minus;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getDateString = getDateFromTick
|
exports.getDateString = getDateFromTick;
|
||||||
exports.getWeekDaysFrom = getWeekDaysFrom
|
exports.getWeekDaysFrom = getWeekDaysFrom;
|
||||||
exports.getDayName = getDayName
|
exports.getDayName = getDayName;
|
||||||
exports.getPrevDayTick = getPrevDayTick
|
exports.getPrevDayTick = getPrevDayTick;
|
||||||
exports.getNextDayTick = getNextDayTick
|
exports.getNextDayTick = getNextDayTick;
|
||||||
exports.getPrevWeekTick = getPrevWeekTick
|
exports.getPrevWeekTick = getPrevWeekTick;
|
||||||
exports.getNextWeekTick = getNextWeekTick
|
exports.getNextWeekTick = getNextWeekTick;
|
||||||
exports.formatDate = formatDate
|
exports.formatDate = formatDate;
|
||||||
exports.timestampToIsoTzFormat = timestampToIsoTzFormat
|
exports.timestampToIsoTzFormat = timestampToIsoTzFormat;
|
||||||
exports.dateToTimestamp = dateToTimestamp
|
exports.dateToTimestamp = dateToTimestamp;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
function getByValue(dictionary, index, value, def = {}) {
|
function getByValue(dictionary, index, value, def = {}) {
|
||||||
const val = dictionary.filter((obj) => {
|
const val = dictionary.filter((obj) => {
|
||||||
return obj[index] === value
|
return obj[index] === value;
|
||||||
})[0]
|
})[0];
|
||||||
|
|
||||||
if (!val) return def
|
if (!val) return def;
|
||||||
return val
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getByValue = getByValue
|
exports.getByValue = getByValue;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
exports.getGradeColorByCategoryName = (name) => {
|
exports.getGradeColorByCategoryName = (name) => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case name.includes('czarny'):
|
case name.includes('czarny'):
|
||||||
return '000000'
|
return '000000';
|
||||||
case name.includes('czerw'):
|
case name.includes('czerw'):
|
||||||
return 'F04C4C'
|
return 'F04C4C';
|
||||||
case name.includes('fiol'):
|
case name.includes('fiol'):
|
||||||
return 'B16CF1'
|
return 'B16CF1';
|
||||||
case name.includes('nieb'):
|
case name.includes('nieb'):
|
||||||
return '20A4F7'
|
return '20A4F7';
|
||||||
case name.includes('zielony'):
|
case name.includes('zielony'):
|
||||||
return '6ECD07'
|
return '6ECD07';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue