Add prettier and format code (#58)
This commit is contained in:
parent
a7c348c815
commit
c097154a80
56 changed files with 3450 additions and 3127 deletions
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
|
@ -2,7 +2,7 @@ name: Deploy to Oracle Cloud
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
|
25
.github/workflows/prettier.yml
vendored
Normal file
25
.github/workflows/prettier.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
name: Continuous Integration
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prettier:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
# Make sure the actual branch is checked out when running on pull requests
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
# This is important to fetch the changes to the previous commit
|
||||||
|
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
|
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
|
@ -2,7 +2,7 @@ name: Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
|
7
.prettierrc
Normal file
7
.prettierrc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"tabWidth": 2,
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 120
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ docker-compose up
|
||||||
You can add `-d` to both `docker run` and `docker-compose up` in order to run in "detached" mode (in background)
|
You can add `-d` to both `docker run` and `docker-compose up` in order to run in "detached" mode (in background)
|
||||||
|
|
||||||
## Nginx reverse proxy
|
## Nginx reverse proxy
|
||||||
|
|
||||||
We provide example nginx config file [fakelog.nginx](fakelog.nginx). You will need to change SSL certificates paths and domain names. You may need to change `proxy_pass` URL
|
We provide example nginx config file [fakelog.nginx](fakelog.nginx). You will need to change SSL certificates paths and domain names. You may need to change `proxy_pass` URL
|
||||||
|
|
||||||
## Login
|
## Login
|
||||||
|
|
135
app.js
135
app.js
|
@ -1,89 +1,98 @@
|
||||||
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", "", { httpOnly: true, domain: req.get("host") });
|
res.cookie('UonetPlus_ASP.NET_SessionId', '', {
|
||||||
res.cookie("ARR_DS_ARR301302", "", { httpOnly: true, domain: req.get("host") });
|
httpOnly: true,
|
||||||
res.cookie("ARR_" + req.get('host'), "1234567891012131314151617181920212223242526272829303132333435363", { httpOnly: true, domain: req.get("host") });
|
domain: req.get('host'),
|
||||||
next();
|
})
|
||||||
});
|
res.cookie('ARR_DS_ARR301302', '', {
|
||||||
|
httpOnly: true,
|
||||||
|
domain: req.get('host'),
|
||||||
|
})
|
||||||
|
res.cookie('ARR_' + req.get('host'), '1234567891012131314151617181920212223242526272829303132333435363', {
|
||||||
|
httpOnly: true,
|
||||||
|
domain: req.get('host'),
|
||||||
|
})
|
||||||
|
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(subdomain('uonetplus-uczenplus', uonetplusUczenplus.use('/powiatwulkanowy/:customerSymbol', uonetplusUczenplus)))
|
||||||
app.use(subdomain('uonetplus-uzytkownik', uonetplusUzytkownik.use('/powiatwulkanowy', uonetplusUzytkownik)));
|
app.use(subdomain('uonetplus-uzytkownik', uonetplusUzytkownik.use('/powiatwulkanowy', uonetplusUzytkownik)))
|
||||||
app.use(subdomain('uonetplus-wiadomosciplus', uonetplusWiadomosciplus.use('/powiatwulkanowy', uonetplusWiadomosciplus)));
|
app.use(subdomain('uonetplus-wiadomosciplus', uonetplusWiadomosciplus.use('/powiatwulkanowy', uonetplusWiadomosciplus)))
|
||||||
app.use('/', index);
|
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
|
||||||
|
|
54
bin/www
54
bin/www
|
@ -3,45 +3,45 @@
|
||||||
/**
|
/**
|
||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
const app = require('../app');
|
const app = require('../app')
|
||||||
const debug = require('debug')('fake-log:server');
|
const debug = require('debug')('fake-log:server')
|
||||||
const http = require('http');
|
const http = require('http')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get port from environment and store in Express.
|
* Get port from environment and store in Express.
|
||||||
*/
|
*/
|
||||||
const port = normalizePort(process.env.PORT || '3000');
|
const port = normalizePort(process.env.PORT || '3000')
|
||||||
app.set('port', port);
|
app.set('port', port)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create HTTP server.
|
* Create HTTP server.
|
||||||
*/
|
*/
|
||||||
const server = http.createServer(app);
|
const server = http.createServer(app)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen on provided port, on all network interfaces.
|
* Listen on provided port, on all network interfaces.
|
||||||
*/
|
*/
|
||||||
server.listen(port);
|
server.listen(port)
|
||||||
server.on('error', onError);
|
server.on('error', onError)
|
||||||
server.on('listening', onListening);
|
server.on('listening', onListening)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize a port into a number, string, or false.
|
* Normalize a port into a number, string, or false.
|
||||||
*/
|
*/
|
||||||
function normalizePort(val) {
|
function normalizePort(val) {
|
||||||
let port = parseInt(val, 10);
|
let port = parseInt(val, 10)
|
||||||
|
|
||||||
if (isNaN(port)) {
|
if (isNaN(port)) {
|
||||||
// named pipe
|
// named pipe
|
||||||
return val;
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port >= 0) {
|
if (port >= 0) {
|
||||||
// port number
|
// port number
|
||||||
return port;
|
return port
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,25 +49,23 @@ function normalizePort(val) {
|
||||||
*/
|
*/
|
||||||
function onError(error) {
|
function onError(error) {
|
||||||
if (error.syscall !== 'listen') {
|
if (error.syscall !== 'listen') {
|
||||||
throw error;
|
throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
let bind = typeof port === 'string'
|
let bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port
|
||||||
? 'Pipe ' + port
|
|
||||||
: 'Port ' + port;
|
|
||||||
|
|
||||||
// handle specific listen errors with friendly messages
|
// handle specific listen errors with friendly messages
|
||||||
switch (error.code) {
|
switch (error.code) {
|
||||||
case 'EACCES':
|
case 'EACCES':
|
||||||
console.error(bind + ' requires elevated privileges');
|
console.error(bind + ' requires elevated privileges')
|
||||||
process.exit(1);
|
process.exit(1)
|
||||||
break;
|
break
|
||||||
case 'EADDRINUSE':
|
case 'EADDRINUSE':
|
||||||
console.error(bind + ' is already in use');
|
console.error(bind + ' is already in use')
|
||||||
process.exit(1);
|
process.exit(1)
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
throw error;
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,9 +73,7 @@ function onError(error) {
|
||||||
* Event listener for HTTP server "listening" event.
|
* Event listener for HTTP server "listening" event.
|
||||||
*/
|
*/
|
||||||
function onListening() {
|
function onListening() {
|
||||||
let addr = server.address();
|
let addr = server.address()
|
||||||
let bind = typeof addr === 'string'
|
let bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port
|
||||||
? 'pipe ' + addr
|
debug('Listening on ' + bind)
|
||||||
: 'port ' + addr.port;
|
|
||||||
debug('Listening on ' + bind);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
"IdPrzedmiot": 300,
|
"IdPrzedmiot": 300,
|
||||||
"IdKategoria": 26,
|
"IdKategoria": 26,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 5.00,
|
"WagaOceny": 5.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -28,9 +28,9 @@
|
||||||
"IdPrzedmiot": 300,
|
"IdPrzedmiot": 300,
|
||||||
"IdKategoria": 26,
|
"IdKategoria": 26,
|
||||||
"Wpis": "4",
|
"Wpis": "4",
|
||||||
"Wartosc": 4.00,
|
"Wartosc": 4.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 5.00,
|
"WagaOceny": 5.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -50,9 +50,9 @@
|
||||||
"IdPrzedmiot": 301,
|
"IdPrzedmiot": 301,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 5.00,
|
"WagaOceny": 5.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -72,9 +72,9 @@
|
||||||
"IdPrzedmiot": 301,
|
"IdPrzedmiot": 301,
|
||||||
"IdKategoria": 29,
|
"IdKategoria": 29,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 6.00,
|
"WagaOceny": 6.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -94,9 +94,9 @@
|
||||||
"IdPrzedmiot": 301,
|
"IdPrzedmiot": 301,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "4",
|
"Wpis": "4",
|
||||||
"Wartosc": 4.00,
|
"Wartosc": 4.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -116,9 +116,9 @@
|
||||||
"IdPrzedmiot": 301,
|
"IdPrzedmiot": 301,
|
||||||
"IdKategoria": 26,
|
"IdKategoria": 26,
|
||||||
"Wpis": "4",
|
"Wpis": "4",
|
||||||
"Wartosc": 4.00,
|
"Wartosc": 4.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 1.00,
|
"WagaOceny": 1.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -138,9 +138,9 @@
|
||||||
"IdPrzedmiot": 301,
|
"IdPrzedmiot": 301,
|
||||||
"IdKategoria": 29,
|
"IdKategoria": 29,
|
||||||
"Wpis": "2",
|
"Wpis": "2",
|
||||||
"Wartosc": 2.00,
|
"Wartosc": 2.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 6.00,
|
"WagaOceny": 6.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -160,9 +160,9 @@
|
||||||
"IdPrzedmiot": 301,
|
"IdPrzedmiot": 301,
|
||||||
"IdKategoria": 30,
|
"IdKategoria": 30,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 2.00,
|
"WagaOceny": 2.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -182,9 +182,9 @@
|
||||||
"IdPrzedmiot": 308,
|
"IdPrzedmiot": 308,
|
||||||
"IdKategoria": 26,
|
"IdKategoria": 26,
|
||||||
"Wpis": "1",
|
"Wpis": "1",
|
||||||
"Wartosc": 1.00,
|
"Wartosc": 1.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 6.00,
|
"WagaOceny": 6.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -204,9 +204,9 @@
|
||||||
"IdPrzedmiot": 308,
|
"IdPrzedmiot": 308,
|
||||||
"IdKategoria": 27,
|
"IdKategoria": 27,
|
||||||
"Wpis": "2",
|
"Wpis": "2",
|
||||||
"Wartosc": 2.00,
|
"Wartosc": 2.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 5.00,
|
"WagaOceny": 5.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -226,9 +226,9 @@
|
||||||
"IdPrzedmiot": 308,
|
"IdPrzedmiot": 308,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 2.00,
|
"WagaOceny": 2.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -248,9 +248,9 @@
|
||||||
"IdPrzedmiot": 308,
|
"IdPrzedmiot": 308,
|
||||||
"IdKategoria": 29,
|
"IdKategoria": 29,
|
||||||
"Wpis": "4",
|
"Wpis": "4",
|
||||||
"Wartosc": 4.00,
|
"Wartosc": 4.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 5.00,
|
"WagaOceny": 5.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -270,9 +270,9 @@
|
||||||
"IdPrzedmiot": 308,
|
"IdPrzedmiot": 308,
|
||||||
"IdKategoria": 30,
|
"IdKategoria": 30,
|
||||||
"Wpis": "5",
|
"Wpis": "5",
|
||||||
"Wartosc": 5.00,
|
"Wartosc": 5.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 6.00,
|
"WagaOceny": 6.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -292,9 +292,9 @@
|
||||||
"IdPrzedmiot": 308,
|
"IdPrzedmiot": 308,
|
||||||
"IdKategoria": 65,
|
"IdKategoria": 65,
|
||||||
"Wpis": "6",
|
"Wpis": "6",
|
||||||
"Wartosc": 6.00,
|
"Wartosc": 6.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 1.00,
|
"WagaOceny": 1.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -314,9 +314,9 @@
|
||||||
"IdPrzedmiot": 307,
|
"IdPrzedmiot": 307,
|
||||||
"IdKategoria": 27,
|
"IdKategoria": 27,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 1.00,
|
"WagaOceny": 1.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -336,9 +336,9 @@
|
||||||
"IdPrzedmiot": 307,
|
"IdPrzedmiot": 307,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "5",
|
"Wpis": "5",
|
||||||
"Wartosc": 5.00,
|
"Wartosc": 5.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -358,9 +358,9 @@
|
||||||
"IdPrzedmiot": 310,
|
"IdPrzedmiot": 310,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "4",
|
"Wpis": "4",
|
||||||
"Wartosc": 4.00,
|
"Wartosc": 4.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -380,9 +380,9 @@
|
||||||
"IdPrzedmiot": 311,
|
"IdPrzedmiot": 311,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "3",
|
"Wpis": "3",
|
||||||
"Wartosc": 3.00,
|
"Wartosc": 3.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -402,9 +402,9 @@
|
||||||
"IdPrzedmiot": 312,
|
"IdPrzedmiot": 312,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "2",
|
"Wpis": "2",
|
||||||
"Wartosc": 2.00,
|
"Wartosc": 2.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -424,9 +424,9 @@
|
||||||
"IdPrzedmiot": 313,
|
"IdPrzedmiot": 313,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "1",
|
"Wpis": "1",
|
||||||
"Wartosc": 1.00,
|
"Wartosc": 1.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -446,9 +446,9 @@
|
||||||
"IdPrzedmiot": 313,
|
"IdPrzedmiot": 313,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "1",
|
"Wpis": "1",
|
||||||
"Wartosc": 1.00,
|
"Wartosc": 1.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 3.00,
|
"WagaOceny": 3.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -468,9 +468,9 @@
|
||||||
"IdPrzedmiot": 313,
|
"IdPrzedmiot": 313,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "75/100",
|
"Wpis": "75/100",
|
||||||
"Wartosc": 0.00,
|
"Wartosc": 0.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 0.00,
|
"WagaOceny": 0.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
@ -490,9 +490,9 @@
|
||||||
"IdPrzedmiot": 303,
|
"IdPrzedmiot": 303,
|
||||||
"IdKategoria": 28,
|
"IdKategoria": 28,
|
||||||
"Wpis": "4",
|
"Wpis": "4",
|
||||||
"Wartosc": 4.00,
|
"Wartosc": 4.0,
|
||||||
"WagaModyfikatora": null,
|
"WagaModyfikatora": null,
|
||||||
"WagaOceny": 0.00,
|
"WagaOceny": 0.0,
|
||||||
"Licznik": null,
|
"Licznik": null,
|
||||||
"Mianownik": null,
|
"Mianownik": null,
|
||||||
"Komentarz": null,
|
"Komentarz": null,
|
||||||
|
|
|
@ -2,21 +2,21 @@
|
||||||
{
|
{
|
||||||
"Subject": "Edukacja dla bezpieczeństwa",
|
"Subject": "Edukacja dla bezpieczeństwa",
|
||||||
"Value1": 78.19,
|
"Value1": 78.19,
|
||||||
"Value2": 80.00,
|
"Value2": 80.0,
|
||||||
"Label1": "78,19",
|
"Label1": "78,19",
|
||||||
"Label2": "80,00"
|
"Label2": "80,00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Subject": "Biologia",
|
"Subject": "Biologia",
|
||||||
"Value1": 50.00,
|
"Value1": 50.0,
|
||||||
"Value2": 50.00,
|
"Value2": 50.0,
|
||||||
"Label1": "50,00",
|
"Label1": "50,00",
|
||||||
"Label2": "50,00"
|
"Label2": "50,00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Subject": "Język angielski",
|
"Subject": "Język angielski",
|
||||||
"Value1": 69.96,
|
"Value1": 69.96,
|
||||||
"Value2": 85.00,
|
"Value2": 85.0,
|
||||||
"Label1": "69,96",
|
"Label1": "69,96",
|
||||||
"Label2": "85,00"
|
"Label2": "85,00"
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,6 +16,6 @@
|
||||||
"isNadzorOn": false,
|
"isNadzorOn": false,
|
||||||
"isUploadPhotosOn": false,
|
"isUploadPhotosOn": false,
|
||||||
"isZglaszanieNieobecnosciOn": false,
|
"isZglaszanieNieobecnosciOn": false,
|
||||||
"isOneDriveAttachmentsHomeworksOn":true,
|
"isOneDriveAttachmentsHomeworksOn": true,
|
||||||
"isPodrecznikiOn":true
|
"isPodrecznikiOn": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
"kodPocztowy": "00-000",
|
"kodPocztowy": "00-000",
|
||||||
"nrDomu": "1",
|
"nrDomu": "1",
|
||||||
"nrMieszkania": "",
|
"nrMieszkania": "",
|
||||||
"dyrektorzy": [
|
"dyrektorzy": ["Stanisław Konarowski"],
|
||||||
"Stanisław Konarowski"
|
|
||||||
],
|
|
||||||
"stronaWwwUrl": "fakelog.cf",
|
"stronaWwwUrl": "fakelog.cf",
|
||||||
"mail": "sekretariat@fakelog.cf",
|
"mail": "sekretariat@fakelog.cf",
|
||||||
"telSluzbowy": "",
|
"telSluzbowy": "",
|
||||||
|
|
|
@ -20,16 +20,14 @@
|
||||||
{
|
{
|
||||||
"przedmiotNazwa": "Zajęcia artystyczne",
|
"przedmiotNazwa": "Zajęcia artystyczne",
|
||||||
"pozycja": 13,
|
"pozycja": 13,
|
||||||
"nauczyciele": [
|
"nauczyciele": ["Jan Kowalski [JK]"],
|
||||||
"Jan Kowalski [JK]"
|
|
||||||
],
|
|
||||||
"ocenyCzastkowe": [
|
"ocenyCzastkowe": [
|
||||||
{
|
{
|
||||||
"wpis": "6",
|
"wpis": "6",
|
||||||
"dataOceny": "19.03.2024",
|
"dataOceny": "19.03.2024",
|
||||||
"kategoriaKolumny": "Bieżące",
|
"kategoriaKolumny": "Bieżące",
|
||||||
"nazwaKolumny": "",
|
"nazwaKolumny": "",
|
||||||
"waga": 0.00,
|
"waga": 0.0,
|
||||||
"kolorOceny": 0,
|
"kolorOceny": 0,
|
||||||
"nauczyciel": "Jan Kowalski [JK]",
|
"nauczyciel": "Jan Kowalski [JK]",
|
||||||
"zmienionaOdOstatniegoLogowania": true
|
"zmienionaOdOstatniegoLogowania": true
|
||||||
|
@ -39,7 +37,7 @@
|
||||||
"dataOceny": "19.03.2024",
|
"dataOceny": "19.03.2024",
|
||||||
"kategoriaKolumny": "Odpowiedź ustna",
|
"kategoriaKolumny": "Odpowiedź ustna",
|
||||||
"nazwaKolumny": "Opis",
|
"nazwaKolumny": "Opis",
|
||||||
"waga": 100.00,
|
"waga": 100.0,
|
||||||
"kolorOceny": 15748172,
|
"kolorOceny": 15748172,
|
||||||
"nauczyciel": "Joanna Kowalska [JK]",
|
"nauczyciel": "Joanna Kowalska [JK]",
|
||||||
"zmienionaOdOstatniegoLogowania": true
|
"zmienionaOdOstatniegoLogowania": true
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[{
|
[
|
||||||
|
{
|
||||||
"IkonkaNazwa": null,
|
"IkonkaNazwa": null,
|
||||||
"Num": null,
|
"Num": null,
|
||||||
"Zawartosc": [
|
"Zawartosc": [
|
||||||
|
@ -31,4 +32,5 @@
|
||||||
"Dane": null,
|
"Dane": null,
|
||||||
"Symbol": null,
|
"Symbol": null,
|
||||||
"Nieaktywny": false
|
"Nieaktywny": false
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
version: "3.5"
|
version: '3.5'
|
||||||
services:
|
services:
|
||||||
fakelog:
|
fakelog:
|
||||||
build: .
|
build: .
|
||||||
environment:
|
environment:
|
||||||
- SUBDOMAIN_OFFSET=3
|
- SUBDOMAIN_OFFSET=3
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- '3000:3000'
|
||||||
networks:
|
networks:
|
||||||
- internal_network
|
- internal_network
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
"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",
|
"test": "jshint src/ app.js --verbose",
|
||||||
"scss": "sass --watch public/stylesheets"
|
"scss": "sass --watch public/stylesheets",
|
||||||
|
"prettier": "prettier . --write"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
"lodash": "latest",
|
"lodash": "latest",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"morgan": "~1.10.0",
|
"morgan": "~1.10.0",
|
||||||
|
"prettier": "^3.2.5",
|
||||||
"pug": "^3.0.2",
|
"pug": "^3.0.2",
|
||||||
"sass": "^1.71.1",
|
"sass": "^1.71.1",
|
||||||
"serve-favicon": "~2.5.0",
|
"serve-favicon": "~2.5.0",
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
background: green;
|
background: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
[class^="x"]:before {
|
[class^='x']:before {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 1rem 0;
|
padding: 1rem 0;
|
||||||
|
|
||||||
[type="radio"], label[for] {
|
[type='radio'],
|
||||||
|
label[for] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@ table:not(.presentData),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
th, td {
|
th,
|
||||||
|
td {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border: 1px solid #333333;
|
border: 1px solid #333333;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
|
|
|
@ -38,12 +38,12 @@ header[data-organization-name] {
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: block;
|
display: block;
|
||||||
content: "";
|
content: '';
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
background: url(https://avatars3.githubusercontent.com/u/27146352?s=40)
|
background: url(https://avatars3.githubusercontent.com/u/27146352?s=40);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
@ -83,7 +83,7 @@ header[data-organization-name] {
|
||||||
|
|
||||||
a {
|
a {
|
||||||
display: block;
|
display: block;
|
||||||
background: #8B0000;
|
background: #8b0000;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin: 0 3px;
|
margin: 0 3px;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.startScreen {
|
.startScreen {
|
||||||
|
|
||||||
.topBar {
|
.topBar {
|
||||||
background: #43434d;
|
background: #43434d;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
@ -35,7 +34,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.applicationName {
|
.applicationName {
|
||||||
color: #8B0000;
|
color: #8b0000;
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
line-height: 70px;
|
line-height: 70px;
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@
|
||||||
.time {
|
.time {
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
@ -82,14 +80,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// one school
|
// one school
|
||||||
#idEmptyAppUczen, #idEmptyAppUczenExt {
|
#idEmptyAppUczen,
|
||||||
|
#idEmptyAppUczenExt {
|
||||||
.name {
|
.name {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// many schools
|
// many schools
|
||||||
#idAppUczen, #idAppUczenExt {
|
#idAppUczen,
|
||||||
|
#idAppUczenExt {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
br {
|
br {
|
||||||
|
|
|
@ -33,8 +33,8 @@ nav#menuGlowne {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
@at-root .button,
|
@at-root .button,
|
||||||
a[class^="button"] {
|
a[class^='button'] {
|
||||||
background: #8B0000;
|
background: #8b0000;
|
||||||
padding: 0.5rem 1.5rem;
|
padding: 0.5rem 1.5rem;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
|
@ -47,12 +47,12 @@ nav#menuGlowne {
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-prev:before {
|
.button-prev:before {
|
||||||
content: "<";
|
content: '<';
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-next:after {
|
.button-next:after {
|
||||||
content: ">";
|
content: '>';
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,14 @@ html {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 62.5%;
|
font-size: 62.5%;
|
||||||
}
|
}
|
||||||
*, *:before, *:after {
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after {
|
||||||
box-sizing: inherit;
|
box-sizing: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html,
|
||||||
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
th, td {
|
th,
|
||||||
|
td {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border: 1px solid #444444;
|
border: 1px solid #444444;
|
||||||
width: 20%;
|
width: 20%;
|
||||||
|
|
|
@ -30,7 +30,7 @@ $primary: #d32f2f;
|
||||||
font-size: 1.3rem;
|
font-size: 1.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:not([type="submit"]) {
|
input:not([type='submit']) {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -38,7 +38,7 @@ $primary: #d32f2f;
|
||||||
margin: 3px 0 20px;
|
margin: 3px 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="submit"] {
|
input[type='submit'] {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 20px auto 0;
|
margin: 20px auto 0;
|
||||||
background: $primary;
|
background: $primary;
|
||||||
|
@ -55,7 +55,7 @@ $primary: #d32f2f;
|
||||||
|
|
||||||
.Account {
|
.Account {
|
||||||
&:after {
|
&:after {
|
||||||
content: "|";
|
content: '|';
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
@import "scaffolding";
|
@import 'scaffolding';
|
||||||
@import "grades-table";
|
@import 'grades-table';
|
||||||
@import "attendance";
|
@import 'attendance';
|
||||||
@import "timetable-table";
|
@import 'timetable-table';
|
||||||
@import "row-value";
|
@import 'row-value';
|
||||||
@import "filters";
|
@import 'filters';
|
||||||
@import "header";
|
@import 'header';
|
||||||
@import "nav";
|
@import 'nav';
|
||||||
@import "home";
|
@import 'home';
|
||||||
|
|
|
@ -1,65 +1,66 @@
|
||||||
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.', ''),
|
||||||
"repo": "https://github.com/wulkanowy/fake-log",
|
repo: 'https://github.com/wulkanowy/fake-log',
|
||||||
"sdk": "https://github.com/wulkanowy/sdk",
|
sdk: 'https://github.com/wulkanowy/sdk',
|
||||||
"docs": "https://gitlab.com/erupcja/uonet-api-docs",
|
docs: 'https://gitlab.com/erupcja/uonet-api-docs',
|
||||||
"api": [
|
api: [
|
||||||
base + "/powiatwulkanowy/api/mobile/register/new",
|
base + '/powiatwulkanowy/api/mobile/register/new',
|
||||||
base + "/powiatwulkanowy/api/mobile/register/hebe",
|
base + '/powiatwulkanowy/api/mobile/register/hebe',
|
||||||
base + "/powiatwulkanowy/123456/api/mobile/register/hebe",
|
base + '/powiatwulkanowy/123456/api/mobile/register/hebe',
|
||||||
base + "/powiatwulkanowy/123456/api/mobile/version?app=DzienniczekPlus%202.0",
|
base + '/powiatwulkanowy/123456/api/mobile/version?app=DzienniczekPlus%202.0',
|
||||||
base + "/powiatwulkanowy/123456/api/mobile/heartbeat",
|
base + '/powiatwulkanowy/123456/api/mobile/heartbeat',
|
||||||
base + "/powiatwulkanowy/123456/api/mobile/internal/time",
|
base + '/powiatwulkanowy/123456/api/mobile/internal/time',
|
||||||
base + "/powiatwulkanowy/123456/api/mobile/school/lucky?constituentId=2&day=" + today,
|
base + '/powiatwulkanowy/123456/api/mobile/school/lucky?constituentId=2&day=' + today,
|
||||||
base + "/powiatwulkanowy/123456/api/mobile/school/grade/byPupil??unitId=2&pupilId=111&periodId=101&lastSyncDate=1970-01-01%2001%3A00%3A00&lastId=-2147483648&pageSize=500",
|
base +
|
||||||
|
'/powiatwulkanowy/123456/api/mobile/school/grade/byPupil??unitId=2&pupilId=111&periodId=101&lastSyncDate=1970-01-01%2001%3A00%3A00&lastId=-2147483648&pageSize=500',
|
||||||
],
|
],
|
||||||
"mobile-api": [
|
'mobile-api': [
|
||||||
base + "/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart/Certyfikat",
|
base + '/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart/Certyfikat',
|
||||||
base + "/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart/ListaUczniow",
|
base + '/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart/ListaUczniow',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/LogAppStart",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/LogAppStart',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Slowniki",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Slowniki',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/PlanLekcjiZeZmianami",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/PlanLekcjiZeZmianami',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Oceny",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Oceny',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/OcenyPodsumowanie",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/OcenyPodsumowanie',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Sprawdziany",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Sprawdziany',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/UwagiUcznia",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/UwagiUcznia',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Frekwencje",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Frekwencje',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/ZadaniaDomowe",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/ZadaniaDomowe',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Nauczyciele",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/Nauczyciele',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/WiadomosciOdebrane',
|
||||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/WiadomosciWyslane",
|
base + '/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/WiadomosciWyslane',
|
||||||
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,231 +1,229 @@
|
||||||
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(createEnvelope(0, "OK", "AccountPayload", {
|
res.json(
|
||||||
"LoginId": 207,
|
createEnvelope(0, 'OK', 'AccountPayload', {
|
||||||
"RestURL": base + "/powiatwulkanowy/",
|
LoginId: 207,
|
||||||
"UserLogin": "jan@fakelog.cf",
|
RestURL: base + '/powiatwulkanowy/',
|
||||||
"UserName": "jan@fakelog.cf"
|
UserLogin: 'jan@fakelog.cf',
|
||||||
}));
|
UserName: 'jan@fakelog.cf',
|
||||||
});
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
router.all("/hebe", (req, res) => {
|
router.all('/hebe', (req, res) => {
|
||||||
res.json(createEnvelope(0, "OK", "IEnumerable`1", [
|
res.json(
|
||||||
|
createEnvelope(0, 'OK', 'IEnumerable`1', [
|
||||||
{
|
{
|
||||||
"Capabilities": [
|
Capabilities: ['REGULAR', 'AVG_ENABLED', 'TOPICS_ENABLED', 'LUCKY_NUMBERS', 'ADDRESS_BOOK_PUPIL'],
|
||||||
"REGULAR",
|
ClassDisplay: '8b',
|
||||||
"AVG_ENABLED",
|
ConstituentUnit: {
|
||||||
"TOPICS_ENABLED",
|
Address: 'ul. Wulkanowego 30, 30-300 Fakelog.cf, Polska',
|
||||||
"LUCKY_NUMBERS",
|
Id: 2,
|
||||||
"ADDRESS_BOOK_PUPIL"
|
Name: 'Publiczna szkoła Wulkanowego nr 1 w fakelog.cf',
|
||||||
|
Patron: 'Święty Wulkan',
|
||||||
|
SchoolTopic: '12f446f1-1751-1711-10e1-101dd8b71c11',
|
||||||
|
Short: 'SPL',
|
||||||
|
},
|
||||||
|
Educators: [
|
||||||
|
{
|
||||||
|
Id: 'e-222',
|
||||||
|
Initials: 'MK',
|
||||||
|
LoginId: 222,
|
||||||
|
Name: 'Maria',
|
||||||
|
Surname: 'Kowalska',
|
||||||
|
Roles: [
|
||||||
|
{
|
||||||
|
Address: 'Kowalska Maria [KM] - wychowawca 8b (SPL)',
|
||||||
|
AddressHash: 'ndghrsawrtb045a0a4cfa7bf6ea0e9d380a6b5sd',
|
||||||
|
ClassSymbol: '8b (SPL)',
|
||||||
|
ConstituentUnitSymbol: 'SPL',
|
||||||
|
Initials: 'KM',
|
||||||
|
Name: 'Maria',
|
||||||
|
RoleName: 'Wychowawca',
|
||||||
|
RoleOrder: 0,
|
||||||
|
Surname: 'Kowalsk',
|
||||||
|
UnitSymbol: null,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
"ClassDisplay": "8b",
|
|
||||||
"ConstituentUnit": {
|
|
||||||
"Address": "ul. Wulkanowego 30, 30-300 Fakelog.cf, Polska",
|
|
||||||
"Id": 2,
|
|
||||||
"Name": "Publiczna szkoła Wulkanowego nr 1 w fakelog.cf",
|
|
||||||
"Patron": "Święty Wulkan",
|
|
||||||
"SchoolTopic": "12f446f1-1751-1711-10e1-101dd8b71c11",
|
|
||||||
"Short": "SPL"
|
|
||||||
},
|
},
|
||||||
"Educators": [
|
|
||||||
{
|
|
||||||
"Id": "e-222",
|
|
||||||
"Initials": "MK",
|
|
||||||
"LoginId": 222,
|
|
||||||
"Name": "Maria",
|
|
||||||
"Surname": "Kowalska",
|
|
||||||
"Roles": [
|
|
||||||
{
|
|
||||||
"Address": "Kowalska Maria [KM] - wychowawca 8b (SPL)",
|
|
||||||
"AddressHash": "ndghrsawrtb045a0a4cfa7bf6ea0e9d380a6b5sd",
|
|
||||||
"ClassSymbol": "8b (SPL)",
|
|
||||||
"ConstituentUnitSymbol": "SPL",
|
|
||||||
"Initials": "KM",
|
|
||||||
"Name": "Maria",
|
|
||||||
"RoleName": "Wychowawca",
|
|
||||||
"RoleOrder": 0,
|
|
||||||
"Surname": "Kowalsk",
|
|
||||||
"UnitSymbol": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"FullSync": false,
|
FullSync: false,
|
||||||
"InfoDisplay": "123456 - b8",
|
InfoDisplay: '123456 - b8',
|
||||||
"Journal": {
|
Journal: {
|
||||||
"Id": 33,
|
Id: 33,
|
||||||
"YearEnd": {
|
YearEnd: {
|
||||||
"Date": "2020-08-31",
|
Date: '2020-08-31',
|
||||||
"DateDisplay": "31.08.2020",
|
DateDisplay: '31.08.2020',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1598824800000
|
Timestamp: 1598824800000,
|
||||||
},
|
},
|
||||||
"YearStart": {
|
YearStart: {
|
||||||
"Date": "2019-09-01",
|
Date: '2019-09-01',
|
||||||
"DateDisplay": "01.09.2019",
|
DateDisplay: '01.09.2019',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1567288800000
|
Timestamp: 1567288800000,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Login": {
|
|
||||||
"DisplayName": "Jan Kowalski",
|
|
||||||
"FirstName": "Jan",
|
|
||||||
"Id": 11,
|
|
||||||
"LoginRole": "Uczen",
|
|
||||||
"SecondName": "",
|
|
||||||
"Surname": "Kowalski",
|
|
||||||
"Value": "jan@fakelog.cf"
|
|
||||||
},
|
},
|
||||||
"Partition": "powiatwulkanowy-123456",
|
Login: {
|
||||||
"Periods": [
|
DisplayName: 'Jan Kowalski',
|
||||||
|
FirstName: 'Jan',
|
||||||
|
Id: 11,
|
||||||
|
LoginRole: 'Uczen',
|
||||||
|
SecondName: '',
|
||||||
|
Surname: 'Kowalski',
|
||||||
|
Value: 'jan@fakelog.cf',
|
||||||
|
},
|
||||||
|
Partition: 'powiatwulkanowy-123456',
|
||||||
|
Periods: [
|
||||||
{
|
{
|
||||||
"Current": false,
|
Current: false,
|
||||||
"End": {
|
End: {
|
||||||
"Date": "2018-01-21",
|
Date: '2018-01-21',
|
||||||
"DateDisplay": "21.01.2018",
|
DateDisplay: '21.01.2018',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1516489200000
|
Timestamp: 1516489200000,
|
||||||
|
},
|
||||||
|
Id: 97,
|
||||||
|
Last: false,
|
||||||
|
Level: 6,
|
||||||
|
Number: 1,
|
||||||
|
Start: {
|
||||||
|
Date: '2017-09-01',
|
||||||
|
DateDisplay: '01.09.2017',
|
||||||
|
Time: '00:00:00',
|
||||||
|
Timestamp: 1504216800000,
|
||||||
},
|
},
|
||||||
"Id": 97,
|
|
||||||
"Last": false,
|
|
||||||
"Level": 6,
|
|
||||||
"Number": 1,
|
|
||||||
"Start": {
|
|
||||||
"Date": "2017-09-01",
|
|
||||||
"DateDisplay": "01.09.2017",
|
|
||||||
"Time": "00:00:00",
|
|
||||||
"Timestamp": 1504216800000
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Current": false,
|
Current: false,
|
||||||
"End": {
|
End: {
|
||||||
"Date": "2018-08-31",
|
Date: '2018-08-31',
|
||||||
"DateDisplay": "31.08.2018",
|
DateDisplay: '31.08.2018',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1535666400000
|
Timestamp: 1535666400000,
|
||||||
|
},
|
||||||
|
Id: 98,
|
||||||
|
Last: true,
|
||||||
|
Level: 6,
|
||||||
|
Number: 2,
|
||||||
|
Start: {
|
||||||
|
Date: '2018-01-22',
|
||||||
|
DateDisplay: '22.01.2018',
|
||||||
|
Time: '00:00:00',
|
||||||
|
Timestamp: 1516575600000,
|
||||||
},
|
},
|
||||||
"Id": 98,
|
|
||||||
"Last": true,
|
|
||||||
"Level": 6,
|
|
||||||
"Number": 2,
|
|
||||||
"Start": {
|
|
||||||
"Date": "2018-01-22",
|
|
||||||
"DateDisplay": "22.01.2018",
|
|
||||||
"Time": "00:00:00",
|
|
||||||
"Timestamp": 1516575600000
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Current": false,
|
Current: false,
|
||||||
"End": {
|
End: {
|
||||||
"Date": "2019-01-27",
|
Date: '2019-01-27',
|
||||||
"DateDisplay": "27.01.2019",
|
DateDisplay: '27.01.2019',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1548543600000
|
Timestamp: 1548543600000,
|
||||||
|
},
|
||||||
|
Id: 99,
|
||||||
|
Last: false,
|
||||||
|
Level: 7,
|
||||||
|
Number: 1,
|
||||||
|
Start: {
|
||||||
|
Date: '2018-09-01',
|
||||||
|
DateDisplay: '01.09.2018',
|
||||||
|
Time: '00:00:00',
|
||||||
|
Timestamp: 1535752800000,
|
||||||
},
|
},
|
||||||
"Id": 99,
|
|
||||||
"Last": false,
|
|
||||||
"Level": 7,
|
|
||||||
"Number": 1,
|
|
||||||
"Start": {
|
|
||||||
"Date": "2018-09-01",
|
|
||||||
"DateDisplay": "01.09.2018",
|
|
||||||
"Time": "00:00:00",
|
|
||||||
"Timestamp": 1535752800000
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Current": false,
|
Current: false,
|
||||||
"End": {
|
End: {
|
||||||
"Date": "2019-08-31",
|
Date: '2019-08-31',
|
||||||
"DateDisplay": "31.08.2019",
|
DateDisplay: '31.08.2019',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1567202400000
|
Timestamp: 1567202400000,
|
||||||
|
},
|
||||||
|
Id: 100,
|
||||||
|
Last: true,
|
||||||
|
Level: 7,
|
||||||
|
Number: 2,
|
||||||
|
Start: {
|
||||||
|
Date: '2019-01-28',
|
||||||
|
DateDisplay: '28.01.2019',
|
||||||
|
Time: '00:00:00',
|
||||||
|
Timestamp: 1548630000000,
|
||||||
},
|
},
|
||||||
"Id": 100,
|
|
||||||
"Last": true,
|
|
||||||
"Level": 7,
|
|
||||||
"Number": 2,
|
|
||||||
"Start": {
|
|
||||||
"Date": "2019-01-28",
|
|
||||||
"DateDisplay": "28.01.2019",
|
|
||||||
"Time": "00:00:00",
|
|
||||||
"Timestamp": 1548630000000
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Current": false,
|
Current: false,
|
||||||
"End": {
|
End: {
|
||||||
"Date": "2020-02-09",
|
Date: '2020-02-09',
|
||||||
"DateDisplay": "09.02.2020",
|
DateDisplay: '09.02.2020',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1581202800000
|
Timestamp: 1581202800000,
|
||||||
|
},
|
||||||
|
Id: 101,
|
||||||
|
Last: false,
|
||||||
|
Level: 8,
|
||||||
|
Number: 1,
|
||||||
|
Start: {
|
||||||
|
Date: '2019-09-01',
|
||||||
|
DateDisplay: '01.09.2019',
|
||||||
|
Time: '00:00:00',
|
||||||
|
Timestamp: 1567288800000,
|
||||||
},
|
},
|
||||||
"Id": 101,
|
|
||||||
"Last": false,
|
|
||||||
"Level": 8,
|
|
||||||
"Number": 1,
|
|
||||||
"Start": {
|
|
||||||
"Date": "2019-09-01",
|
|
||||||
"DateDisplay": "01.09.2019",
|
|
||||||
"Time": "00:00:00",
|
|
||||||
"Timestamp": 1567288800000
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Current": true,
|
Current: true,
|
||||||
"End": {
|
End: {
|
||||||
"Date": "2020-08-31",
|
Date: '2020-08-31',
|
||||||
"DateDisplay": "31.08.2020",
|
DateDisplay: '31.08.2020',
|
||||||
"Time": "00:00:00",
|
Time: '00:00:00',
|
||||||
"Timestamp": 1598824800000
|
Timestamp: 1598824800000,
|
||||||
|
},
|
||||||
|
Id: 102,
|
||||||
|
Last: true,
|
||||||
|
Level: 8,
|
||||||
|
Number: 2,
|
||||||
|
Start: {
|
||||||
|
Date: '2020-02-10',
|
||||||
|
DateDisplay: '10.02.2020',
|
||||||
|
Time: '00:00:00',
|
||||||
|
Timestamp: 1581289200000,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"Id": 102,
|
|
||||||
"Last": true,
|
|
||||||
"Level": 8,
|
|
||||||
"Number": 2,
|
|
||||||
"Start": {
|
|
||||||
"Date": "2020-02-10",
|
|
||||||
"DateDisplay": "10.02.2020",
|
|
||||||
"Time": "00:00:00",
|
|
||||||
"Timestamp": 1581289200000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"Pupil": {
|
Pupil: {
|
||||||
"FirstName": "Jan",
|
FirstName: 'Jan',
|
||||||
"Id": 111,
|
Id: 111,
|
||||||
"LoginId": 11,
|
LoginId: 11,
|
||||||
"LoginValue": "jan@fakelog.cf",
|
LoginValue: 'jan@fakelog.cf',
|
||||||
"SecondName": "",
|
SecondName: '',
|
||||||
"Sex": true,
|
Sex: true,
|
||||||
"Surname": "Kowalski"
|
Surname: 'Kowalski',
|
||||||
},
|
},
|
||||||
"SenderEntry": {
|
SenderEntry: {
|
||||||
"Address": "Jan Kowalski - uczeń 8b (SPL)",
|
Address: 'Jan Kowalski - uczeń 8b (SPL)',
|
||||||
"AddressHash": "1234567890e676ea0c01114dc2fb610987654321",
|
AddressHash: '1234567890e676ea0c01114dc2fb610987654321',
|
||||||
"Initials": "JK",
|
Initials: 'JK',
|
||||||
"LoginId": 111
|
LoginId: 111,
|
||||||
},
|
},
|
||||||
"TopLevelPartition": "powiatwulkanowy",
|
TopLevelPartition: 'powiatwulkanowy',
|
||||||
"Unit": {
|
Unit: {
|
||||||
"Address": "ul. Wulkanowego 30, 30-300 Fakelog.cf, Polska",
|
Address: 'ul. Wulkanowego 30, 30-300 Fakelog.cf, Polska',
|
||||||
"DisplayName": "Publiczna szkoła Wulkanowego nr 1 w fakelog.",
|
DisplayName: 'Publiczna szkoła Wulkanowego nr 1 w fakelog.',
|
||||||
"Id": 2,
|
Id: 2,
|
||||||
"Name": "Publiczna szkoła Wulkanowego",
|
Name: 'Publiczna szkoła Wulkanowego',
|
||||||
"Patron": "Święty Wulkan",
|
Patron: 'Święty Wulkan',
|
||||||
"RestURL": "https://api.fakelog.cf/powiatwulkanowy/123456/api",
|
RestURL: 'https://api.fakelog.cf/powiatwulkanowy/123456/api',
|
||||||
"Short": "123456",
|
Short: '123456',
|
||||||
"Symbol": "123456"
|
Symbol: '123456',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]));
|
])
|
||||||
});
|
)
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router
|
||||||
|
|
|
@ -1,80 +1,89 @@
|
||||||
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(createEnvelope(0, "OK", "IEnumerable`1", require("../../../data/api/student/Oceny").map(item => {
|
res.json(
|
||||||
|
createEnvelope(
|
||||||
|
0,
|
||||||
|
'OK',
|
||||||
|
'IEnumerable`1',
|
||||||
|
require('../../../data/api/student/Oceny').map((item) => {
|
||||||
return {
|
return {
|
||||||
"Column": {
|
Column: {
|
||||||
"Category": {
|
Category: {
|
||||||
"Id": item.IdKategoria,
|
Id: item.IdKategoria,
|
||||||
"Code": getByValue(categories, "Id", item.IdKategoria).Kod,
|
Code: getByValue(categories, 'Id', item.IdKategoria).Kod,
|
||||||
"Name": getByValue(categories, "Id", item.IdKategoria).Nazwa
|
Name: getByValue(categories, 'Id', item.IdKategoria).Nazwa,
|
||||||
},
|
},
|
||||||
"Code": getByValue(categories, "Id", item.IdKategoria).Kod,
|
Code: getByValue(categories, 'Id', item.IdKategoria).Kod,
|
||||||
"Group": "",
|
Group: '',
|
||||||
"Id": 0,
|
Id: 0,
|
||||||
"Key": uuid(),
|
Key: uuid(),
|
||||||
"Name": item.Opis,
|
Name: item.Opis,
|
||||||
"Number": 0,
|
Number: 0,
|
||||||
"Period": 2,
|
Period: 2,
|
||||||
"Subject": {
|
Subject: {
|
||||||
"Id": item.IdPrzedmiot,
|
Id: item.IdPrzedmiot,
|
||||||
"Key": uuid(),
|
Key: uuid(),
|
||||||
"Kod": getByValue(subjects, "Id", item.IdPrzedmiot).Kod,
|
Kod: getByValue(subjects, 'Id', item.IdPrzedmiot).Kod,
|
||||||
"Name": getByValue(subjects, "Id", item.IdPrzedmiot).Nazwa,
|
Name: getByValue(subjects, 'Id', item.IdPrzedmiot).Nazwa,
|
||||||
"Position": getByValue(subjects, "Id", item.IdPrzedmiot).Pozycja
|
Position: getByValue(subjects, 'Id', item.IdPrzedmiot).Pozycja,
|
||||||
},
|
},
|
||||||
"Weight": item.WagaOceny,
|
Weight: item.WagaOceny,
|
||||||
},
|
},
|
||||||
"Comment": item.Komentarz,
|
Comment: item.Komentarz,
|
||||||
"Content": item.Wpis,
|
Content: item.Wpis,
|
||||||
"ContentRaw": `${item.Wartosc}`,
|
ContentRaw: `${item.Wartosc}`,
|
||||||
"Creator": {
|
Creator: {
|
||||||
"Id": item.IdPracownikD,
|
Id: item.IdPracownikD,
|
||||||
"Name": getByValue(teachers, "Id", item.IdPracownikD).Imie,
|
Name: getByValue(teachers, 'Id', item.IdPracownikD).Imie,
|
||||||
"Surname": getByValue(teachers, "Id", item.IdPracownikD).Nazwisko,
|
Surname: getByValue(teachers, 'Id', item.IdPracownikD).Nazwisko,
|
||||||
"DisplayName": getByValue(teachers, "Id", item.IdPracownikD).Imie
|
DisplayName: getByValue(teachers, 'Id', item.IdPracownikD).Imie,
|
||||||
},
|
},
|
||||||
"Modifier": {
|
Modifier: {
|
||||||
"Id": item.IdPracownikM,
|
Id: item.IdPracownikM,
|
||||||
"Name": getByValue(teachers, "Id", item.IdPracownikM).Imie,
|
Name: getByValue(teachers, 'Id', item.IdPracownikM).Imie,
|
||||||
"Surname": getByValue(teachers, "Id", item.IdPracownikM).Nazwisko,
|
Surname: getByValue(teachers, 'Id', item.IdPracownikM).Nazwisko,
|
||||||
"DisplayName": getByValue(teachers, "Id", item.IdPracownikM).Imie
|
DisplayName: getByValue(teachers, 'Id', item.IdPracownikM).Imie,
|
||||||
},
|
},
|
||||||
"DateCreated": {
|
DateCreated: {
|
||||||
"Date": item.DataUtworzeniaTekst,
|
Date: item.DataUtworzeniaTekst,
|
||||||
"DateDisplay": item.DataUtworzeniaTekst,
|
DateDisplay: item.DataUtworzeniaTekst,
|
||||||
"Time": "00:01",
|
Time: '00:01',
|
||||||
"Timestamp": item.DataUtworzenia
|
Timestamp: item.DataUtworzenia,
|
||||||
},
|
},
|
||||||
"DateModify": {
|
DateModify: {
|
||||||
"Date": item.DataModyfikacjiTekst,
|
Date: item.DataModyfikacjiTekst,
|
||||||
"DateDisplay": item.DataModyfikacjiTekst,
|
DateDisplay: item.DataModyfikacjiTekst,
|
||||||
"Time": "00:02",
|
Time: '00:02',
|
||||||
"Timestamp": item.DataModyfikacji
|
Timestamp: item.DataModyfikacji,
|
||||||
},
|
},
|
||||||
"Id": item.Id,
|
Id: item.Id,
|
||||||
"Key": uuid(),
|
Key: uuid(),
|
||||||
"Numerator": item.Licznik,
|
Numerator: item.Licznik,
|
||||||
"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(createEnvelope(0, "OK", "LuckyNumberPayload", {
|
res.json(
|
||||||
"Day": format(new Date(), "yyyy-MM-dd"),
|
createEnvelope(0, 'OK', 'LuckyNumberPayload', {
|
||||||
"Number": format(new Date(), "d")
|
Day: format(new Date(), 'yyyy-MM-dd'),
|
||||||
}));
|
Number: format(new Date(), 'd'),
|
||||||
});
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
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(createEnvelope(0, "OK", "DateInfoPayload", {
|
res.json(
|
||||||
"Date": format(new Date(), "yyyy-MM-dd"),
|
createEnvelope(0, 'OK', 'DateInfoPayload', {
|
||||||
"DateDisplay": format(new Date(), "dd.MM.yyyy"),
|
Date: format(new Date(), 'yyyy-MM-dd'),
|
||||||
"Time": format(new Date(), "HH:mm:ss"),
|
DateDisplay: format(new Date(), 'dd.MM.yyyy'),
|
||||||
"Timestamp": getTime(new Date())
|
Time: format(new Date(), 'HH:mm:ss'),
|
||||||
}));
|
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,17 +1,17 @@
|
||||||
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 {
|
||||||
"Envelope": body,
|
Envelope: body,
|
||||||
"EnvelopeType": type,
|
EnvelopeType: type,
|
||||||
"InResponseTo": null,
|
InResponseTo: null,
|
||||||
"RequestId": uuid(),
|
RequestId: uuid(),
|
||||||
"Status": {
|
Status: {
|
||||||
"Code": statusCode,
|
Code: statusCode,
|
||||||
"Message": statusMessage
|
Message: statusMessage,
|
||||||
},
|
},
|
||||||
"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,53 +1,74 @@
|
||||||
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", {title: "Logowanie (" + req.param("symbol") + ")"});
|
res.render('login-form', {
|
||||||
});
|
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("/" + req.param("symbol") + "/FS/LS?" +
|
return res.redirect(
|
||||||
"wa=wsignin1.0&" +
|
'/' +
|
||||||
"wtrealm=" + protocol(req) + "%3a%2f%2fuonetplus.fakelog.localhost%3A300%2f" + req.param("symbol") + "%2fLoginEndpoint.aspx&" +
|
req.param('symbol') +
|
||||||
"wctx=" + protocol(req) + "%3a%2f%2fuonetplus.fakelog.localhost%3A300%2f" + req.param("symbol") + "%2fLoginEndpoint.aspx");
|
'/FS/LS?' +
|
||||||
|
'wa=wsignin1.0&' +
|
||||||
|
'wtrealm=' +
|
||||||
|
protocol(req) +
|
||||||
|
'%3a%2f%2fuonetplus.fakelog.localhost%3A300%2f' +
|
||||||
|
req.param('symbol') +
|
||||||
|
'%2fLoginEndpoint.aspx&' +
|
||||||
|
'wctx=' +
|
||||||
|
protocol(req) +
|
||||||
|
'%3a%2f%2fuonetplus.fakelog.localhost%3A300%2f' +
|
||||||
|
req.param('symbol') +
|
||||||
|
'%2fLoginEndpoint.aspx'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render("login-form", {title: "Logowanie (" + req.param("symbol") + ")", message: "Zła nazwa użytkownika lub hasło"});
|
res.render('login-form', {
|
||||||
});
|
title: 'Logowanie (' + req.param('symbol') + ')',
|
||||||
|
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", {title: "Przywracanie dostępu", message: "Mechanizm zabezpieczający przeciw robotom i robakom internetowym sygnalizuje, że żądanie nie zostało poprawnie autoryzowane"});
|
res.render('login-recover', {
|
||||||
});
|
title: 'Przywracanie dostępu',
|
||||||
|
message:
|
||||||
|
'Mechanizm zabezpieczający przeciw robotom i robakom internetowym sygnalizuje, że żądanie nie zostało poprawnie autoryzowane',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
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) => {
|
||||||
res.render('index', {
|
res.render('index', {
|
||||||
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,62 +1,66 @@
|
||||||
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
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
"IsError": false,
|
IsError: false,
|
||||||
"IsMessageForUser": false,
|
IsMessageForUser: false,
|
||||||
"Message": null,
|
Message: null,
|
||||||
"TokenKey": null,
|
TokenKey: null,
|
||||||
"TokenStatus": "CertGenerated",
|
TokenStatus: 'CertGenerated',
|
||||||
"TokenCert": {
|
TokenCert: {
|
||||||
"CertyfikatKlucz": "7EBA57E1DDBA1C249D097A9FF1C9CCDD45351A6A",
|
CertyfikatKlucz: '7EBA57E1DDBA1C249D097A9FF1C9CCDD45351A6A',
|
||||||
"CertyfikatKluczSformatowanyTekst": "7E-BA-57-E1-DD-BA-1C-24-9D-09-7A-9F-F1-C9-CC-DD-45-35-1A-6A",
|
CertyfikatKluczSformatowanyTekst: '7E-BA-57-E1-DD-BA-1C-24-9D-09-7A-9F-F1-C9-CC-DD-45-35-1A-6A',
|
||||||
"CertyfikatDataUtworzenia": Math.round(new Date().getTime() / 1000),
|
CertyfikatDataUtworzenia: Math.round(new Date().getTime() / 1000),
|
||||||
"CertyfikatDataUtworzeniaSformatowanyTekst": new Date().toUTCString(),
|
CertyfikatDataUtworzeniaSformatowanyTekst: new Date().toUTCString(),
|
||||||
"CertyfikatPfx": "MIIKYQIBAzCCChoGCSqGSIb3DQEHAaCCCgsEggoHMIIKAzCCBW8GCSqGSIb3DQEHAaCCBWAEggVcMIIFWDCCBVQGCyqGSIb3DQEMCgECoIIE+zCCBPcwKQYKKoZIhvcNAQwBAzAbBBSRxddtGxr1B3L4l6VE3c9VJ2uNtAIDAMNQBIIEyLpZHqyi1DevUp4RkJCJ3Da47HrAfOUdZ3aha2mGBoJa66Hd1zcQhe9KPllE12JhVbQHIjY/lkbrt7KZptj8KHmed5vd8k7TuvVooKUw44Mxd8drq++6E13OJj+CNcW5ehXdSyN2VL9SUFshZyJf4rzAvSGWY/CNwbEXggqbsp6Lyv72R69/kfJm1lbaz+Ha4fwlF9YXFOr8ghDLOCVdCS0gPz1LqWaoLaYUuAY2C7dZ5c9zgvtyd9LJz2xNyny46RrzAboF/xwO3XvyY2LaszOPQ4/W8QjGpbBshbpOMd0YP1P53U5J3O8pAJgv8EvQYWy1HG+K2PHDaXv7J20DGauvHA/M+UpHEJ82fj1f7fnTic4Su1Labm86IyG9TU2AKeIrPoHk5HHIbdl6QYi1I5iV+wC0yyXQQ0zGrg/AMOTfO7IMi7mJiWmLVVkIdP/6UcvQ4dw+72njQ+oLr8lXBC7msEI9w0P2kHbxTi/lQZ9nAOrd0UDkE9Hk85vJlb0GgJ8lsePW39IvMqP3pLLLX+5iKQAq/k3i8bPFxLT8jFAteLoO9epGFmcgEyzeD8ZtgY8O0VCSLBCa+6m6w3iVw6Hmw/usSRbRm9aE2Py/fTnf1g1M5N4NK7t95F8IauzXI6J3UfmPlYVxvO6BYDvAOHjMFl8TIVH4vidOIG/1GBgiKKSH0jjglMVXveoKwh8ssa2HeFJ1QFcg2i41DUyeV/6R3YVkpBY0V8mO05sTn/PsrtBKSNFPGeggGkV3IwqesMQgRxtRl2awgRBKyAH0+8Xf3a6Ep/e3Xbz9p9rCqTh3X06HEimljobJP0lxkrUcnblFCV8z8flAx+R3rfMALqgMr9PJRAXfQxPmVAWQzFX6mafCPBzZTW2Q9OFl724q9h8wPyot0Qtx5mlGTQzKQAs0HXS2tKgsHiKuY2QEqQ8Hf3cQyvF3BoL7NVH7OI0AU9dP602Lcc1j0zACUmFlCZi52Lq0Vj2NCOJ9lVhRxW/kqiSKWF8gYZ0Zkj4h2HajBqumDUFM1UvBt41Y894zw373QqXP5iGUbGmo/7k8qNsgQu9C7IG6sNuJj8Ry4yb2tcC32EglifOO4705Ym+iNlY/Rr8eVWgTv+0hfDALy8BFZR7JieTonfgP6GZ1FA45ZqI2vQrdpTriY7loN2OEtbdsjpvpvUDw7nkF2Ky9YNt3QMkHa8r+0njLVZKmFtggO09r9Yhg9o7IwfeSiq19Erya4NO85on8+8EOvasiQE6G6Vn+BHgkQ/MEh5Et2qZdd5oMbI32MGTKM6O/Ol+7dpM/49/0yu2JQ1ySOpm0cWjH+ylbBW92J60ZoHcdnYsj37FmVutRW8H5DjHRwOeC49PpSC9RRIwuL8qjvT3C67YG9RAMnXVmLd77Odz8HTiynlI7vzHPbLnde5Hd0jGXKeVQancInYwbsnsSXqE2X5AaEMf5WslMoRdBU/N9o3MxAvNjjAGJne2NxVDgZE1nv9/mBa+LOlapCVbsM+Iy6xdvzITEoBF2a3l6aR/1BYsDgDRcgS50KPorcaI8QnasdXNh1S8RJLYKIN7Qm0CfKDcTzx+Y0D+7fwdoWSI1jTerGgrEA8tOx/puGOXf478Gw2Itcaq30/ptyDFGMCEGCSqGSIb3DQEJFDEUHhIAbABvAGcAaQBuAGMAZQByAHQwIQYJKoZIhvcNAQkVMRQEElRpbWUgMTUzOTIwNjA4NjcxMjCCBIwGCSqGSIb3DQEHBqCCBH0wggR5AgEAMIIEcgYJKoZIhvcNAQcBMCkGCiqGSIb3DQEMAQYwGwQUNkBD+FMA6GpohJB9oxUP4e9R1aYCAwDDUICCBDiwrkiULdZav4v1TONDtLtb94wUHdqtZfysyAQO5j8yvTHsAMwAgkYCmwg28yk5tAaBG9Oi40/z5k6z4mIsqqOOTSdBG2hGNZKWi8X871XyybZd6VQ6jUcbavHsAaPx+0RUrc2MekF7n1XtxZmofT9DfWwEyi7jDQpFLF1Xi/lZMU8YGOmROIabdi2bLhO6e9RgEy6Sx3ka8KUe+XwdfKc8MeTCN9taLy4VBu2DfPKkZZvx5oV8vgQ484t666VfVxC/hAq/ZOXZmbX5XzucdxMwdZiVNrXwzksnd/vUFfFs9ZkfwkyRpbVQVXp476hfqnjWQvE70FBY8GXstNWnMPfPio1hWzt8ORGgdKIomOhlklFHTQUhEyHjKD3jZmO/0O0wywechsCA3H8UoIPb+odHhSpYhOgCbLvtM26gIHClfWwTvxAdXJW7BkSh/rvadU7vH3A3O+7tQQdJkHmPhnU/8hK+5j4+sPt03YSTuu1EGYsMs5PILVg+R31jwHFORhfgsWGh/sydAioSbsTjelULw6lHOBhPxoaTvAiAzluSrM4nfREr+PFIgYBNKtSbFhRUaEMsVZZ8CFKCzqJvCYQv/WuAtvEZU8aeU3cJRDEEikiPlM/tHfikm+nDoLNm9pzx5Yh26w9os5S64v1ZLilQUaDhSHa+WEz4y16eYEgNuiNFTPVaG4w7vL2/u1I7o/XFbGa1m4VfbN0+xwEIO8Cdyvl32IRu8SOFgJ4Kf97VP8IF9TrxvNobXC1ebzXyyzQ5yaY8mi8NjEyNUIvg564nm5p692P7OAbXEB5L+p8L/16vqGV3Us+ZCybjcxoi7OKeNsVVG67qRY+ZcJ5Fs6jGpB/E99Boiej+RZ7n4XqaxU3MzLNQ5x8I+7rfgFdtu2nzCw8nr8WFPdKwGvoAi7vR02zXeKyLp0i2yroMzTNgDU176XhMEHK24IOc6/1zFUN0Lr96ULrkRbIE7f0icvUFlHMH56Ye4ev6rKTUtpGKrYjFx08U1WdviZTPG9B6jcB+OJECHIpvdVARXFLAa52Ye8oAMm0ae1JkCAMm5227OfqO097aQrnNMptLP7qzwlF4GwW0WbGdPUVgYW5x4upptE1PYO+mlc2grCYy52NJ2DlXwAT1Agh2cVe+i1S2s9nGHHFoHSjCb5LMqPWE+oYnaICNmgiBAwIJp3Eqs47Vlriezi8cnlS6dZhBgqVC/tnoG56hYHRvD/az0k9ra7GDD9UChAQHwQAj8mjUbFDzwVKd6WwU+lGuLU873jI2cqe64Xz2DU/fXrci8bTH6N6+21l4rW1W+49JHoa+lIPe7m6WmHE37qFB9lbETtKpbF1OZjuykP9ySbC/rKfnwPwPILvxFSCYkWCiuZIcDgT0/yw0PHhvlwRlW49cJxDzLD0oA7FK39ywTNC99tWFIGtplc8BhWyVqo4wPjAhMAkGBSsOAwIaBQAEFH8M34p8W3P5DQjPhHJ3h1c21OEVBBRrY106fqyzCCmc0jpKuoimwORPGQIDAYag",
|
CertyfikatPfx:
|
||||||
"GrupaKlientow": "powiatwulkanowy",
|
'MIIKYQIBAzCCChoGCSqGSIb3DQEHAaCCCgsEggoHMIIKAzCCBW8GCSqGSIb3DQEHAaCCBWAEggVcMIIFWDCCBVQGCyqGSIb3DQEMCgECoIIE+zCCBPcwKQYKKoZIhvcNAQwBAzAbBBSRxddtGxr1B3L4l6VE3c9VJ2uNtAIDAMNQBIIEyLpZHqyi1DevUp4RkJCJ3Da47HrAfOUdZ3aha2mGBoJa66Hd1zcQhe9KPllE12JhVbQHIjY/lkbrt7KZptj8KHmed5vd8k7TuvVooKUw44Mxd8drq++6E13OJj+CNcW5ehXdSyN2VL9SUFshZyJf4rzAvSGWY/CNwbEXggqbsp6Lyv72R69/kfJm1lbaz+Ha4fwlF9YXFOr8ghDLOCVdCS0gPz1LqWaoLaYUuAY2C7dZ5c9zgvtyd9LJz2xNyny46RrzAboF/xwO3XvyY2LaszOPQ4/W8QjGpbBshbpOMd0YP1P53U5J3O8pAJgv8EvQYWy1HG+K2PHDaXv7J20DGauvHA/M+UpHEJ82fj1f7fnTic4Su1Labm86IyG9TU2AKeIrPoHk5HHIbdl6QYi1I5iV+wC0yyXQQ0zGrg/AMOTfO7IMi7mJiWmLVVkIdP/6UcvQ4dw+72njQ+oLr8lXBC7msEI9w0P2kHbxTi/lQZ9nAOrd0UDkE9Hk85vJlb0GgJ8lsePW39IvMqP3pLLLX+5iKQAq/k3i8bPFxLT8jFAteLoO9epGFmcgEyzeD8ZtgY8O0VCSLBCa+6m6w3iVw6Hmw/usSRbRm9aE2Py/fTnf1g1M5N4NK7t95F8IauzXI6J3UfmPlYVxvO6BYDvAOHjMFl8TIVH4vidOIG/1GBgiKKSH0jjglMVXveoKwh8ssa2HeFJ1QFcg2i41DUyeV/6R3YVkpBY0V8mO05sTn/PsrtBKSNFPGeggGkV3IwqesMQgRxtRl2awgRBKyAH0+8Xf3a6Ep/e3Xbz9p9rCqTh3X06HEimljobJP0lxkrUcnblFCV8z8flAx+R3rfMALqgMr9PJRAXfQxPmVAWQzFX6mafCPBzZTW2Q9OFl724q9h8wPyot0Qtx5mlGTQzKQAs0HXS2tKgsHiKuY2QEqQ8Hf3cQyvF3BoL7NVH7OI0AU9dP602Lcc1j0zACUmFlCZi52Lq0Vj2NCOJ9lVhRxW/kqiSKWF8gYZ0Zkj4h2HajBqumDUFM1UvBt41Y894zw373QqXP5iGUbGmo/7k8qNsgQu9C7IG6sNuJj8Ry4yb2tcC32EglifOO4705Ym+iNlY/Rr8eVWgTv+0hfDALy8BFZR7JieTonfgP6GZ1FA45ZqI2vQrdpTriY7loN2OEtbdsjpvpvUDw7nkF2Ky9YNt3QMkHa8r+0njLVZKmFtggO09r9Yhg9o7IwfeSiq19Erya4NO85on8+8EOvasiQE6G6Vn+BHgkQ/MEh5Et2qZdd5oMbI32MGTKM6O/Ol+7dpM/49/0yu2JQ1ySOpm0cWjH+ylbBW92J60ZoHcdnYsj37FmVutRW8H5DjHRwOeC49PpSC9RRIwuL8qjvT3C67YG9RAMnXVmLd77Odz8HTiynlI7vzHPbLnde5Hd0jGXKeVQancInYwbsnsSXqE2X5AaEMf5WslMoRdBU/N9o3MxAvNjjAGJne2NxVDgZE1nv9/mBa+LOlapCVbsM+Iy6xdvzITEoBF2a3l6aR/1BYsDgDRcgS50KPorcaI8QnasdXNh1S8RJLYKIN7Qm0CfKDcTzx+Y0D+7fwdoWSI1jTerGgrEA8tOx/puGOXf478Gw2Itcaq30/ptyDFGMCEGCSqGSIb3DQEJFDEUHhIAbABvAGcAaQBuAGMAZQByAHQwIQYJKoZIhvcNAQkVMRQEElRpbWUgMTUzOTIwNjA4NjcxMjCCBIwGCSqGSIb3DQEHBqCCBH0wggR5AgEAMIIEcgYJKoZIhvcNAQcBMCkGCiqGSIb3DQEMAQYwGwQUNkBD+FMA6GpohJB9oxUP4e9R1aYCAwDDUICCBDiwrkiULdZav4v1TONDtLtb94wUHdqtZfysyAQO5j8yvTHsAMwAgkYCmwg28yk5tAaBG9Oi40/z5k6z4mIsqqOOTSdBG2hGNZKWi8X871XyybZd6VQ6jUcbavHsAaPx+0RUrc2MekF7n1XtxZmofT9DfWwEyi7jDQpFLF1Xi/lZMU8YGOmROIabdi2bLhO6e9RgEy6Sx3ka8KUe+XwdfKc8MeTCN9taLy4VBu2DfPKkZZvx5oV8vgQ484t666VfVxC/hAq/ZOXZmbX5XzucdxMwdZiVNrXwzksnd/vUFfFs9ZkfwkyRpbVQVXp476hfqnjWQvE70FBY8GXstNWnMPfPio1hWzt8ORGgdKIomOhlklFHTQUhEyHjKD3jZmO/0O0wywechsCA3H8UoIPb+odHhSpYhOgCbLvtM26gIHClfWwTvxAdXJW7BkSh/rvadU7vH3A3O+7tQQdJkHmPhnU/8hK+5j4+sPt03YSTuu1EGYsMs5PILVg+R31jwHFORhfgsWGh/sydAioSbsTjelULw6lHOBhPxoaTvAiAzluSrM4nfREr+PFIgYBNKtSbFhRUaEMsVZZ8CFKCzqJvCYQv/WuAtvEZU8aeU3cJRDEEikiPlM/tHfikm+nDoLNm9pzx5Yh26w9os5S64v1ZLilQUaDhSHa+WEz4y16eYEgNuiNFTPVaG4w7vL2/u1I7o/XFbGa1m4VfbN0+xwEIO8Cdyvl32IRu8SOFgJ4Kf97VP8IF9TrxvNobXC1ebzXyyzQ5yaY8mi8NjEyNUIvg564nm5p692P7OAbXEB5L+p8L/16vqGV3Us+ZCybjcxoi7OKeNsVVG67qRY+ZcJ5Fs6jGpB/E99Boiej+RZ7n4XqaxU3MzLNQ5x8I+7rfgFdtu2nzCw8nr8WFPdKwGvoAi7vR02zXeKyLp0i2yroMzTNgDU176XhMEHK24IOc6/1zFUN0Lr96ULrkRbIE7f0icvUFlHMH56Ye4ev6rKTUtpGKrYjFx08U1WdviZTPG9B6jcB+OJECHIpvdVARXFLAa52Ye8oAMm0ae1JkCAMm5227OfqO097aQrnNMptLP7qzwlF4GwW0WbGdPUVgYW5x4upptE1PYO+mlc2grCYy52NJ2DlXwAT1Agh2cVe+i1S2s9nGHHFoHSjCb5LMqPWE+oYnaICNmgiBAwIJp3Eqs47Vlriezi8cnlS6dZhBgqVC/tnoG56hYHRvD/az0k9ra7GDD9UChAQHwQAj8mjUbFDzwVKd6WwU+lGuLU873jI2cqe64Xz2DU/fXrci8bTH6N6+21l4rW1W+49JHoa+lIPe7m6WmHE37qFB9lbETtKpbF1OZjuykP9ySbC/rKfnwPwPILvxFSCYkWCiuZIcDgT0/yw0PHhvlwRlW49cJxDzLD0oA7FK39ywTNC99tWFIGtplc8BhWyVqo4wPjAhMAkGBSsOAwIaBQAEFH8M34p8W3P5DQjPhHJ3h1c21OEVBBRrY106fqyzCCmc0jpKuoimwORPGQIDAYag',
|
||||||
"AdresBazowyRestApi": base + "/powiatwulkanowy/",
|
GrupaKlientow: 'powiatwulkanowy',
|
||||||
"UzytkownikLogin": "admin",
|
AdresBazowyRestApi: base + '/powiatwulkanowy/',
|
||||||
"UzytkownikNazwa": "admin",
|
UzytkownikLogin: 'admin',
|
||||||
"TypKonta": null
|
UzytkownikNazwa: 'admin',
|
||||||
}
|
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(api.createResponse(require("../../../data/api/ListaUczniow").map(item => {
|
res.json(
|
||||||
|
api.createResponse(
|
||||||
|
require('../../../data/api/ListaUczniow').map((item) => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
"OkresNumer": semesterNumber,
|
OkresNumer: semesterNumber,
|
||||||
"OkresDataOd": getUnixTime(semesterStart),
|
OkresDataOd: getUnixTime(semesterStart),
|
||||||
"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,110 +1,134 @@
|
||||||
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(api.createResponse({
|
res.json(
|
||||||
"TimeKey": Math.round(new Date().getTime() / 1000),
|
api.createResponse({
|
||||||
"Nauczyciele": require("../../../data/api/dictionaries/Nauczyciele"),
|
TimeKey: Math.round(new Date().getTime() / 1000),
|
||||||
"Pracownicy": require("../../../data/api/dictionaries/Pracownicy"),
|
Nauczyciele: require('../../../data/api/dictionaries/Nauczyciele'),
|
||||||
"Przedmioty": require("../../../data/api/dictionaries/Przedmioty"),
|
Pracownicy: require('../../../data/api/dictionaries/Pracownicy'),
|
||||||
"PoryLekcji": require("../../../data/api/dictionaries/PoryLekcji"),
|
Przedmioty: require('../../../data/api/dictionaries/Przedmioty'),
|
||||||
"KategorieOcen": require("../../../data/api/dictionaries/KategorieOcen"),
|
PoryLekcji: require('../../../data/api/dictionaries/PoryLekcji'),
|
||||||
"KategorieUwag": require("../../../data/api/dictionaries/KategorieUwag"),
|
KategorieOcen: require('../../../data/api/dictionaries/KategorieOcen'),
|
||||||
"KategorieFrekwencji": require("../../../data/api/dictionaries/KategorieFrekwencji"),
|
KategorieUwag: require('../../../data/api/dictionaries/KategorieUwag'),
|
||||||
"TypyFrekwencji": require("../../../data/api/dictionaries/TypyFrekwencji")
|
KategorieFrekwencji: require('../../../data/api/dictionaries/KategorieFrekwencji'),
|
||||||
}));
|
TypyFrekwencji: require('../../../data/api/dictionaries/TypyFrekwencji'),
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/PlanLekcjiZeZmianami", (req, res) => {
|
|
||||||
const timetable = require("../../../data/api/student/PlanLekcjiZeZmianami");
|
|
||||||
const requestDate = req.body.DataPoczatkowa ? parseISO(req.body.DataPoczatkowa) : startOfWeek(new Date(), {weekStartsOn: 1});
|
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(timetable[0].DzienTekst));
|
|
||||||
|
|
||||||
res.json(api.createResponse(timetable.map(item => {
|
|
||||||
const date = addDays(parseISO(item.DzienTekst), baseOffset);
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
Dzien: getTime(date) / 1000,
|
|
||||||
DzienTekst: converter.formatDate(date, true)
|
|
||||||
};
|
|
||||||
})));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/Oceny", (req, res) => {
|
|
||||||
res.json(api.createResponse(require("../../../data/api/student/Oceny")));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/OcenyPodsumowanie", (req, res) => {
|
|
||||||
res.json(api.createResponse(require("../../../data/api/student/OcenyPodsumowanie")));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/Sprawdziany", (req, res) => {
|
|
||||||
const exams = require("../../../data/api/student/Sprawdziany");
|
|
||||||
const requestDate = req.body.DataPoczatkowa ? parseISO(req.body.DataPoczatkowa) : startOfWeek(new Date(), {weekStartsOn: 1});
|
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(exams[0].DataTekst));
|
|
||||||
|
|
||||||
res.json(api.createResponse(exams.map(item => {
|
|
||||||
const date = addDays(parseISO(item.DataTekst), baseOffset);
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
Data: getTime(date) / 1000,
|
|
||||||
DataTekst: converter.formatDate(date, true)
|
|
||||||
};
|
|
||||||
})));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/UwagiUcznia", (req, res) => {
|
|
||||||
res.json(api.createResponse(require("../../../data/api/student/UwagiUcznia")));
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/Frekwencje", (req, res) => {
|
|
||||||
const attendance = require("../../../data/api/student/Frekwencje");
|
|
||||||
const requestDate = req.body.DataPoczatkowa ? parseISO(req.body.DataPoczatkowa) : startOfWeek(new Date(), {weekStartsOn: 1});
|
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(attendance[0].DzienTekst));
|
|
||||||
|
|
||||||
res.json(api.createResponse({
|
|
||||||
"DataPoczatkowa": 1524434400,
|
|
||||||
"DataKoncowa": 1525039199,
|
|
||||||
"DataPoczatkowaTekst": req.body.DataPoczatkowa,
|
|
||||||
"DataKoncowaTekst": req.body.DataKoncowa,
|
|
||||||
"Frekwencje": attendance.map(item => {
|
|
||||||
const date = addDays(parseISO(item.DzienTekst), baseOffset);
|
|
||||||
return {
|
|
||||||
...item,
|
|
||||||
Dzien: getTime(date) / 1000,
|
|
||||||
DzienTekst: converter.formatDate(date, true)
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
}));
|
)
|
||||||
});
|
})
|
||||||
|
|
||||||
router.all("/ZadaniaDomowe", (req, res) => {
|
router.all('/PlanLekcjiZeZmianami', (req, res) => {
|
||||||
const homework = require("../../../data/api/student/ZadaniaDomowe");
|
const timetable = require('../../../data/api/student/PlanLekcjiZeZmianami')
|
||||||
const requestDate = req.body.DataPoczatkowa ? parseISO(req.body.DataPoczatkowa) : startOfWeek(new Date(), {weekStartsOn: 1});
|
const requestDate = req.body.DataPoczatkowa
|
||||||
const baseOffset = differenceInDays(requestDate, parseISO(homework[0].DataTekst));
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
|
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
||||||
|
const baseOffset = differenceInDays(requestDate, parseISO(timetable[0].DzienTekst))
|
||||||
|
|
||||||
res.json(api.createResponse(homework.map(item => {
|
res.json(
|
||||||
const date = addDays(parseISO(item.DataTekst), baseOffset);
|
api.createResponse(
|
||||||
|
timetable.map((item) => {
|
||||||
|
const date = addDays(parseISO(item.DzienTekst), baseOffset)
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
Dzien: getTime(date) / 1000,
|
||||||
|
DzienTekst: converter.formatDate(date, true),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/Oceny', (req, res) => {
|
||||||
|
res.json(api.createResponse(require('../../../data/api/student/Oceny')))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/OcenyPodsumowanie', (req, res) => {
|
||||||
|
res.json(api.createResponse(require('../../../data/api/student/OcenyPodsumowanie')))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/Sprawdziany', (req, res) => {
|
||||||
|
const exams = require('../../../data/api/student/Sprawdziany')
|
||||||
|
const requestDate = req.body.DataPoczatkowa
|
||||||
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
|
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
||||||
|
const baseOffset = differenceInDays(requestDate, parseISO(exams[0].DataTekst))
|
||||||
|
|
||||||
|
res.json(
|
||||||
|
api.createResponse(
|
||||||
|
exams.map((item) => {
|
||||||
|
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('/UwagiUcznia', (req, res) => {
|
||||||
res.json(api.createResponse(require("../../../data/api/student/Nauczyciele")));
|
res.json(api.createResponse(require('../../../data/api/student/UwagiUcznia')))
|
||||||
});
|
})
|
||||||
|
|
||||||
module.exports = router;
|
router.all('/Frekwencje', (req, res) => {
|
||||||
|
const attendance = require('../../../data/api/student/Frekwencje')
|
||||||
|
const requestDate = req.body.DataPoczatkowa
|
||||||
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
|
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
||||||
|
const baseOffset = differenceInDays(requestDate, parseISO(attendance[0].DzienTekst))
|
||||||
|
|
||||||
|
res.json(
|
||||||
|
api.createResponse({
|
||||||
|
DataPoczatkowa: 1524434400,
|
||||||
|
DataKoncowa: 1525039199,
|
||||||
|
DataPoczatkowaTekst: req.body.DataPoczatkowa,
|
||||||
|
DataKoncowaTekst: req.body.DataKoncowa,
|
||||||
|
Frekwencje: attendance.map((item) => {
|
||||||
|
const date = addDays(parseISO(item.DzienTekst), baseOffset)
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
Dzien: getTime(date) / 1000,
|
||||||
|
DzienTekst: converter.formatDate(date, true),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/ZadaniaDomowe', (req, res) => {
|
||||||
|
const homework = require('../../../data/api/student/ZadaniaDomowe')
|
||||||
|
const requestDate = req.body.DataPoczatkowa
|
||||||
|
? parseISO(req.body.DataPoczatkowa)
|
||||||
|
: startOfWeek(new Date(), { weekStartsOn: 1 })
|
||||||
|
const baseOffset = differenceInDays(requestDate, parseISO(homework[0].DataTekst))
|
||||||
|
|
||||||
|
res.json(
|
||||||
|
api.createResponse(
|
||||||
|
homework.map((item) => {
|
||||||
|
const date = addDays(parseISO(item.DataTekst), baseOffset)
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
Data: getTime(date) / 1000,
|
||||||
|
DataTekst: converter.formatDate(date, true),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/Nauczyciele', (req, res) => {
|
||||||
|
res.json(api.createResponse(require('../../../data/api/student/Nauczyciele')))
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router
|
||||||
|
|
|
@ -1,142 +1,144 @@
|
||||||
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", {title: "Witryna ucznia i rodzica – Strona główna"});
|
res.render('opiekun/start', {
|
||||||
});
|
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,
|
||||||
"color": getGradeColorByCategoryName(category.Nazwa),
|
color: getGradeColorByCategoryName(category.Nazwa),
|
||||||
"symbol": category.Kod,
|
symbol: category.Kod,
|
||||||
"description": item.Opis,
|
description: item.Opis,
|
||||||
"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 {
|
||||||
"subject": item.Nazwa,
|
subject: item.Nazwa,
|
||||||
"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,
|
||||||
grade: item.grade,
|
grade: item.grade,
|
||||||
pupilAmount: item.pupilAmount,
|
pupilAmount: item.pupilAmount,
|
||||||
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) => {
|
||||||
return {
|
return {
|
||||||
presence: prev.presence + current.presence,
|
presence: prev.presence + current.presence,
|
||||||
absence: prev.absence + current.absence,
|
absence: prev.absence + current.absence,
|
||||||
|
@ -144,14 +146,19 @@ router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
absenceForSchoolReasons: prev.absenceForSchoolReasons + current.absenceForSchoolReasons,
|
absenceForSchoolReasons: prev.absenceForSchoolReasons + current.absenceForSchoolReasons,
|
||||||
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'),
|
||||||
data: _.groupBy(require("../../data/api/student/Frekwencje").map(item => {
|
data: _.groupBy(
|
||||||
const category = dictMap.getByValue(require("../../data/api/dictionaries/KategorieFrekwencji"), "Id", item.IdKategoria);
|
require('../../data/api/student/Frekwencje').map((item) => {
|
||||||
|
const category = dictMap.getByValue(
|
||||||
|
require('../../data/api/dictionaries/KategorieFrekwencji'),
|
||||||
|
'Id',
|
||||||
|
item.IdKategoria
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
number: item.Numer,
|
number: item.Numer,
|
||||||
subject: item.PrzedmiotNazwa,
|
subject: item.PrzedmiotNazwa,
|
||||||
|
@ -162,51 +169,56 @@ router.get('/Frekwencja.mvc', (req, res) => {
|
||||||
lateness: category.Spoznienie,
|
lateness: category.Spoznienie,
|
||||||
excused: category.Usprawiedliwione,
|
excused: category.Usprawiedliwione,
|
||||||
deleted: category.Usuniete,
|
deleted: category.Usuniete,
|
||||||
attendanceInfo: _.capitalize(category.Nazwa)
|
attendanceInfo: _.capitalize(category.Nazwa),
|
||||||
};
|
}
|
||||||
}), "number"),
|
}),
|
||||||
stats: require("../../data/opiekun/frekwencja-statystyki"),
|
'number'
|
||||||
|
),
|
||||||
|
stats: require('../../data/opiekun/frekwencja-statystyki'),
|
||||||
sumStats: sumStats,
|
sumStats: sumStats,
|
||||||
fullPresence: (
|
fullPresence:
|
||||||
(sumStats.presence + sumStats.lateness + sumStats.latenessExcused) /
|
((sumStats.presence + sumStats.lateness + sumStats.latenessExcused) /
|
||||||
(sumStats.presence +
|
(sumStats.presence +
|
||||||
sumStats.absence +
|
sumStats.absence +
|
||||||
sumStats.absenceExcused +
|
sumStats.absenceExcused +
|
||||||
sumStats.absenceForSchoolReasons +
|
sumStats.absenceForSchoolReasons +
|
||||||
sumStats.lateness +
|
sumStats.lateness +
|
||||||
sumStats.latenessExcused)
|
sumStats.latenessExcused)) *
|
||||||
) * 100,
|
100,
|
||||||
weekDays: converter.getWeekDaysFrom(req.query.data),
|
weekDays: converter.getWeekDaysFrom(req.query.data),
|
||||||
tics: {
|
tics: {
|
||||||
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(require("../../data/api/student/PlanLekcjiZeZmianami").filter((item) => item.PlanUcznia).map(item => {
|
const days = _.groupBy(
|
||||||
const teacher = dictMap.getByValue(teachers, "Id", item.IdPracownik);
|
require('../../data/api/student/PlanLekcjiZeZmianami')
|
||||||
const oldTeacher = dictMap.getByValue(teachers, "Id", item.IdPracownikOld);
|
.filter((item) => item.PlanUcznia)
|
||||||
const times = dictMap.getByValue(require("../../data/api/dictionaries/PoryLekcji"), "Id", item.IdPoraLekcji);
|
.map((item) => {
|
||||||
|
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownik)
|
||||||
|
const oldTeacher = dictMap.getByValue(teachers, 'Id', item.IdPracownikOld)
|
||||||
|
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,
|
||||||
|
@ -222,209 +234,224 @@ 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',
|
||||||
data,
|
data,
|
||||||
weekDays: converter.getWeekDaysFrom(req.query.data),
|
weekDays: converter.getWeekDaysFrom(req.query.data),
|
||||||
tics: {
|
tics: {
|
||||||
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', {
|
||||||
title: "Witryna ucznia i rodzica – Plan lekcji",
|
title: 'Witryna ucznia i rodzica – Plan lekcji',
|
||||||
subjects: require("../../data/api/dictionaries/Przedmioty"),
|
subjects: require('../../data/api/dictionaries/Przedmioty'),
|
||||||
data: _.groupBy(require("../../data/opiekun/plan-zrealizowane.json").map(item => {
|
data: _.groupBy(
|
||||||
|
require('../../data/opiekun/plan-zrealizowane.json').map((item) => {
|
||||||
return {
|
return {
|
||||||
// jshint ignore:start
|
// jshint ignore:start
|
||||||
...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(require("../../data/api/student/Sprawdziany").map((item, index) => {
|
data: _.groupBy(
|
||||||
const subject = dictMap.getByValue(subjects, "Id", item.IdPrzedmiot);
|
require('../../data/api/student/Sprawdziany').map((item, index) => {
|
||||||
const teacher = dictMap.getByValue(teachers, "Id", item.IdPracownik);
|
const subject = dictMap.getByValue(subjects, 'Id', item.IdPrzedmiot)
|
||||||
let examType;
|
const teacher = dictMap.getByValue(teachers, 'Id', item.IdPracownik)
|
||||||
|
let examType
|
||||||
switch (item.RodzajNumer) {
|
switch (item.RodzajNumer) {
|
||||||
case 1: examType = "Sprawdzian"; break;
|
case 1:
|
||||||
case 2: examType = "Kartkówka"; break;
|
examType = 'Sprawdzian'
|
||||||
case 3: examType = "Praca klasowa"; break;
|
break
|
||||||
default: examType = "Nieznany";
|
case 2:
|
||||||
|
examType = 'Kartkówka'
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
examType = 'Praca klasowa'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
examType = 'Nieznany'
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
entryDate: "01.01.1970",
|
entryDate: '01.01.1970',
|
||||||
date: days[index][1],
|
date: days[index][1],
|
||||||
// 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'
|
||||||
|
),
|
||||||
weekDays: converter.getWeekDaysFrom(req.query.data),
|
weekDays: converter.getWeekDaysFrom(req.query.data),
|
||||||
tics: {
|
tics: {
|
||||||
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),
|
||||||
entryDate: converter.formatDate(new Date(item.DataTekst)),
|
entryDate: converter.formatDate(new Date(item.DataTekst)),
|
||||||
teacher: teacher.Imie + " " + teacher.Nazwisko,
|
teacher: teacher.Imie + ' ' + teacher.Nazwisko,
|
||||||
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
152
src/routes/uonetplus-uczenplus.js
Normal file
152
src/routes/uonetplus-uczenplus.js
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
const { Router } = require('express')
|
||||||
|
const protocol = require('../utils/connection')
|
||||||
|
|
||||||
|
const router = Router()
|
||||||
|
|
||||||
|
router.get('/', (req, res) => {
|
||||||
|
const base = protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456'
|
||||||
|
res.json({
|
||||||
|
loginEndpoint: base + '/LoginEndpoint.aspx',
|
||||||
|
app: base + '/App',
|
||||||
|
api: [
|
||||||
|
base + '/api/Context',
|
||||||
|
base + '/api/Cache',
|
||||||
|
base + '/api/OkresyKlasyfikacyjne',
|
||||||
|
base + '/api/Zebrania',
|
||||||
|
base + '/api/SprawdzianyZadaniaDomowe',
|
||||||
|
base + '/api/SprawdzianSzczegoly',
|
||||||
|
base + '/api/ZadanieDomoweSzczegoly',
|
||||||
|
base + '/api/Uwagi',
|
||||||
|
base + '/api/Frekwencja',
|
||||||
|
base + '/api/Oceny',
|
||||||
|
base + '/api/Nauczyciele',
|
||||||
|
base + '/api/Informacje',
|
||||||
|
base + '/api/NieprzeczytaneWiadomosci',
|
||||||
|
base + '/api/DostepOffice',
|
||||||
|
base + '/api/ZarejestrowaneUrzadzenia',
|
||||||
|
base + '/api/PodrecznikiLataSzkolne',
|
||||||
|
base + '/api/SzczesliwyNumerTablica',
|
||||||
|
base + '/api/WazneDzisiajTablica',
|
||||||
|
base + '/api/WychowawcyTablica',
|
||||||
|
base + '/api/RealizacjaZajec',
|
||||||
|
base + '/api/PlanZajec',
|
||||||
|
base + '/api/DniWolne',
|
||||||
|
].sort(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/LoginEndpoint.aspx', (req, res) => {
|
||||||
|
res.redirect(protocol(req) + '://' + req.get('host') + '/powiatwulkanowy/123456/App')
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/App', (_req, res) => {
|
||||||
|
res.render('uczenplus/app')
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Context', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Context.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Cache', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Cache.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/OkresyKlasyfikacyjne', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/OkresyKlasyfikacyjne.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Zebrania', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Zebrania.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/SprawdzianyZadaniaDomowe', (_req, res) => {
|
||||||
|
res.json(
|
||||||
|
require('../../data/uonetplus-uczenplus/SprawdzianyZadaniaDomowe.json').map((event) => {
|
||||||
|
event.data = new Date().toISOString()
|
||||||
|
return event
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/SprawdzianSzczegoly', (_req, res) => {
|
||||||
|
const data = require('../../data/uonetplus-uczenplus/SprawdzianSzczegoly.json')
|
||||||
|
data.data = new Date().toISOString()
|
||||||
|
res.json(data)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/ZadanieDomoweSzczegoly', (_req, res) => {
|
||||||
|
const data = require('../../data/uonetplus-uczenplus/ZadanieDomoweSzczegoly.json')
|
||||||
|
data.data = new Date().toISOString()
|
||||||
|
res.json(data)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Oceny', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Oceny.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Frekwencja', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Frekwencja.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Uwagi', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Uwagi.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Nauczyciele', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Nauczyciele.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/Informacje', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/Informacje.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/WiadomosciNieodczytane', (_req, res) => {
|
||||||
|
res.json({ liczbaNieodczytanychWiadomosci: 2 })
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/DostepOffice', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/DostepOffice.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/ZarejestrowaneUrzadzenia', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/ZarejestrowaneUrzadzenia.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/PodrecznikiLataSzkolne', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/PodrecznikiLataSzkolne.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/SzczesliwyNumerTablica', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/SzczesliwyNumerTablica.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/WazneDzisiajTablica', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/WazneDzisiajTablica.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/WychowawcyTablica', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/WychowawcyTablica.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/RealizacjaZajec', (_req, res) => {
|
||||||
|
res.json(
|
||||||
|
require('../../data/uonetplus-uczenplus/RealizacjaZajec.json').map((lesson) => {
|
||||||
|
lesson.data = new Date().toISOString()
|
||||||
|
return lesson
|
||||||
|
})
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/PlanZajec', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/PlanZajec.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/DniWolne', (_req, res) => {
|
||||||
|
res.json(require('../../data/uonetplus-uczenplus/DniWolne.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/api/*', (_req, res) => {
|
||||||
|
res.status(404).send({ message: 'Nie odnaleziono zasobu.' })
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router
|
|
@ -1,319 +1,327 @@
|
||||||
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: {
|
||||||
endpoints: [
|
endpoints: [
|
||||||
"/Wiadomosc.mvc/GetInboxMessages",
|
'/Wiadomosc.mvc/GetInboxMessages',
|
||||||
"/Wiadomosc.mvc/GetOutboxMessages",
|
'/Wiadomosc.mvc/GetOutboxMessages',
|
||||||
"/Wiadomosc.mvc/GetTrashboxMessages",
|
'/Wiadomosc.mvc/GetTrashboxMessages',
|
||||||
"/Adresaci.mvc/GetAddressee",
|
'/Adresaci.mvc/GetAddressee',
|
||||||
"/Wiadomosc.mvc/GetAdresaciWiadomosci",
|
'/Wiadomosc.mvc/GetAdresaciWiadomosci',
|
||||||
"/Wiadomosc.mvc/GetMessageSenderRoles",
|
'/Wiadomosc.mvc/GetMessageSenderRoles',
|
||||||
"/Wiadomosc.mvc/GetInboxMessageDetails",
|
'/Wiadomosc.mvc/GetInboxMessageDetails',
|
||||||
"/Wiadomosc.mvc/GetOutboxMessageDetails",
|
'/Wiadomosc.mvc/GetOutboxMessageDetails',
|
||||||
"/Wiadomosc.mvc/GetTrashboxMessageDetails",
|
'/Wiadomosc.mvc/GetTrashboxMessageDetails',
|
||||||
"/Wiadomosc.mvc/GetAdresaciNiePrzeczytaliWiadomosci",
|
'/Wiadomosc.mvc/GetAdresaciNiePrzeczytaliWiadomosci',
|
||||||
"/Wiadomosc.mvc/GetAdresaciPrzeczytaliWiadomosc",
|
'/Wiadomosc.mvc/GetAdresaciPrzeczytaliWiadomosc',
|
||||||
"/Wiadomosc.mvc/GetMessageAddressee",
|
'/Wiadomosc.mvc/GetMessageAddressee',
|
||||||
"/Wiadomosc.mvc/DeleteInboxMessages",
|
'/Wiadomosc.mvc/DeleteInboxMessages',
|
||||||
"/Wiadomosc.mvc/DeleteOutboxMessages",
|
'/Wiadomosc.mvc/DeleteOutboxMessages',
|
||||||
"/Wiadomosc.mvc/DeleteTrashboxMessages",
|
'/Wiadomosc.mvc/DeleteTrashboxMessages',
|
||||||
"/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) => {
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
data: require('../../data/api/messages/WiadomosciOdebrane').map((item) => {
|
||||||
|
const recipientsNumber = getRandomInt(60, 100)
|
||||||
|
const readBy = getRandomInt(20, 60)
|
||||||
|
const unreadBy = recipientsNumber - readBy
|
||||||
|
return {
|
||||||
|
Id: item.WiadomoscId * 2,
|
||||||
|
Nieprzeczytana: !item.GodzinaPrzeczytania,
|
||||||
|
Nieprzeczytane: unreadBy,
|
||||||
|
Przeczytane: readBy,
|
||||||
|
Data: converter.formatDate(new Date(item.DataWyslaniaUnixEpoch * 1000), true) + ' 00:00:00',
|
||||||
|
Tresc: null,
|
||||||
|
Temat: item.Tytul,
|
||||||
|
Nadawca: {
|
||||||
|
Id: '' + item.NadawcaId,
|
||||||
|
Name: item.Nadawca,
|
||||||
|
IdLogin: item.NadawcaId,
|
||||||
|
Unreaded: false,
|
||||||
|
Date: null,
|
||||||
|
Role: 2,
|
||||||
|
PushMessage: false,
|
||||||
|
UnitId: 0,
|
||||||
|
Hash: 'abcdef=',
|
||||||
|
},
|
||||||
|
IdWiadomosci: item.WiadomoscId,
|
||||||
|
HasZalaczniki: true,
|
||||||
|
FolderWiadomosci: 1,
|
||||||
|
Adresaci: [],
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
router.get("/Wiadomosc.mvc/GetInboxMessages", (req, res) => {
|
|
||||||
res.json({
|
|
||||||
"success": true,
|
|
||||||
"data": require("../../data/api/messages/WiadomosciOdebrane").map(item => {
|
|
||||||
const recipientsNumber = getRandomInt(60, 100);
|
|
||||||
const readBy = getRandomInt(20, 60);
|
|
||||||
const unreadBy = recipientsNumber - readBy;
|
|
||||||
return {
|
|
||||||
"Id": item.WiadomoscId * 2,
|
|
||||||
"Nieprzeczytana": !item.GodzinaPrzeczytania,
|
|
||||||
"Nieprzeczytane": unreadBy,
|
|
||||||
"Przeczytane": readBy,
|
|
||||||
"Data": converter.formatDate(new Date(item.DataWyslaniaUnixEpoch * 1000), true) + ' 00:00:00',
|
|
||||||
"Tresc": null,
|
|
||||||
"Temat": item.Tytul,
|
|
||||||
"Nadawca": {
|
|
||||||
"Id": "" + item.NadawcaId,
|
|
||||||
"Name": item.Nadawca,
|
|
||||||
"IdLogin": item.NadawcaId,
|
|
||||||
"Unreaded": false,
|
|
||||||
"Date": null,
|
|
||||||
"Role": 2,
|
|
||||||
"PushMessage": false,
|
|
||||||
"UnitId": 0,
|
|
||||||
"Hash": "abcdef="
|
|
||||||
},
|
|
||||||
"IdWiadomosci": item.WiadomoscId,
|
|
||||||
"HasZalaczniki": true,
|
|
||||||
"FolderWiadomosci": 1,
|
|
||||||
"Adresaci": []
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
});
|
|
||||||
|
|
||||||
router.get("/Wiadomosc.mvc/GetOutboxMessages", (req, res) => {
|
router.get('/Wiadomosc.mvc/GetOutboxMessages', (req, res) => {
|
||||||
res.json({
|
res.json({
|
||||||
"success": true,
|
success: true,
|
||||||
"data": require("../../data/api/messages/WiadomosciWyslane").map(item => {
|
data: require('../../data/api/messages/WiadomosciWyslane').map((item) => {
|
||||||
return {
|
return {
|
||||||
"Id": item.WiadomoscId * 2,
|
Id: item.WiadomoscId * 2,
|
||||||
"Nieprzeczytana": !item.GodzinaPrzeczytania,
|
Nieprzeczytana: !item.GodzinaPrzeczytania,
|
||||||
"Nieprzeczytane": parseInt(item.Nieprzeczytane, 10),
|
Nieprzeczytane: parseInt(item.Nieprzeczytane, 10),
|
||||||
"Przeczytane": parseInt(item.Przeczytane, 10),
|
Przeczytane: parseInt(item.Przeczytane, 10),
|
||||||
"Data": converter.formatDate(new Date(item.DataWyslaniaUnixEpoch * 1000), true) + ' 00:00:00',
|
Data: converter.formatDate(new Date(item.DataWyslaniaUnixEpoch * 1000), true) + ' 00:00:00',
|
||||||
"Tresc": null,
|
Tresc: null,
|
||||||
"Temat": item.Tytul,
|
Temat: item.Tytul,
|
||||||
"Nadawca": {
|
Nadawca: {
|
||||||
"Id": "" + item.NadawcaId,
|
Id: '' + item.NadawcaId,
|
||||||
"Name": item.Nadawca,
|
Name: item.Nadawca,
|
||||||
"IdLogin": item.NadawcaId,
|
IdLogin: item.NadawcaId,
|
||||||
"Unreaded": false,
|
Unreaded: false,
|
||||||
"Date": null,
|
Date: null,
|
||||||
"Role": 2,
|
Role: 2,
|
||||||
"PushMessage": false,
|
PushMessage: false,
|
||||||
"UnitId": 0,
|
UnitId: 0,
|
||||||
"Hash": "abcdef="
|
Hash: 'abcdef=',
|
||||||
},
|
},
|
||||||
"IdWiadomosci": item.WiadomoscId,
|
IdWiadomosci: item.WiadomoscId,
|
||||||
"HasZalaczniki": false,
|
HasZalaczniki: false,
|
||||||
"FolderWiadomosci": 2,
|
FolderWiadomosci: 2,
|
||||||
"Adresaci": []
|
Adresaci: [],
|
||||||
};
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.get("/Wiadomosc.mvc/GetTrashboxMessages", (req, res) => {
|
|
||||||
res.json({
|
|
||||||
"success": true,
|
|
||||||
"data": require("../../data/api/messages/WiadomosciUsuniete").map(item => {
|
|
||||||
return {
|
|
||||||
"Id": item.WiadomoscId * 2,
|
|
||||||
"Nieprzeczytana": !item.GodzinaPrzeczytania,
|
|
||||||
"Nieprzeczytane": parseInt(item.Nieprzeczytane, 10),
|
|
||||||
"Przeczytane": parseInt(item.Przeczytane, 10),
|
|
||||||
"Data": converter.formatDate(new Date(item.DataWyslaniaUnixEpoch * 1000), true) + ' 00:00:00',
|
|
||||||
"Tresc": null,
|
|
||||||
"Temat": item.Tytul,
|
|
||||||
"Nadawca": {
|
|
||||||
"Id": "" + item.NadawcaId,
|
|
||||||
"Name": item.Nadawca,
|
|
||||||
"IdLogin": item.NadawcaId,
|
|
||||||
"Unreaded": false,
|
|
||||||
"Date": null,
|
|
||||||
"Role": 2,
|
|
||||||
"PushMessage": false,
|
|
||||||
"UnitId": 0,
|
|
||||||
"Hash": "abcdef="
|
|
||||||
},
|
|
||||||
"IdWiadomosci": item.WiadomoscId,
|
|
||||||
"HasZalaczniki": false,
|
|
||||||
"FolderWiadomosci": 3,
|
|
||||||
"Adresaci": []
|
|
||||||
};
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.get("/NowaWiadomosc.mvc/GetJednostkiUzytkownika", (req, res) => {
|
|
||||||
const user = require("../../data/api/ListaUczniow")[1];
|
|
||||||
res.json({
|
|
||||||
"success": true,
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"IdJednostkaSprawozdawcza": user.IdJednostkaSprawozdawcza,
|
|
||||||
"Skrot": user.JednostkaSprawozdawczaSkrot,
|
|
||||||
"Role": [1],
|
|
||||||
"NazwaNadawcy": user.Imie + " " + user.Nazwisko,
|
|
||||||
"WychowawcaWOddzialach": [],
|
|
||||||
"Id": user.Id
|
|
||||||
}
|
}
|
||||||
]
|
}),
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/Adresaci.mvc/GetAddressee", (req, res) => {
|
|
||||||
const user = require("../../data/api/ListaUczniow")[1];
|
|
||||||
res.json({
|
|
||||||
"success": true,
|
|
||||||
"data": require("../../data/api/dictionaries/Pracownicy").map(item => {
|
|
||||||
return {
|
|
||||||
"Id": `${item.Id}rPracownik`,
|
|
||||||
"Name": `${item.Imie} ${item.Nazwisko} [${item.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
|
||||||
"IdLogin": item.Id,
|
|
||||||
"UnitId": user.IdJednostkaSprawozdawcza,
|
|
||||||
"Role": 2,
|
|
||||||
"PushMessage": null,
|
|
||||||
"Hash": Buffer.from(md5(item.Id)).toString('base64')
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
});
|
|
||||||
|
|
||||||
router.get(["/Wiadomosc.mvc/GetAdresaciWiadomosci", "/Wiadomosc.mvc/GetMessageSenderRoles"], (req, res) => {
|
router.get('/Wiadomosc.mvc/GetTrashboxMessages', (req, res) => {
|
||||||
const user = require("../../data/api/ListaUczniow")[1];
|
|
||||||
res.json({
|
res.json({
|
||||||
"success": true,
|
success: true,
|
||||||
"data": require("../../data/api/dictionaries/Pracownicy").slice(0, 2).map(item => {
|
data: require('../../data/api/messages/WiadomosciUsuniete').map((item) => {
|
||||||
return {
|
return {
|
||||||
"Id": `${item.Id}rPracownik`,
|
Id: item.WiadomoscId * 2,
|
||||||
"Name": `${item.Imie} ${item.Nazwisko} [${item.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
Nieprzeczytana: !item.GodzinaPrzeczytania,
|
||||||
"IdLogin": item.Id,
|
Nieprzeczytane: parseInt(item.Nieprzeczytane, 10),
|
||||||
"UnitId": null,
|
Przeczytane: parseInt(item.Przeczytane, 10),
|
||||||
"Role": 2,
|
Data: converter.formatDate(new Date(item.DataWyslaniaUnixEpoch * 1000), true) + ' 00:00:00',
|
||||||
"PushMessage": null,
|
Tresc: null,
|
||||||
"Hash": Buffer.from(md5(item.Id)).toString('base64')
|
Temat: item.Tytul,
|
||||||
};
|
Nadawca: {
|
||||||
|
Id: '' + item.NadawcaId,
|
||||||
|
Name: item.Nadawca,
|
||||||
|
IdLogin: item.NadawcaId,
|
||||||
|
Unreaded: false,
|
||||||
|
Date: null,
|
||||||
|
Role: 2,
|
||||||
|
PushMessage: false,
|
||||||
|
UnitId: 0,
|
||||||
|
Hash: 'abcdef=',
|
||||||
|
},
|
||||||
|
IdWiadomosci: item.WiadomoscId,
|
||||||
|
HasZalaczniki: false,
|
||||||
|
FolderWiadomosci: 3,
|
||||||
|
Adresaci: [],
|
||||||
|
}
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
});
|
})
|
||||||
});
|
|
||||||
|
|
||||||
router.all([
|
router.get('/NowaWiadomosc.mvc/GetJednostkiUzytkownika', (req, res) => {
|
||||||
"/Wiadomosc.mvc/GetInboxMessageDetails",
|
const user = require('../../data/api/ListaUczniow')[1]
|
||||||
"/Wiadomosc.mvc/GetOutboxMessageDetails",
|
|
||||||
"/Wiadomosc.mvc/GetTrashboxMessageDetails"
|
|
||||||
], (req, res) => {
|
|
||||||
const message = require("../../data/api/messages/WiadomosciOdebrane")[0];
|
|
||||||
res.json({
|
res.json({
|
||||||
"success": true,
|
success: true,
|
||||||
"data": {
|
data: [
|
||||||
"Id": message.WiadomoscId,
|
|
||||||
"Tresc": message.Tresc,
|
|
||||||
"Zalaczniki": [
|
|
||||||
{
|
{
|
||||||
"Url": "https://1drv.ms/u/s!AmvjLDq5anT2psJ4nujoBUyclWOUhw",
|
IdJednostkaSprawozdawcza: user.IdJednostkaSprawozdawcza,
|
||||||
"IdOneDrive": "0123456789ABCDEF!123",
|
Skrot: user.JednostkaSprawozdawczaSkrot,
|
||||||
"IdWiadomosc": message.WiadomoscId,
|
Role: [1],
|
||||||
"NazwaPliku": "nazwa_pliku.pptx",
|
NazwaNadawcy: user.Imie + ' ' + user.Nazwisko,
|
||||||
"Id": message.WiadomoscId * 3
|
WychowawcaWOddzialach: [],
|
||||||
|
Id: user.Id,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all('/Adresaci.mvc/GetAddressee', (req, res) => {
|
||||||
|
const user = require('../../data/api/ListaUczniow')[1]
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
data: require('../../data/api/dictionaries/Pracownicy').map((item) => {
|
||||||
|
return {
|
||||||
|
Id: `${item.Id}rPracownik`,
|
||||||
|
Name: `${item.Imie} ${item.Nazwisko} [${item.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
|
IdLogin: item.Id,
|
||||||
|
UnitId: user.IdJednostkaSprawozdawcza,
|
||||||
|
Role: 2,
|
||||||
|
PushMessage: null,
|
||||||
|
Hash: Buffer.from(md5(item.Id)).toString('base64'),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.get(['/Wiadomosc.mvc/GetAdresaciWiadomosci', '/Wiadomosc.mvc/GetMessageSenderRoles'], (req, res) => {
|
||||||
|
const user = require('../../data/api/ListaUczniow')[1]
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
data: require('../../data/api/dictionaries/Pracownicy')
|
||||||
|
.slice(0, 2)
|
||||||
|
.map((item) => {
|
||||||
|
return {
|
||||||
|
Id: `${item.Id}rPracownik`,
|
||||||
|
Name: `${item.Imie} ${item.Nazwisko} [${item.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
|
IdLogin: item.Id,
|
||||||
|
UnitId: null,
|
||||||
|
Role: 2,
|
||||||
|
PushMessage: null,
|
||||||
|
Hash: Buffer.from(md5(item.Id)).toString('base64'),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all(
|
||||||
|
[
|
||||||
|
'/Wiadomosc.mvc/GetInboxMessageDetails',
|
||||||
|
'/Wiadomosc.mvc/GetOutboxMessageDetails',
|
||||||
|
'/Wiadomosc.mvc/GetTrashboxMessageDetails',
|
||||||
|
],
|
||||||
|
(req, res) => {
|
||||||
|
const message = require('../../data/api/messages/WiadomosciOdebrane')[0]
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
Id: message.WiadomoscId,
|
||||||
|
Tresc: message.Tresc,
|
||||||
|
Zalaczniki: [
|
||||||
|
{
|
||||||
|
Url: 'https://1drv.ms/u/s!AmvjLDq5anT2psJ4nujoBUyclWOUhw',
|
||||||
|
IdOneDrive: '0123456789ABCDEF!123',
|
||||||
|
IdWiadomosc: message.WiadomoscId,
|
||||||
|
NazwaPliku: 'nazwa_pliku.pptx',
|
||||||
|
Id: message.WiadomoscId * 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Url": "https://wulkanowy.github.io/",
|
Url: 'https://wulkanowy.github.io/',
|
||||||
"IdOneDrive": "0123456789ABCDEF!124",
|
IdOneDrive: '0123456789ABCDEF!124',
|
||||||
"IdWiadomosc": message.WiadomoscId,
|
IdWiadomosc: message.WiadomoscId,
|
||||||
"NazwaPliku": "wulkanowy.txt",
|
NazwaPliku: 'wulkanowy.txt',
|
||||||
"Id": message.WiadomoscId * 4
|
Id: message.WiadomoscId * 4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Url": "https://github.com/wulkanowy/wulkanowy",
|
Url: 'https://github.com/wulkanowy/wulkanowy',
|
||||||
"IdOneDrive": "0123456789ABCDEF!125",
|
IdOneDrive: '0123456789ABCDEF!125',
|
||||||
"IdWiadomosc": message.WiadomoscId,
|
IdWiadomosc: message.WiadomoscId,
|
||||||
"NazwaPliku": "wulkanowy(2).txt",
|
NazwaPliku: 'wulkanowy(2).txt',
|
||||||
"Id": message.WiadomoscId * 5
|
Id: message.WiadomoscId * 5,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
]
|
)
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
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: [
|
||||||
{
|
{
|
||||||
"Id": `${recipient.Id * 4}`, // ¯\_(ツ)_/¯
|
Id: `${recipient.Id * 4}`, // ¯\_(ツ)_/¯
|
||||||
"Name": `${recipient.Imie} ${recipient.Nazwisko} [${recipient.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
Name: `${recipient.Imie} ${recipient.Nazwisko} [${recipient.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
"IdLogin": recipient.Id,
|
IdLogin: recipient.Id,
|
||||||
"UnitId": user.IdJednostkaSprawozdawcza,
|
UnitId: user.IdJednostkaSprawozdawcza,
|
||||||
"Role": 2,
|
Role: 2,
|
||||||
"PushMessage": null,
|
PushMessage: null,
|
||||||
"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: [
|
||||||
{
|
{
|
||||||
"Nazwa": `${recipient.Imie} ${recipient.Nazwisko} [${recipient.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
Nazwa: `${recipient.Imie} ${recipient.Nazwisko} [${recipient.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
"Data": "2020-04-07 19:05:00",
|
Data: '2020-04-07 19:05:00',
|
||||||
"Id": recipient.Id * 8 // ¯\_(ツ)_/¯
|
Id: recipient.Id * 8, // ¯\_(ツ)_/¯
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/Wiadomosc.mvc/GetMessageAddressee", (req, res) => {
|
|
||||||
const user = require("../../data/api/ListaUczniow")[1];
|
|
||||||
const recipient = require("../../data/api/dictionaries/Pracownicy")[1];
|
|
||||||
res.json({
|
|
||||||
"success": true,
|
|
||||||
"data": [
|
|
||||||
{
|
|
||||||
"Id": recipient.Id * 8, // ¯\_(ツ)_/¯
|
|
||||||
"Name": `${recipient.Imie} ${recipient.Nazwisko} [${recipient.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
|
||||||
"IdLogin": recipient.LoginId,
|
|
||||||
"Role": 7,
|
|
||||||
"Hash": "abcd==",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all([
|
|
||||||
"/Wiadomosc.mvc/DeleteInboxMessages",
|
|
||||||
"/Wiadomosc.mvc/DeleteOutboxMessages",
|
|
||||||
"/Wiadomosc.mvc/DeleteTrashboxMessages",
|
|
||||||
], (req, res) => {
|
|
||||||
res.json({
|
|
||||||
"success": true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.all("/NowaWiadomosc.mvc/InsertWiadomosc", (req, res) => {
|
|
||||||
let data = req.body.incomming;
|
|
||||||
res.json({
|
|
||||||
"success": true,
|
|
||||||
"data": {
|
|
||||||
"Adresaci": data.Adresaci.map(item => {
|
|
||||||
item.PushMessage = false;
|
|
||||||
return item;
|
|
||||||
}),
|
|
||||||
"Temat": data.Temat,
|
|
||||||
"Tresc": data.Tresc,
|
|
||||||
"Nadawca": {
|
|
||||||
"Id": null,
|
|
||||||
"Name": "Kowalski Jan",
|
|
||||||
"IdLogin": 0,
|
|
||||||
"UnitId": null,
|
|
||||||
"Role": 0,
|
|
||||||
"PushMessage": null,
|
|
||||||
"Hash": "hash"
|
|
||||||
},
|
},
|
||||||
"WiadomoscPowitalna": false,
|
],
|
||||||
"Id": data.Id
|
})
|
||||||
}
|
})
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = router;
|
router.all('/Wiadomosc.mvc/GetMessageAddressee', (req, res) => {
|
||||||
|
const user = require('../../data/api/ListaUczniow')[1]
|
||||||
|
const recipient = require('../../data/api/dictionaries/Pracownicy')[1]
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
Id: recipient.Id * 8, // ¯\_(ツ)_/¯
|
||||||
|
Name: `${recipient.Imie} ${recipient.Nazwisko} [${recipient.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
|
||||||
|
IdLogin: recipient.LoginId,
|
||||||
|
Role: 7,
|
||||||
|
Hash: 'abcd==',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.all(
|
||||||
|
[
|
||||||
|
'/Wiadomosc.mvc/DeleteInboxMessages',
|
||||||
|
'/Wiadomosc.mvc/DeleteOutboxMessages',
|
||||||
|
'/Wiadomosc.mvc/DeleteTrashboxMessages',
|
||||||
|
],
|
||||||
|
(req, res) => {
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
router.all('/NowaWiadomosc.mvc/InsertWiadomosc', (req, res) => {
|
||||||
|
let data = req.body.incomming
|
||||||
|
res.json({
|
||||||
|
success: true,
|
||||||
|
data: {
|
||||||
|
Adresaci: data.Adresaci.map((item) => {
|
||||||
|
item.PushMessage = false
|
||||||
|
return item
|
||||||
|
}),
|
||||||
|
Temat: data.Temat,
|
||||||
|
Tresc: data.Tresc,
|
||||||
|
Nadawca: {
|
||||||
|
Id: null,
|
||||||
|
Name: 'Kowalski Jan',
|
||||||
|
IdLogin: 0,
|
||||||
|
UnitId: null,
|
||||||
|
Role: 0,
|
||||||
|
PushMessage: null,
|
||||||
|
Hash: 'hash',
|
||||||
|
},
|
||||||
|
WiadomoscPowitalna: false,
|
||||||
|
Id: data.Id,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router
|
||||||
|
|
|
@ -1,197 +1,195 @@
|
||||||
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: {
|
||||||
endpoints: [
|
endpoints: [
|
||||||
"/api/Skrzynki",
|
'/api/Skrzynki',
|
||||||
"/api/Pracownicy",
|
'/api/Pracownicy',
|
||||||
"/api/Odebrane",
|
'/api/Odebrane',
|
||||||
"/api/OdebraneSkrzynka",
|
'/api/OdebraneSkrzynka',
|
||||||
"/api/Wyslane",
|
'/api/Wyslane',
|
||||||
"/api/WyslaneSkrzynka",
|
'/api/WyslaneSkrzynka',
|
||||||
"/api/Usuniete",
|
'/api/Usuniete',
|
||||||
"/api/UsunieteSkrzynka",
|
'/api/UsunieteSkrzynka',
|
||||||
"/api/WiadomoscSzczegoly",
|
'/api/WiadomoscSzczegoly',
|
||||||
"/api/WiadomoscOdpowiedzPrzekaz",
|
'/api/WiadomoscOdpowiedzPrzekaz',
|
||||||
"/api/WiadomoscNowa",
|
'/api/WiadomoscNowa',
|
||||||
"/api/MoveTrash",
|
'/api/MoveTrash',
|
||||||
"/api/Delete",
|
'/api/Delete',
|
||||||
].map(item => {
|
].map((item) => {
|
||||||
return base + item;
|
return base + item
|
||||||
|
}),
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
router.get([
|
router.get(['/api/Odebrane', '/api/OdebraneSkrzynka'], (req, res) => {
|
||||||
"/api/Odebrane",
|
const currentTimestamp = dateToTimestamp(new Date())
|
||||||
"/api/OdebraneSkrzynka",
|
res.json(
|
||||||
], (req, res) => {
|
require('../../data/api/messages/WiadomosciOdebrane').map((item, i) => {
|
||||||
const currentTimestamp = dateToTimestamp(new Date());
|
let itemTimestamp = item.DataWyslaniaUnixEpoch
|
||||||
res.json(require("../../data/api/messages/WiadomosciOdebrane").map((item, i) => {
|
|
||||||
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()),
|
||||||
"korespondenci": item.Nadawca + " - P - (Fake123456)",
|
korespondenci: item.Nadawca + ' - P - (Fake123456)',
|
||||||
"temat": item.Tytul,
|
temat: item.Tytul,
|
||||||
"data": timestampToIsoTzFormat(itemTimestamp),
|
data: timestampToIsoTzFormat(itemTimestamp),
|
||||||
"skrzynka": "Jan Kowalski - U - (Fake123456)",
|
skrzynka: 'Jan Kowalski - U - (Fake123456)',
|
||||||
"hasZalaczniki": true,
|
hasZalaczniki: true,
|
||||||
"przeczytana": !!item.GodzinaPrzeczytania,
|
przeczytana: !!item.GodzinaPrzeczytania,
|
||||||
"nieprzeczytanePrzeczytanePrzez": null,
|
nieprzeczytanePrzeczytanePrzez: null,
|
||||||
"wazna": false,
|
wazna: false,
|
||||||
"uzytkownikRola": 2,
|
uzytkownikRola: 2,
|
||||||
"id": item.WiadomoscId
|
id: item.WiadomoscId,
|
||||||
};
|
}
|
||||||
}));
|
})
|
||||||
});
|
)
|
||||||
|
})
|
||||||
|
|
||||||
router.get([
|
router.get(['/api/Wyslane', '/api/WyslaneSkrzynka'], (req, res) => {
|
||||||
"/api/Wyslane",
|
res.json(
|
||||||
"/api/WyslaneSkrzynka",
|
require('../../data/api/messages/WiadomosciWyslane').map((item) => {
|
||||||
], (req, res) => {
|
|
||||||
res.json(require("../../data/api/messages/WiadomosciWyslane").map(item => {
|
|
||||||
return {
|
return {
|
||||||
"apiGlobalKey": fromString(item.WiadomoscId.toString()),
|
apiGlobalKey: fromString(item.WiadomoscId.toString()),
|
||||||
"korespondenci": item.Nadawca + " - P - (Fake123456)",
|
korespondenci: item.Nadawca + ' - P - (Fake123456)',
|
||||||
"temat": item.Tytul,
|
temat: item.Tytul,
|
||||||
"data": timestampToIsoTzFormat(item.DataWyslaniaUnixEpoch),
|
data: timestampToIsoTzFormat(item.DataWyslaniaUnixEpoch),
|
||||||
"skrzynka": "Jan Kowalski - U - (Fake123456)",
|
skrzynka: 'Jan Kowalski - U - (Fake123456)',
|
||||||
"hasZalaczniki": true,
|
hasZalaczniki: true,
|
||||||
"przeczytana": !!item.GodzinaPrzeczytania,
|
przeczytana: !!item.GodzinaPrzeczytania,
|
||||||
"nieprzeczytanePrzeczytanePrzez": null,
|
nieprzeczytanePrzeczytanePrzez: null,
|
||||||
"wazna": false,
|
wazna: false,
|
||||||
"uzytkownikRola": 2,
|
uzytkownikRola: 2,
|
||||||
"id": item.WiadomoscId
|
id: item.WiadomoscId,
|
||||||
};
|
}
|
||||||
}));
|
})
|
||||||
});
|
)
|
||||||
|
})
|
||||||
|
|
||||||
router.get([
|
router.get(['/api/Usuniete', '/api/UsunieteSkrzynka'], (req, res) => {
|
||||||
"/api/Usuniete",
|
res.json(
|
||||||
"/api/UsunieteSkrzynka",
|
require('../../data/api/messages/WiadomosciUsuniete').map((item) => {
|
||||||
], (req, res) => {
|
|
||||||
res.json(require("../../data/api/messages/WiadomosciUsuniete").map(item => {
|
|
||||||
return {
|
return {
|
||||||
"apiGlobalKey": fromString(item.WiadomoscId.toString()),
|
apiGlobalKey: fromString(item.WiadomoscId.toString()),
|
||||||
"korespondenci": item.Nadawca + " - P - (Fake123456)",
|
korespondenci: item.Nadawca + ' - P - (Fake123456)',
|
||||||
"temat": item.Tytul,
|
temat: item.Tytul,
|
||||||
"data": timestampToIsoTzFormat(item.DataWyslaniaUnixEpoch),
|
data: timestampToIsoTzFormat(item.DataWyslaniaUnixEpoch),
|
||||||
"skrzynka": "Jan Kowalski - U - (Fake123456)",
|
skrzynka: 'Jan Kowalski - U - (Fake123456)',
|
||||||
"hasZalaczniki": true,
|
hasZalaczniki: true,
|
||||||
"przeczytana": !!item.GodzinaPrzeczytania,
|
przeczytana: !!item.GodzinaPrzeczytania,
|
||||||
"nieprzeczytanePrzeczytanePrzez": null,
|
nieprzeczytanePrzeczytanePrzez: null,
|
||||||
"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(users.map(user => {
|
res.json(
|
||||||
|
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()),
|
||||||
"nadawca": "Natalia Wrzesień - P - (Fake123456)",
|
nadawca: 'Natalia Wrzesień - P - (Fake123456)',
|
||||||
"odbiorcy": ["Jan kowalski - U - (Fake123456)"],
|
odbiorcy: ['Jan kowalski - U - (Fake123456)'],
|
||||||
"temat": message.Tytul,
|
temat: message.Tytul,
|
||||||
"tresc": message.Tresc.replaceAll("\n", "<br>"),
|
tresc: message.Tresc.replaceAll('\n', '<br>'),
|
||||||
"odczytana": true,
|
odczytana: true,
|
||||||
"zalaczniki": [
|
zalaczniki: [
|
||||||
{
|
{
|
||||||
"url": "https://1drv.ms/u/s!AmvjLDq5anT2psJ4nujoBUyclWOUhw",
|
url: 'https://1drv.ms/u/s!AmvjLDq5anT2psJ4nujoBUyclWOUhw',
|
||||||
"nazwaPliku": "nazwa_pliku.pptx",
|
nazwaPliku: 'nazwa_pliku.pptx',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "https://wulkanowy.github.io/",
|
url: 'https://wulkanowy.github.io/',
|
||||||
"nazwaPliku": "wulkanowy.txt",
|
nazwaPliku: 'wulkanowy.txt',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"url": "https://github.com/wulkanowy/wulkanowy",
|
url: 'https://github.com/wulkanowy/wulkanowy',
|
||||||
"nazwaPliku": "wulkanowy(2).txt",
|
nazwaPliku: 'wulkanowy(2).txt',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"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()),
|
||||||
"uzytkownikSkrzynkaGlobalKey": fromString(user.Id.toString()),
|
uzytkownikSkrzynkaGlobalKey: fromString(user.Id.toString()),
|
||||||
"nadawcaSkrzynkaGlobalKey": fromString(message.NadawcaId.toString()),
|
nadawcaSkrzynkaGlobalKey: fromString(message.NadawcaId.toString()),
|
||||||
"nadawcaSkrzynkaNazwa": "Natalia Wrzesień - P - (Fake123456)",
|
nadawcaSkrzynkaNazwa: 'Natalia Wrzesień - P - (Fake123456)',
|
||||||
"adresaci": [
|
adresaci: [
|
||||||
{
|
{
|
||||||
"skrzynkaGlobalKey": fromString(user.Id.toString()),
|
skrzynkaGlobalKey: fromString(user.Id.toString()),
|
||||||
"nazwa": "Jan Kowalski - U - (Fake123456)"
|
nazwa: 'Jan Kowalski - U - (Fake123456)',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"temat": message.Tytul,
|
temat: message.Tytul,
|
||||||
"tresc": message.Tresc.replaceAll("\n", "<br>"),
|
tresc: message.Tresc.replaceAll('\n', '<br>'),
|
||||||
"zalaczniki": [
|
zalaczniki: [
|
||||||
{
|
{
|
||||||
"url": "https://1drv.ms/u/s!AmvjLDq5anT2psJ4nujoBUyclWOUhw",
|
url: 'https://1drv.ms/u/s!AmvjLDq5anT2psJ4nujoBUyclWOUhw',
|
||||||
"nazwaPliku": "nazwa_pliku.pptx"
|
nazwaPliku: 'nazwa_pliku.pptx',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
"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(recipients.map(item => {
|
res.json(
|
||||||
|
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([
|
router.all(['/api/MoveTrash', '/api/Delete'], (req, res) => {
|
||||||
"/api/MoveTrash",
|
res.status(204).send()
|
||||||
"/api/Delete",
|
})
|
||||||
], (req, res) => {
|
|
||||||
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,163 +1,163 @@
|
||||||
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: {
|
||||||
endpoints: [
|
endpoints: [
|
||||||
"/GetSelfGovernments",
|
'/GetSelfGovernments',
|
||||||
"/GetStudentTrips",
|
'/GetStudentTrips',
|
||||||
"/GetStudentConferences",
|
'/GetStudentConferences',
|
||||||
"/GetLastNotes",
|
'/GetLastNotes',
|
||||||
"/GetNumberOfUnreadMessages",
|
'/GetNumberOfUnreadMessages',
|
||||||
"/GetFreeDays",
|
'/GetFreeDays',
|
||||||
"/GetKidsLuckyNumbers",
|
'/GetKidsLuckyNumbers',
|
||||||
"/GetKidsLessonPlan",
|
'/GetKidsLessonPlan',
|
||||||
"/GetLastHomeworks",
|
'/GetLastHomeworks',
|
||||||
"/GetLastTests",
|
'/GetLastTests',
|
||||||
"/GetLastStudentLessons",
|
'/GetLastStudentLessons',
|
||||||
"/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({
|
||||||
"data": require("../../data/uonetplus/GetSelfGovernments"),
|
data: require('../../data/uonetplus/GetSelfGovernments'),
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetStudentTrips"),
|
data: require('../../data/uonetplus/GetStudentTrips'),
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetKidsLessonPlan"),
|
data: require('../../data/uonetplus/GetKidsLessonPlan'),
|
||||||
"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({
|
||||||
"data": [],
|
data: [],
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetLastHomeworks"),
|
data: require('../../data/uonetplus/GetLastHomeworks'),
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetLastTests"),
|
data: require('../../data/uonetplus/GetLastTests'),
|
||||||
"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({
|
||||||
"data": [],
|
data: [],
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetLastStudentLessons"),
|
data: require('../../data/uonetplus/GetLastStudentLessons'),
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetStudentDirectorInformations"),
|
data: require('../../data/uonetplus/GetStudentDirectorInformations'),
|
||||||
"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({
|
||||||
"data": require("../../data/uonetplus/GetLastAnnouncements"),
|
data: require('../../data/uonetplus/GetLastAnnouncements'),
|
||||||
"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", {
|
||||||
|
@ -178,7 +178,7 @@ router.get(["/powiatwulkanowy/Start.mvc", "/powiatwulkanowy/Start.mvc/Index"], (
|
||||||
protocol(req) +
|
protocol(req) +
|
||||||
"://" +
|
"://" +
|
||||||
req.get("host").replace("uonetplus", "uonetplus-wiadomosciplus"),
|
req.get("host").replace("uonetplus", "uonetplus-wiadomosciplus"),
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
const {uuid} = require('uuidv4');
|
const { uuid } = require('uuidv4')
|
||||||
|
|
||||||
function createResponse(data) {
|
function createResponse(data) {
|
||||||
return {
|
return {
|
||||||
"Status": "Ok",
|
Status: 'Ok',
|
||||||
"TimeKey": Math.round(new Date().getTime() / 1000),
|
TimeKey: Math.round(new Date().getTime() / 1000),
|
||||||
"TimeValue": new Date().toUTCString(), //"2018.04.25 14:44:54"
|
TimeValue: new Date().toUTCString(), //"2018.04.25 14:44:54"
|
||||||
"RequestId": uuid(),
|
RequestId: uuid(),
|
||||||
"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,103 +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([
|
days.push([getDayName(date), formatDate(toDate(date)), date])
|
||||||
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,9 +1,14 @@
|
||||||
exports.getGradeColorByCategoryName = name => {
|
exports.getGradeColorByCategoryName = (name) => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case name.includes("czarny"): return "000000";
|
case name.includes('czarny'):
|
||||||
case name.includes("czerw"): return "F04C4C";
|
return '000000'
|
||||||
case name.includes("fiol"): return "B16CF1";
|
case name.includes('czerw'):
|
||||||
case name.includes("nieb"): return "20A4F7";
|
return 'F04C4C'
|
||||||
case name.includes("zielony"): return "6ECD07";
|
case name.includes('fiol'):
|
||||||
|
return 'B16CF1'
|
||||||
|
case name.includes('nieb'):
|
||||||
|
return '20A4F7'
|
||||||
|
case name.includes('zielony'):
|
||||||
|
return '6ECD07'
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
Loading…
Reference in a new issue