Első commit
|
|
@ -42,7 +42,7 @@ build/Release
|
|||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
package-lock.json
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
|
|
@ -122,7 +122,11 @@ dist
|
|||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# custom
|
||||
202*/**/*.*
|
||||
exportDB/
|
||||
*.pdf
|
||||
public/bower_components
|
||||
# yarn v2
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
{"configDir":"./greenlock.d","manager":{"module":"@greenlock/manager"}}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"CurrentProjectSetting": null
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"ExpandedNodes": [
|
||||
""
|
||||
],
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"board": "esp8266:esp8266:huzzah",
|
||||
"configuration": "CpuFrequency=80,VTable=flash,FlashSize=4M1M,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None____,FlashErase=none,UploadSpeed=115200",
|
||||
"port": "COM4"
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Win32",
|
||||
"forcedInclude": [],
|
||||
"intelliSenseMode": "msvc-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "pwa-node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}\\app.js",
|
||||
"sourceMaps": true,
|
||||
"restart": true,
|
||||
"outFiles": ["${workspaceFolder}/bin/**/*.js"],
|
||||
"resolveSourceMapLocations": [
|
||||
"${workspaceFolder}/**",
|
||||
"!**/node_modules/**"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"debug.javascript.warnOnLongPrediction": false,
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "change-version",
|
||||
"path": "public/bower_components/bootstrap/",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,499 @@
|
|||
//console.log('Hello world!');
|
||||
const express=require('express');
|
||||
const path= require('path');
|
||||
const mongoose=require('mongoose');
|
||||
const bodyParser=require('body-parser');
|
||||
const numeral = require('numeral');
|
||||
const expressValidator = require('express-validator');
|
||||
const flash = require('connect-flash');
|
||||
const session = require('express-session');
|
||||
const passport = require('passport');
|
||||
const config = require('./config/database');
|
||||
var fse = require('fs-extra');
|
||||
var utils = require('./js/utils');
|
||||
var logging=require('./js/helpers');
|
||||
//const util = require('util');
|
||||
//var currentWorkNumber=0;
|
||||
global.currentWorkNumber=0;
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.connect('mongodb://nodeUser:Kutafaja1234@localhost/nodekb',{ useMongoClient: true });
|
||||
//mongoose.connect('mongodb://admin:MarkoSn1Pb1@iotechnic.eu:27017/nodekb',{ useMongoClient: true });
|
||||
let db = mongoose.connection;
|
||||
//autoIncrement.initialize(mongoose.connection);
|
||||
|
||||
//TEST
|
||||
|
||||
// set globals
|
||||
|
||||
|
||||
// Check for DB errors
|
||||
db.on('error', function(err) {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
// Check connection
|
||||
|
||||
db.once('openUri', function(){
|
||||
console.log('Connected to MongoDB')
|
||||
});
|
||||
|
||||
|
||||
// Init app
|
||||
const app = express();
|
||||
|
||||
// Bring in models
|
||||
let Article = require('./models/article')
|
||||
let Work=require('./models/works')
|
||||
let User = require('./models/user');
|
||||
let KifCert = require('./models/kifcerts');
|
||||
let Log = require('./models/logmodel');
|
||||
//let Tool = require('./models/tool')
|
||||
var wCounter=0;
|
||||
|
||||
var findWorkQuery = Work.find({'workNumber': /EMSZ/ }).sort({workCounter : -1}).limit(1);
|
||||
var utils = require('./js/utils');
|
||||
|
||||
function ensureExists(path, mask, cb) {
|
||||
if (typeof mask == 'function') { // allow the `mask` parameter to be optional
|
||||
cb = mask;
|
||||
mask = 0777;
|
||||
}
|
||||
fs.mkdir(path, mask, function(err) {
|
||||
if (err) {
|
||||
if (err.code == 'EEXIST') cb(null); // ignore the error if the folder already exists
|
||||
else cb(err); // something else went wrong
|
||||
} else cb(null); // successfully created folder
|
||||
});
|
||||
}
|
||||
|
||||
// Új berendezés sorszám generálása
|
||||
function getNextWorkId(callback)
|
||||
{
|
||||
// Find last id
|
||||
|
||||
var cnt=0;
|
||||
findWorkQuery.exec(function(err, maxResult){
|
||||
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (maxResult[0]===undefined)
|
||||
{
|
||||
console.log('workCounter undefined...');
|
||||
cnt=0;
|
||||
}
|
||||
else {
|
||||
if (maxResult[0].workCounter==undefined)
|
||||
{
|
||||
cnt=1;
|
||||
}
|
||||
else {
|
||||
cnt=maxResult[0].workCounter;
|
||||
}
|
||||
console.log(maxResult[0].workCounter);
|
||||
}
|
||||
cnt++;
|
||||
|
||||
console.log('Új WorkID: ' + cnt.toString());
|
||||
callback(null, cnt);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// Load view engine
|
||||
app.set('views',path.join(__dirname,'views'));
|
||||
app.set('view engine','pug');
|
||||
|
||||
// Body parser MW
|
||||
// parse application/x-www-form-urlencoded
|
||||
app.use(bodyParser.urlencoded({ extended: false }))
|
||||
|
||||
// parse application/json
|
||||
app.use(bodyParser.json())
|
||||
|
||||
// Set Public folder
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use(express.static(path.join(__dirname, 'media')));
|
||||
app.use(express.static(path.join(__dirname, 'docs')));
|
||||
app.use(flash());
|
||||
// Express session middlevare
|
||||
app.use(session({
|
||||
secret: 'keyboard cat',
|
||||
resave: true,
|
||||
saveUninitialized: true
|
||||
}))
|
||||
|
||||
// Express messages middleware
|
||||
app.use(require('connect-flash')());
|
||||
app.use(function (req, res, next) {
|
||||
res.locals.messages = require('express-messages')(req, res);
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(expressValidator({
|
||||
errorformatter: function(param, msg, value){
|
||||
var namescape = param.split('.')
|
||||
, root = namespace.shift()
|
||||
, formParam = root;
|
||||
|
||||
while(namespace.length){
|
||||
formParam += '[' + namespace.shift() + ']';
|
||||
}
|
||||
return {
|
||||
param : formParam,
|
||||
msg: msg,
|
||||
value: value
|
||||
};
|
||||
}
|
||||
}));
|
||||
|
||||
// Passport Config
|
||||
require('./config/passport')(passport);
|
||||
// Passport Middleware
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
|
||||
app.get('*', function(req, res, next){
|
||||
res.locals.user = req.user || null;
|
||||
next();
|
||||
});
|
||||
|
||||
// Admin check
|
||||
function checkUserAdmin2(req,callback)
|
||||
{
|
||||
// Find last id
|
||||
|
||||
if(req.user)
|
||||
{
|
||||
//console.log(req.user);
|
||||
if(req.user.username==='admisJacica' & req.user.auth==='ADMIN')
|
||||
{
|
||||
callback(null, true);
|
||||
}
|
||||
else {
|
||||
callback(null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Works Route
|
||||
app.get('/', utils.ensureAuthenticated, function(req, res) {
|
||||
var admin=false;
|
||||
|
||||
if(req.user)
|
||||
{
|
||||
checkUserAdmin2(req,function(err,res){
|
||||
admin=res;
|
||||
console.log(admin);
|
||||
});
|
||||
|
||||
|
||||
// if(req.user.username==='admisJacica') ad=true;
|
||||
}
|
||||
Work.find({},null,{sort: {workDate: -1}} ,function(err, works){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
// lastId=articles.workNumber;
|
||||
res.render('index', {
|
||||
title: 'Munkák',
|
||||
works: works,
|
||||
rot:admin
|
||||
// articles: workSign
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Works Route
|
||||
app.get('/work/layout_table',utils.ensureAuthenticated, function(req, res) {
|
||||
|
||||
res.render('layout_table', {
|
||||
title: 'Munkák'
|
||||
// articles: workSign
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Edit Work Route
|
||||
app.get('/work/edit/:id', utils.ensureAuthenticated,function (req,res) {
|
||||
Work.findById(req.params.id,function(err,work){
|
||||
if(err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
|
||||
var wnE=work.workNumber.substring(0,4);
|
||||
var wnY=work.workNumber.substring(5,9);
|
||||
var wnN=work.workNumber.substring(10,14);
|
||||
|
||||
res.render('edit_work', {
|
||||
title: work.title+' módosítása:',
|
||||
work: work,
|
||||
wCustom: wnE,
|
||||
wYear: wnY,
|
||||
wNumber: wnN
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Update Work data
|
||||
app.post('/work/edit/:id', utils.ensureAuthenticated,function(req,res){
|
||||
let work = {};
|
||||
|
||||
let query = {_id:req.params.id}
|
||||
|
||||
work.title = req.body.title;
|
||||
work.author = req.user._id;
|
||||
work.body = req.body.body;
|
||||
|
||||
Work.update(query, work, function(err){
|
||||
if(err){
|
||||
console.log(err);
|
||||
return;
|
||||
}else{
|
||||
console.log(Work.db.name);
|
||||
logging.logAppend("Munka módosítása.",req.user,work.id,Work.db.name,'WORKEDIT');
|
||||
req.flash('success',work.title+' adatai sikeresen szerkesztve');
|
||||
res.redirect('/work/'+req.params.id);
|
||||
}
|
||||
});
|
||||
|
||||
//}
|
||||
});
|
||||
|
||||
// Add Work Route
|
||||
app.get('/work/add', utils.ensureAuthenticated,function (req,res) {
|
||||
var dt = new Date();
|
||||
var devId;
|
||||
var wnY=dt.getFullYear();
|
||||
var workDate= dt.toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
// Find last id
|
||||
console.log('Keres');
|
||||
var admin=false;
|
||||
if(req.user)
|
||||
{
|
||||
checkUserAdmin2(req,function(err,res){
|
||||
admin=res;
|
||||
console.log(admin);
|
||||
});
|
||||
}
|
||||
|
||||
getNextWorkId(function(err,wid){
|
||||
if(err)
|
||||
{
|
||||
console.log('Hiba: getNextDevId');
|
||||
}
|
||||
else {
|
||||
//console.log('Kész W' +wid);
|
||||
devId=numeral(wid).format('0000');
|
||||
wCounter=wid;
|
||||
res.render('add_work', {
|
||||
title: 'Munka Felvétele',
|
||||
workN: devId,
|
||||
workDate: workDate,
|
||||
dateYear: wnY,
|
||||
rot:admin
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Add Work Submit POST Route
|
||||
app.post('/works/add', utils.ensureAuthenticated,function(req,res){
|
||||
req.checkBody('title','Munka megnevezése kötelező!').notEmpty();
|
||||
req.checkBody('workNumber','Munkaszám formátuma nem megfelelő: pl.: 0001').matches('^[0-9][0-9][0-9][0-9]$');//.notEmpty();
|
||||
// req.checkBody('author','Létrehozó nevének megadása kötelező!').notEmpty();
|
||||
// req.check('workNumber','Munkaszám fotrmátumnak meg kell felllnie: ÉÉÉÉ/####').matches('^\d{3}$');
|
||||
//req.checkBody('workSign','Berendezés jel megadása kötelező!').notEmpty();
|
||||
var dt = new Date();
|
||||
var wnY=dt.getFullYear();
|
||||
|
||||
// Get errors
|
||||
let errors = req.validationErrors();
|
||||
|
||||
if(errors)
|
||||
{
|
||||
var admin=false;
|
||||
if(req.user)
|
||||
{
|
||||
checkUserAdmin2(req,function(err,res){
|
||||
admin=res;
|
||||
console.log(admin);
|
||||
});
|
||||
}
|
||||
//var devId =numeral(wid).format('0000');
|
||||
var workDate= dt.toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
res.render('add_work', {
|
||||
title: 'Munka Felvétele',
|
||||
errors:errors,
|
||||
//workN: workN,
|
||||
workDate: workDate,
|
||||
dateYear: wnY,
|
||||
rot:admin
|
||||
})
|
||||
}
|
||||
else {
|
||||
|
||||
let work=new Work();
|
||||
|
||||
work.title = req.body.title;
|
||||
work.author = req.user._id;
|
||||
work.body = req.body.body;
|
||||
if (req.body.workNumberE==="EMSZ")
|
||||
{
|
||||
work.workNumber = "EMSZ-"+req.body.workNumberY+"/"+ req.body.workNumber;
|
||||
work.workCounter=wCounter;
|
||||
}
|
||||
else {
|
||||
work.workNumber = req.body.workNumberY+"/"+ req.body.workNumber;
|
||||
work.workCounter=0;
|
||||
}
|
||||
console.log(work.workNumber);
|
||||
work.workDate= req.body.workDate;
|
||||
|
||||
|
||||
//db.users.findOne({"username" : {$regex : ".*son.*"}});
|
||||
Work.findOne({'workNumber': work.workNumber}, function(err,wn) // Megnézzük van e már
|
||||
{
|
||||
if (err){
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
if (wn)
|
||||
{
|
||||
console.log("Már van ilyen munka");
|
||||
req.flash('danger','A '+work.workNumber+' munkaszám már foglalt!');
|
||||
res.redirect('/work/add');
|
||||
}
|
||||
else {
|
||||
|
||||
work.save(function(err){
|
||||
if(err){
|
||||
console.log(err);
|
||||
return;
|
||||
}else{
|
||||
// Munka könyvtár létrehozása
|
||||
logging.logAppend("Munka hozzáadása.",req.user,work.id,Work.db.name,'WORKADD');
|
||||
fse.mkdirs('/filedata/'+work._id, function(err){
|
||||
if (err) return console.error(err);
|
||||
|
||||
console.log("Könyvtár létrehozva! ->"+"/filedata/"+work._id);
|
||||
});
|
||||
req.flash('success','Munka sikeresen felvéve.');
|
||||
res.redirect('/');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Get Single Work
|
||||
app.get('/work/:id',utils.ensureAuthenticated,function(req,res){
|
||||
Work.findById(req.params.id,function(err,work) // Munka keresése sz ID-je alapján
|
||||
{
|
||||
|
||||
currentWorkNumber=work.workNumber;
|
||||
console.log(work.devicesArray);
|
||||
Article.find({
|
||||
'_id': { $in: work.devicesArray
|
||||
//mongoose.Types.ObjectId("5a5a0dd6a0bc231270e9fe91"),
|
||||
//mongoose.Types.ObjectId('4ed3f117a844e0471100000d'),
|
||||
//mongoose.Types.ObjectId('4ed3f18132f50c491100000e')
|
||||
}
|
||||
}, function(err, docs)
|
||||
{
|
||||
User.findById(work.author, function(err,user){
|
||||
if (err)
|
||||
{
|
||||
res.render('work',
|
||||
{
|
||||
work: work,
|
||||
articles: docs,
|
||||
author: 'Ismeretlen'
|
||||
});
|
||||
|
||||
}else {
|
||||
//console.log(docs);
|
||||
res.render('work',
|
||||
{
|
||||
work: work,
|
||||
articles: docs,
|
||||
author: user.name
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
//Devices Route
|
||||
app.get('/devices', utils.ensureAuthenticated,function(req, res) {
|
||||
Article.find({}, function(err, articles){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
// lastId=articles.workNumber;
|
||||
res.render('devicesView', {
|
||||
title: 'Berendezés gyártási számok',
|
||||
articles: articles
|
||||
// articles: workSign
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Route Files
|
||||
|
||||
let articles = require('./routes/articles');
|
||||
let users = require('./routes/users');
|
||||
//let tools = require('./routes/tools');
|
||||
let certificates_kif = require('./routes/certificates_kif');
|
||||
let certificates_tr = require('./routes/certificates_tr');
|
||||
let certificates_mc = require('./routes/certificates_mc');
|
||||
app.use('/articles', articles);
|
||||
app.use('/users', users);
|
||||
//app.use('/tools', tools);
|
||||
app.use('/certificates_kif',certificates_kif);
|
||||
app.use('/certificates_tr',certificates_tr);
|
||||
app.use('/certificates_mc',certificates_mc);
|
||||
/*
|
||||
app.delete('/devices/:id',utils.ensureAuthenticated,function(req,res){
|
||||
let query = { _id:req.params.id}
|
||||
console.log('Miafasz?');
|
||||
Article.remove(query, function(err){
|
||||
if(err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
res.send('Success');
|
||||
})
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
app.listen(80,function functionName() {
|
||||
console.log('Server elindult a 80-es porton.');
|
||||
});
|
||||
//3. lecke 9:58
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "nodekb",
|
||||
"description": "Lecke1",
|
||||
"main": "app.js",
|
||||
"authors": [
|
||||
"Vincze József"
|
||||
],
|
||||
"license": "ISC",
|
||||
"homepage": "",
|
||||
"private": true,
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"public/bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"air-datepicker": "^2.2.3",
|
||||
"bootstrap": "^3.3.7",
|
||||
"jquery-typeahead": "^2.10.4",
|
||||
"bootstrap-dropdown-hover": "^1.0.4",
|
||||
"semantic-ui-table": "^2.2.13",
|
||||
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
|
||||
"typeahead.js": "^0.11.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIEHjCCAwagAwIBAgIJAMjWtxCnYhqNMA0GCSqGSIb3DQEBCwUAMGcxCzAJBgNV
|
||||
BAYTAlVTMQ0wCwYDVQQIEwRVdGFoMQ4wDAYDVQQHEwVQcm92bzEjMCEGA1UEChMa
|
||||
QUNNRSBTaWduaW5nIEF1dGhvcml0eSBJbmMxFDASBgNVBAMTC2V4YW1wbGUuY29t
|
||||
MB4XDTE1MDcxMzE1MTk0NloXDTI1MDcxMjE1MTk0NlowZzELMAkGA1UEBhMCVVMx
|
||||
DTALBgNVBAgTBFV0YWgxDjAMBgNVBAcTBVByb3ZvMSMwIQYDVQQKExpBQ01FIFNp
|
||||
Z25pbmcgQXV0aG9yaXR5IEluYzEUMBIGA1UEAxMLZXhhbXBsZS5jb20wggEiMA0G
|
||||
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCiLN9xrvx/ukYuJxuUgA53hZjwY+4X
|
||||
3jvKBWQclRAuKdqclnG1eWe+LRc1plfLiLOAivncsvC+kHuB5wpFm00wxib2dDgc
|
||||
6MdO8bOIgAWbcjtnIHcuS9byCzf5LeMQLr84qgHV2Ezlow4/IKpWl4svc326Dh6X
|
||||
3oJf7uiUIm+yLZNWCoVAzMc5sMQX5Kp58YsxGZVA+0dbO6I708kDohoTGnhDRZxg
|
||||
TGKBRIYHxProgE+RP6heDortAr91n4zX8GZ4cgQQfq3NEdvqDJQNPjwOBWzP4ki2
|
||||
c5cd0YQ6iUZuST/drb9WAH/q3GddKLnO+Cy0owcDERvpIZI77ja1+kV1AgMBAAGj
|
||||
gcwwgckwHQYDVR0OBBYEFLtr78m4wbpn84a8VmB5kVkAlyJfMIGZBgNVHSMEgZEw
|
||||
gY6AFLtr78m4wbpn84a8VmB5kVkAlyJfoWukaTBnMQswCQYDVQQGEwJVUzENMAsG
|
||||
A1UECBMEVXRhaDEOMAwGA1UEBxMFUHJvdm8xIzAhBgNVBAoTGkFDTUUgU2lnbmlu
|
||||
ZyBBdXRob3JpdHkgSW5jMRQwEgYDVQQDEwtleGFtcGxlLmNvbYIJAMjWtxCnYhqN
|
||||
MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAGEvN3COJmLcBF5QVyCv
|
||||
ohv2hNplSAedQGhYYizIHNWtJSFMfCRNtgAClW2mDExz7g1Qb6MgYRSTxcJ274fM
|
||||
Nrw94fTrHn/jDELJuLYhtTaLKfWkpLCLya+y0jzpnQbinsKOeYht54Qv4R2WUd6f
|
||||
m9IqYnvdNpxEop82m+p12JsbECXcwMN9/0KubHRxmAcAOi9vbSjG6Git2dUaMnKj
|
||||
RElKW4ZJFBQqaiGiwJxLQGOYjmcqUu/ky31cBHAWj88s48tl2bQep/lxncNeBcak
|
||||
29Pqz6cv68IwEUPpKCqvHVFpf7MhuqYIDY6bZuqChKwBCnVwuqfZ+ZvXCfKk1iH/
|
||||
+Zc=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEAoizfca78f7pGLicblIAOd4WY8GPuF947ygVkHJUQLinanJZx
|
||||
tXlnvi0XNaZXy4izgIr53LLwvpB7gecKRZtNMMYm9nQ4HOjHTvGziIAFm3I7ZyB3
|
||||
LkvW8gs3+S3jEC6/OKoB1dhM5aMOPyCqVpeLL3N9ug4el96CX+7olCJvsi2TVgqF
|
||||
QMzHObDEF+SqefGLMRmVQPtHWzuiO9PJA6IaExp4Q0WcYExigUSGB8T66IBPkT+o
|
||||
Xg6K7QK/dZ+M1/BmeHIEEH6tzRHb6gyUDT48DgVsz+JItnOXHdGEOolGbkk/3a2/
|
||||
VgB/6txnXSi5zvgstKMHAxEb6SGSO+42tfpFdQIDAQABAoIBABfQDPMtZYf/uwRV
|
||||
27ffYcBtDnrlwXUhvZe5WOzVem282Yu6j3G9JN2I02qeRS/un6TVQ0EDyVPB9VCq
|
||||
sxhraFcsEVaI1CBykalm1hzJ54jeqhhHbRiQLDyYJxzgfwHGS2+vjttuikQBwDrG
|
||||
uhxC3j4WcDSclCNqmawqcV4m/E2mJa66YojKA4og+m/MHgV01iCEl85dqxd+ZDEU
|
||||
ceBW9E8aJ6ElF3FuQ1YNRbyE83nRtUJ+mgyjVaz5kBNiB4s7b/pXmGZJsgZm8nV6
|
||||
whAy8EuVX7UMwQe2VdP7it9sHjtB66MMfO4oS5RKCUjP1TejIaMJwJCPyM3vtmlZ
|
||||
RhKsImECgYEAzyWyRENUOLztKAZoxeVjZWQ+0AU+Hr1LAuq+DvtP8nJ+PjvQvxtI
|
||||
E3n4tNn9cC3RFty7EegAI6zBFqpPThS1Q3qBaakFz81nVnA1Jwcf4f1nFIT+9mFC
|
||||
N7BPGPTACW47iqbhMShbQqdl/F6ZZQxRpKYQ7Yf1SulNpRodt9ubUNkCgYEAyGwK
|
||||
OHIp1Gw0C5EwnIY4VnKSWUDOtFTLreHyjwxDPWnm/PDZ92gIuyJqOtnootZtKhFy
|
||||
FZBGyw6VHIS03AFt3OYrDoCiz8pGVqS4O5jHzKE9qYAAcx8t35ecrhLQq3IR1YmV
|
||||
g7TISEnHFuFEVi81Mhksx4/nIgM+8M05uboK9/0CgYBgFY016sEjPEcJHMf2m2ta
|
||||
eYBFP1lMKuOja71S97FitUbnmRk/u+jX1+jMAp1zLl1hLGu9Z47A/X3nBIKapjJa
|
||||
JXXny9X9SLqZNp0BCGX6jm8E7pfRMtXjPO3DlquI9E+8BaJJCf4i0cEVqc+fNnKc
|
||||
W8dYVosp/0PbxFxqjvvhKQKBgQCu7q4VCoA8Kp1ao0VcuUIfIi1evdQtTf3hLV+7
|
||||
P6bIydCVYdu9uA422BkEeQI2bxYlK8j5zU4dGgNIOwRpKs4rirJ2HAz/dLvkEC3F
|
||||
xtpNX0ck1NaPpN0zVW+p+D4uBohOa6IWrQpLHiopbEFrQBUcPyD4pj/FTjP3lgkW
|
||||
dK3yOQKBgEH8EiqXOkh+NcUDNrMLZsfcNCMDUIIqYJhht8PiSDmF4LqLhfvcc2LW
|
||||
fYppqhePtSmmjxyH8rBzGYzkQhAmcboBE61+pySuaApaxfe3UyA9l688gEVq0VZ6
|
||||
RP37bC67qJ7JxV1Eb82OgbMs+W19jpEstO844w9GPWjwpPjUuGOK
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIID/zCCAuegAwIBAgIUR0O50v5PhqJntGsJ69d2a96ltAkwDQYJKoZIhvcNAQEL
|
||||
BQAwgY4xCzAJBgNVBAYTAkhVMRQwEgYDVQQIDAtIYWpkdS1CaWhhcjERMA8GA1UE
|
||||
BwwIRGVicmVjZW4xEjAQBgNVBAoMCUlPVEVDSE5JQzERMA8GA1UECwwIS0xQT1JU
|
||||
QUwxDDAKBgNVBAMMA0NJVzEhMB8GCSqGSIb3DQEJARYSdi5qb3N6ZWZAZ21haWwu
|
||||
Y29tMB4XDTIyMDQyNzA2NDQ1MVoXDTIyMDUyNzA2NDQ1MVowgY4xCzAJBgNVBAYT
|
||||
AkhVMRQwEgYDVQQIDAtIYWpkdS1CaWhhcjERMA8GA1UEBwwIRGVicmVjZW4xEjAQ
|
||||
BgNVBAoMCUlPVEVDSE5JQzERMA8GA1UECwwIS0xQT1JUQUwxDDAKBgNVBAMMA0NJ
|
||||
VzEhMB8GCSqGSIb3DQEJARYSdi5qb3N6ZWZAZ21haWwuY29tMIIBIjANBgkqhkiG
|
||||
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyArsMR4kAB3LvDsxSn+T8ZJxgzVrWjWf+QRQ
|
||||
4aqnnVPxu8qAl/I44t1pf4PstZQsxMe7mtzGCZf8ovWlOsPjOmFPMGsj5Kh0tsDy
|
||||
SubdwdOqvjat6ENf7OWfLHTaGFjCP5F+O+yYqc8cOV4Dm2PdoXe6Jl+qmHLqDwOA
|
||||
S44S7tNsanEj8648/AsNhPFENhf71mOdjDn5AsA+e1sxjmqH+4HAY+Mhb+KDO7DJ
|
||||
34P/+wi+VCMrmnclNwvfnXqHc5VcXsFOVbgoge5FokolMc/vjRkXhnb8RnC7/4An
|
||||
nzjLbHzQezJgbroLsxEe5oLvtveP56lwQlzTB0y2ayxgmISPgwIDAQABo1MwUTAd
|
||||
BgNVHQ4EFgQU8ywGAQRrU7eB5x5vpR2O/xtxuMMwHwYDVR0jBBgwFoAU8ywGAQRr
|
||||
U7eB5x5vpR2O/xtxuMMwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
|
||||
AQEACH+mUOP6oOXhXntc90RKmZLHNHfbOzWr8RYlez+P59MzKyhurfMygaPl3ayA
|
||||
9/AqiWqugl1ncfxi5+u4hDhzTF285QLJC+K0LFFChwU8juCaHQwTW2o1aDTy3UJv
|
||||
bix6CjR6gIsG0ZcfsuGWtrITldwv0DeVJ5KpO0fwpcPmsxLm+FlsWn2VzefS38y7
|
||||
70w/6yFlkSKWjmK/Nyz7tLjTqPzm2Yp75revBZjR3B3MuEWLoWXKQLQzhbzwy/MX
|
||||
WhxXBs/kb0RTc2qr9L03pmvPI1yA4mk41HjaQlbxhr5UkhLfyYoMbwU92RAmAUVy
|
||||
Wts4xuf51S9YDYAk+6toR0YRLg==
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDICuwxHiQAHcu8
|
||||
OzFKf5PxknGDNWtaNZ/5BFDhqqedU/G7yoCX8jji3Wl/g+y1lCzEx7ua3MYJl/yi
|
||||
9aU6w+M6YU8wayPkqHS2wPJK5t3B06q+Nq3oQ1/s5Z8sdNoYWMI/kX477Jipzxw5
|
||||
XgObY92hd7omX6qYcuoPA4BLjhLu02xqcSPzrjz8Cw2E8UQ2F/vWY52MOfkCwD57
|
||||
WzGOaof7gcBj4yFv4oM7sMnfg//7CL5UIyuadyU3C9+deodzlVxewU5VuCiB7kWi
|
||||
SiUxz++NGReGdvxGcLv/gCefOMtsfNB7MmBuuguzER7mgu+294/nqXBCXNMHTLZr
|
||||
LGCYhI+DAgMBAAECggEAHSf6ZO5PsPSmzTiTZphRp9QAV29hxjQqrNDEOR/2bife
|
||||
A9DwDTVwtSAwUDWaOpzuKYAzB89FzgApAldrTbVfWRL1x8jV4m3rFPfqWKBtkeKX
|
||||
8EFn94JaaNzO5lvhrcrCBSHflDxXw+g75OCfBfb4RqB8sTsgUjfthWKtQFXkzIoi
|
||||
JCHQH6M1OYGdt6VYJFq9ac4Luyrvg9zBmUlqimmX2qIwc88ZIUGYpl+p7hdsVZZo
|
||||
kkIh/arrujVqXUs+CGsblJFs/WiPCQbhCphJ69WXAQGh1EAheH1XjQwjsdLjCB/g
|
||||
s4BaBa/JOMaREQ+/DfkMXWbiGBVK3+6RsaWUY9FrAQKBgQDujXEr3sz8EaFw9pXt
|
||||
Dcv39t0dT7yxYOSJJM3MTIqt4zmpYdn8g/hhq/pDYHanY2QbCDaKt5X8kup8eHMP
|
||||
g91a02Wx0iJ/3mLo18Us6vZMzTXCtTU3gV6D4XXaAYesLa3xO0owqbI2FW7vP6vj
|
||||
6ZpOki5afVVLvGAHNxVXjXozOwKBgQDWrHA0E4ER1aVzkiJQdx7xT/7ZLpa43tlq
|
||||
/ewPZH9PDAF3wier/MePjVibkXRo95+Kn0FrSk5A8iSx+SPlL13ZPq5UgUq2UXun
|
||||
yyCB0ILwncfPuno344xt3noz8SIyrO85o1zjtVSe7WXjjDtie6xO4gstz4089+k1
|
||||
2CEqPQ5AWQKBgDxxD/SanftcCDiT8ca/USfBn6KWmmui7iSlc5NI7XZDdU+qYE3v
|
||||
rhYpOd6qaUXeE/YZbaBWBaWaH9lrt1N+CK7Dkyer41vcn9j5GpdX7RHmiLGNsi8f
|
||||
EzB9Bpw2+QYyCLlvWUvdIy863QG3czjq7lLsDNyWlu76iqYpWbn2ObkTAoGBAM4F
|
||||
z+kqjsQ+9fpkVOpEaD3POBXW0G+774zvBI4BNOz36LC2dLxqbFsom9ExVzcl7sdq
|
||||
7624MkHCIdVr9TcOrlLABS60pq8ypCn0l839/qxNwGVr4b+hcjQ/P6h50wgvT6dR
|
||||
UOR4Mi4UR6SKALQTXNqXtYLRngrVIcu7EJko33SBAoGALF/HAnBubqfbQtvFpcKt
|
||||
MYyrFRZPiRfTbX5nzKIgq9L9SkkJXu1cAQ3OP14BL9rFWaCJK+yRTb5ofCC6PDG3
|
||||
GctAthJRF+4pKgXTo9cy6bT9yf3lQhTF1aKV4Xy2h5JeHlI92BfoQM9QHThd68/E
|
||||
qd9vwQC0fw0A032jq+8nmRY=
|
||||
-----END PRIVATE KEY-----
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDSTCCAjECCQDO+JqPb+KtMDANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJV
|
||||
UzENMAsGA1UECBMEVXRhaDEOMAwGA1UEBxMFUHJvdm8xIzAhBgNVBAoTGkFDTUUg
|
||||
U2lnbmluZyBBdXRob3JpdHkgSW5jMRQwEgYDVQQDEwtleGFtcGxlLmNvbTAeFw0x
|
||||
NTA3MTMxNTE5NTdaFw0xODA3MTIxNTE5NTdaMGYxCzAJBgNVBAYTAlVTMQ0wCwYD
|
||||
VQQIEwRVdGFoMQ4wDAYDVQQHEwVQcm92bzEVMBMGA1UEChMMQUNNRSBTZXJ2aWNl
|
||||
MSEwHwYDVQQDExhsb2NhbC5oZWxsb3dvcmxkMzAwMC5jb20wggEiMA0GCSqGSIb3
|
||||
DQEBAQUAA4IBDwAwggEKAoIBAQCjxjgNVmfGZ04JzIPUxOEpbjgvEYD0C7Fxdjqa
|
||||
liZvctz9pAn5XfrUV49SUDvJVbMA+nBmdtfqKoBrsZYaVgjwUHCWfeuDwIs624BK
|
||||
Nd7fH0XKiNEb4LaNyFkVMMKy/IjV4pxCnmf4DBA3twWmtqhK4kmLKnClq0jxJPEV
|
||||
Giosb6c3RyxM9yQOHXpfnIs5LNBMzNlAKeRX4ptDgKOmdF+yPBDYErYI86WLXjhw
|
||||
v9oHv1+fiAE88hCK8oHlHZ/qovjZcPiqgnDGCSpdHrBrrua5XvEtnqTURpz27JAh
|
||||
Ri0SxsnAi4IGiRTqjYQL7wgMg2oCYq/SuCI5pDqCjpV1Nkh7AgMBAAEwDQYJKoZI
|
||||
hvcNAQELBQADggEBACmiV8y7vkLiCCjC9e5oUl7KBcshdIzRmVhKZ+sYSxghDs4s
|
||||
XXz1C999ogWqaHFZWgiH+I/wI2pwuSA6++gdF7ii7PwKgxRvRGC7UgfbWk7X1vRo
|
||||
d/T/xuU8gJCJiJXsCl3CciWCACRUhgzyQOYABgD64zg/nZjrjjy/4qJzrirPFcNQ
|
||||
bmHprQV5PnkeTYxmip0CiIv7iZp0CshSaHpBJsqQtPBzwaN623SlZ6CqI0CsBH/1
|
||||
0aH8wF1SUBTCSqjVfbNKyyht/kUCvhirhB1U6OQCfDC+646O+Y7kI2E7K4mEGqRL
|
||||
3nqSyi1z9XzI4fi1BylKg0M0/3czQubkV/Nly5g=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEAo8Y4DVZnxmdOCcyD1MThKW44LxGA9AuxcXY6mpYmb3Lc/aQJ
|
||||
+V361FePUlA7yVWzAPpwZnbX6iqAa7GWGlYI8FBwln3rg8CLOtuASjXe3x9FyojR
|
||||
G+C2jchZFTDCsvyI1eKcQp5n+AwQN7cFpraoSuJJiypwpatI8STxFRoqLG+nN0cs
|
||||
TPckDh16X5yLOSzQTMzZQCnkV+KbQ4CjpnRfsjwQ2BK2CPOli144cL/aB79fn4gB
|
||||
PPIQivKB5R2f6qL42XD4qoJwxgkqXR6wa67muV7xLZ6k1Eac9uyQIUYtEsbJwIuC
|
||||
BokU6o2EC+8IDINqAmKv0rgiOaQ6go6VdTZIewIDAQABAoIBACX/JiAKDPeeHh/t
|
||||
4CQsLWU0WjqpX/a/A8MkQAJ/lZlD1/vM5DeD018SlYDudoCGrooqkItlRUDh7XuO
|
||||
7xlbHqXKs+RmgI7HzEWyiXguOXAgzEtqJMHIB/KrKefdsT5fksu00LYwFEUbX2Pd
|
||||
xaThOfhtucxc41e8fqbcAEb6FBDM07uUj6IfMhhF1EfibdCXI0KTwZCTnWhArtyQ
|
||||
y+/GIZz0Mmn5dc9bHXXUTipoaGdzcIcr+x9wX0V8zEpEOpX45khdMf1L000Y3tdq
|
||||
bYDEkksRrayjWK5yO/fGel9ZM/3H3EGT1LChHMRP9nKvPMpGxSoWqeMWju/SEfib
|
||||
qRVfgtkCgYEA0xAbIMU9DUG0d992QHv/zOSxkIh+k98Za0edIkhdQdfI4mGbetf+
|
||||
23EM5hXJKVxLuUZ8PQiQ4BK5Pjlc84QWNyz0/1GYvf1yO4yl/dMDCaqUCjYIqDz4
|
||||
yQ0CLRay/7l2h3dVyE+cCYdWkfkePRHs+VHAFRkLJkaRvVf6RKqeVgUCgYEAxqSq
|
||||
uEMJXmnRCJmpb+FO0trUpvrTxdvM2xtLbdPYF0B/4wyD7ftZjzWdGmmI0V5kt1Nd
|
||||
DGSKbU1w2Hitt8upfgUe6ZAscf9sY00+JDTLqrBXBTvkOIhfFAtHNFKgL6OQtWyD
|
||||
wiikuYmw1Fzm243hn/gtOGMYN0Ii+bY6YT157H8CgYEAkmeVqcGne86b9JrZWBmr
|
||||
cuEgGnXT95bF9xiR8vnnVojsG7xBMZEqg+WDYQazpzEShc5S17Nda1ERlgwMYg65
|
||||
qkRRHdnn7cIkvxHtAoigjs/4KK0ajDjfCfcwDz6zo5dulME+i9hNEH8EmfUH+Ky6
|
||||
iKcgaoIYrdA9v+2K+J6xflECgYEAsSpeRRcs/PLdh5EdKHbHyZF4xjDBvh8ql2TB
|
||||
ooOloB9bsFISPKfHmc2Uf+EOMMXCiCsmuw3U1GWUNs1zCpDva0D/8AoxSb8omWxj
|
||||
9wDLgUHjavyesLkYK5VffVAQJEz6nITbAskjGYOvncf58mmZiQZctoTTLT2kWhjn
|
||||
+qBM5NsCgYBj971mIprEYbPHZ+O0IjRB+cgYej9cLC42ltU2FoCQk4iy/gSZ6yRm
|
||||
RAAgOt3AWFN+YwBTx47bcOjPqRX1iaOsiNidVv42bqfuz5L7cQvxpTa+OdP/H5OQ
|
||||
06ASSL5YdXEhiI0fqjaRjdhkOwyT4bhuIMFTOP1ez3J0A10HnPb7Zw==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
database:'mongodb://localhost:27017/nodekb',
|
||||
secret: 'yoursecret'
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
const LocalStrategy = require('passport-local').Strategy;
|
||||
const User = require('../models/user');
|
||||
const config = require('../config/database');
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
module.exports = function(passport){
|
||||
// Local Strategy
|
||||
passport.use(new LocalStrategy(function(username, password, done){
|
||||
// Match Username
|
||||
let query = {username:username};
|
||||
User.findOne(query, function(err, user){
|
||||
if(err) throw err;
|
||||
if(!user){
|
||||
return done(null, false, {message: 'No user found'});
|
||||
}
|
||||
|
||||
// Match Password
|
||||
bcrypt.compare(password, user.password, function(err, isMatch){
|
||||
if(err) throw err;
|
||||
if(isMatch){
|
||||
return done(null, user);
|
||||
} else {
|
||||
return done(null, false, {message: 'Wrong password'});
|
||||
}
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
passport.serializeUser(function(user, done) {
|
||||
done(null, user.id);
|
||||
});
|
||||
|
||||
passport.deserializeUser(function(id, done) {
|
||||
User.findById(id, function(err, user) {
|
||||
done(err, user);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"installed":{"client_id":"337904382855-q8tk0tgo3a91d9vvgtovi14brr60ugdv.apps.googleusercontent.com","project_id":"quickstart-1619511378577","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"dB9TaB_8vnaMzGxEI8lm3aPi","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"defaults": {
|
||||
"store": {
|
||||
"module": "greenlock-store-fs"
|
||||
},
|
||||
"challenges": {
|
||||
"http-01": {
|
||||
"module": "acme-http-01-standalone"
|
||||
}
|
||||
},
|
||||
"renewOffset": "-45d",
|
||||
"renewStagger": "3d",
|
||||
"accountKeyType": "EC-P256",
|
||||
"serverKeyType": "RSA-2048",
|
||||
"subscriberEmail": "v.joszef@gmail.com"
|
||||
},
|
||||
"sites": [
|
||||
{
|
||||
"subject": "iotechnic.eu",
|
||||
"altnames": [
|
||||
"iotechnic.eu",
|
||||
"www.iotechnic.eu"
|
||||
],
|
||||
"renewAt": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"defaults": {
|
||||
"store": {
|
||||
"module": "greenlock-store-fs"
|
||||
},
|
||||
"challenges": {
|
||||
"http-01": {
|
||||
"module": "acme-http-01-standalone"
|
||||
}
|
||||
},
|
||||
"renewOffset": "-45d",
|
||||
"renewStagger": "3d",
|
||||
"accountKeyType": "EC-P256",
|
||||
"serverKeyType": "RSA-2048",
|
||||
"subscriberEmail": "v.joszef@gmail.com"
|
||||
},
|
||||
"sites": [
|
||||
{
|
||||
"subject": "iotechnic.eu",
|
||||
"altnames": [
|
||||
"iotechnic.eu",
|
||||
"www.iotechnic.eu"
|
||||
],
|
||||
"renewAt": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
extends layout
|
||||
|
||||
block content
|
||||
|
||||
a(href='/work/add', type='button')
|
||||
input.btn.btn-primary(type='button',value='Új munka felvétele')
|
||||
|
||||
h1 #{title}
|
||||
ul.list-group
|
||||
each work, i in works
|
||||
li.list-group-item
|
||||
span.badge #{work.devicesArray.length}
|
||||
a(href="/work/"+work._id)= work.title
|
||||
|
||||
|
|
@ -0,0 +1,459 @@
|
|||
const { Console } = require('console');
|
||||
const { mongo } = require('mongoose');
|
||||
const { Buffer } = require('buffer');
|
||||
const uuidAPIKey = require('uuid-apikey');
|
||||
const Moment = require('moment');
|
||||
const MomentRange = require('moment-range');
|
||||
const moment = MomentRange.extendMoment(Moment);
|
||||
let Employee = require('../models/employee');
|
||||
let WorkingTime = require('../models/workingtime');
|
||||
let Work=require('../models/works');
|
||||
let RfidDevice = require('../models/devices');
|
||||
const { drawBackground } = require('pdfmake/src/textDecorator');
|
||||
const passport = require('../config/passport');
|
||||
// Alkalmazotti lista lekérése
|
||||
|
||||
exports.apiRegisterDevice=function(deviceId,username,password,deviceType,callback){
|
||||
var apikey=uuidAPIKey.create();
|
||||
|
||||
|
||||
Employee.findOne({ name: username }, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!employee)
|
||||
callback(null,{'message':'Hibás felhasználói adatok!'});
|
||||
else
|
||||
employee.comparePassword(password, function(err, isMatch) {
|
||||
|
||||
if (!isMatch) {
|
||||
// Nem sikerült azonosítani
|
||||
callback(null,{'message':'Hibás felhasználói adatok!'});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Sikeres azonosítás
|
||||
|
||||
RfidDevice.findOne({'imei':deviceId} ,function(err, rfidDevice){
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else {
|
||||
if (rfidDevice)
|
||||
callback(null,{'message':'Az eszköz már regisztrálva van!'});
|
||||
else
|
||||
{
|
||||
|
||||
let rfidDev=new RfidDevice();
|
||||
|
||||
rfidDev.name=deviceType;
|
||||
rfidDev.assignment = employee.name;
|
||||
rfidDev.imei = deviceId;
|
||||
rfidDev.ccid = deviceType;
|
||||
rfidDev.state = 'Mobile terminal';
|
||||
rfidDev.save(function(err){
|
||||
if(err){
|
||||
console.log(err);
|
||||
return;
|
||||
}else{
|
||||
|
||||
let empl={};
|
||||
|
||||
empl.apiKey=apikey.apiKey;
|
||||
empl.uuid=apikey.uuid;
|
||||
let query = {_id:employee._id}
|
||||
|
||||
Employee.findOneAndUpdate(query,empl,{ returnNewDocument: true },function(err,document){
|
||||
if(err){
|
||||
console.log(err);
|
||||
return;
|
||||
}else{
|
||||
console.log('Mobil eszköz sikeresen hozzáadva '+employee.name+' ['+deviceType+']');
|
||||
callback(null,{'message':'Sikeres regisztráció.','apiKey':apikey.apiKey});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.apiRequestAPIkey=function(username,password,callback){
|
||||
|
||||
Employee.findOne({ name: username }, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!employee)
|
||||
callback(null,{'message':'Hibás felhasználói adatok!'});
|
||||
else
|
||||
employee.comparePassword(password, function(err, isMatch) {
|
||||
|
||||
if (!isMatch) {
|
||||
// Nem sikerült azonosítani
|
||||
callback(null,{'message':'Hibás felhasználói adatok!'});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Sikeres azonosítás
|
||||
|
||||
console.log('API Key Requested '+employee.name);
|
||||
callback(null,{'message':'API kulcs kérés sikeres.','apiKey':employee.apiKey});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.apiCheckDevice=function(deviceId, callback){
|
||||
|
||||
// RFID Eszköz ellenőrzése
|
||||
|
||||
RfidDevice.findOne({'imei':deviceId} ,function(err, rfidDevice){
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else {
|
||||
if (rfidDevice)
|
||||
callback(null,{'device_state':'OK'});
|
||||
else
|
||||
callback(null,{'device_state':'FAIL'});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.apiEmployee=function(apiKey, callback){
|
||||
|
||||
Employee.findOne({'apiKey':apiKey}, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (employee)
|
||||
{
|
||||
var mpe=false;
|
||||
if (employee.mobilePortalAccessEnabled==true) mpe=true;
|
||||
callback(null,{'name':employee.name,'id':employee._id, 'isForeman':employee.isForeman,'mobilePortalAccessEnabled':mpe});
|
||||
}
|
||||
else
|
||||
callback(null,null);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Egy havi munkaidő összegzés
|
||||
exports.apiSumOfMonth=function(employee_id,mindate,callback)
|
||||
{
|
||||
apiGetWorkTimeListById(employee_id,mindate,function(err,wt){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
callback(err);
|
||||
}
|
||||
else {
|
||||
var workDays=[];
|
||||
wt.forEach(function(element)
|
||||
{
|
||||
var hoursToday=0;
|
||||
var day = moment(element.date,'YYYY.MM.DD.').day();
|
||||
var isWeekend = (day === 6) || (day === 0); // 6 = Saturday, 0 = Sunday
|
||||
var latS=element.latitudeS;
|
||||
var lonS=element.longitudeS;
|
||||
var latE=element.latitudeE;
|
||||
var lonE=element.longitudeE;
|
||||
|
||||
if (typeof element.latitudeS==='undefined') latS='N/A'
|
||||
if (typeof element.longitudeS==='undefined') lonS='N/A'
|
||||
if (typeof element.latitudeE==='undefined') latE='N/A'
|
||||
if (typeof element.longitudeE==='undefined') lonE='N/A'
|
||||
|
||||
// Ha hétköznap
|
||||
var wdays=workDays.find(e=>e.date===element.date);
|
||||
if (wdays)
|
||||
{ // Már van ilyen nap
|
||||
|
||||
wdays.startStop.push({start:element.timeArrive,stop:element.timeGetaway,arriveLoc:element.location,
|
||||
getawayLoc:element.locationStop,arriveCoords:{lat:latS,lon:lonS},
|
||||
getavayCoords:{lat:latE,lon:lonE}});
|
||||
|
||||
wdays.fullHours+=element.workHours;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Még nincs ilyen nap, hozzáadjuk
|
||||
workDays.push({
|
||||
date:element.date,
|
||||
isMunkaszunet:false,
|
||||
isHoliday:false,
|
||||
isWeekend:isWeekend,
|
||||
location:element.location,
|
||||
notes:element.notes,
|
||||
startStop:[{
|
||||
start:element.timeArrive,
|
||||
stop:element.timeGetaway,
|
||||
arriveLoc:element.location,
|
||||
getawayLoc:element.locationStop,
|
||||
arriveCoords:{lat:element.latitudeS,lon:element.longitudeS},
|
||||
getavayCoords:{lat:element.latitudeE,lon:element.longitudeE}
|
||||
}],
|
||||
fullHours:element.workHours,
|
||||
hours:0,
|
||||
overTime:0});
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
callback(null,workDays);
|
||||
}
|
||||
})
|
||||
}
|
||||
// Munkaidő lekérdezés
|
||||
function apiGetWorkTimeListById(employeeId,mindate,callback)
|
||||
{
|
||||
var date = new Date();
|
||||
var query={};
|
||||
|
||||
// Ehavi esedékes
|
||||
|
||||
var firstDay= moment(mindate,"YYYY.MM").startOf('month').format("YYYY.MM.DD.");
|
||||
var lastDay = moment(mindate,"YYYY.MM").endOf('month').format("YYYY.MM.DD.");
|
||||
//query={$and:[{'state':'ENDED','date': {$gte : firstDay,$lte: lastDay},'employeeId': employeeId}]};
|
||||
query={$and:[{'date': {$gte : firstDay,$lte: lastDay},'employeeId': employeeId}]};
|
||||
|
||||
WorkingTime.find(query,null,function(err, wt){
|
||||
if (err)
|
||||
{
|
||||
callback(err);
|
||||
}
|
||||
else {
|
||||
|
||||
callback(null,wt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Munkák listája
|
||||
exports.apiGetWorkList=function(apiKey,callback){
|
||||
|
||||
Employee.findOne({'apiKey':apiKey}, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (employee)
|
||||
{
|
||||
Work.find({},{'_id':1,'title':1,'body':1,'state':1},{sort: {workNumber: -1}} ,function(err, woks){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
|
||||
callback(null, woks);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null,null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
exports.apiGetAllReport=function(apiKey,callback){
|
||||
Employee.findOne({'apiKey':apiKey}, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (employee)
|
||||
{
|
||||
Employee.find({'konyvelesre':'on'},{'_id':1,'name':1},{sort: {name: -1}} ,function(err, emp){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
Work.find(
|
||||
{
|
||||
"dailyReport" : {$exists:true},
|
||||
$where:'this.dailyReport.length>0'
|
||||
},{
|
||||
'title':1,
|
||||
'dailyReport':1,
|
||||
'body':1,
|
||||
'workNumber':1,
|
||||
'poNumber':1,
|
||||
'state':1
|
||||
},{
|
||||
sort: {workNumber: 1}
|
||||
}
|
||||
,function(err,drList){
|
||||
|
||||
|
||||
callback(null, drList);//{employeeList:emp,reportList:drList});
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Napi jelentés get
|
||||
// Ősszes munka listája
|
||||
exports.apiGetWorkList=function(apiKey,callback){
|
||||
Employee.findOne({'apiKey':apiKey}, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (employee)
|
||||
{
|
||||
Work.find({},{
|
||||
'_id':1,
|
||||
'title':1,
|
||||
'body':1,
|
||||
'workNumber':1,
|
||||
'poNumber':1,
|
||||
'state':1
|
||||
},{sort: {workNumber: -1}} ,function(err, woks){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
|
||||
callback(null, woks);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null,null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
// Munkák listája
|
||||
exports.apiGetDailyReport=function(apiKey,callback){
|
||||
Employee.findOne({'apiKey':apiKey}, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (employee)
|
||||
{
|
||||
Employee.find({'konyvelesre':'on'},{'_id':1,'name':1},{sort: {name: -1}} ,function(err, emp){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
Work.find({},{'_id':1,'title':1,'body':1,'state':1},{sort: {workNumber: -1}} ,function(err, woks){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
|
||||
callback(null, {employeeList:emp,workList:woks});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null,null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// Munkák listája
|
||||
exports.apiGetEmployeeList=function(apiKey,callback){
|
||||
|
||||
Employee.findOne({'apiKey':apiKey}, function(err,employee)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (employee)
|
||||
{
|
||||
Employee.find({'konyvelesre':'on'},{'_id':1,'name':1},{sort: {name: -1}} ,function(err, emp){
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
else {
|
||||
|
||||
callback(null, emp);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(null,null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
const { uint8array, array } = require("jszip/lib/support")
|
||||
|
||||
exports.newPacket=function(cmd,payload)
|
||||
{
|
||||
if (!cmd)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (payload)
|
||||
{
|
||||
var p=2;
|
||||
var bf=new Uint8Array(payload.length+3);
|
||||
bf[0]=0xFE;
|
||||
bf[1]=cmd;
|
||||
|
||||
payload.forEach((element,index) => {
|
||||
bf[p]=element;
|
||||
p=p+1;
|
||||
});
|
||||
bf[p]=0xFD;
|
||||
}
|
||||
|
||||
return bf;
|
||||
}
|
||||
|
||||
exports.parsePacket=function(data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
var len=data.length;
|
||||
if (data[0]!=0xFE || data[len-1]!=0xFD)
|
||||
{
|
||||
return -2
|
||||
}
|
||||
var cmd=data[1];
|
||||
var p=0;
|
||||
var bf=new Uint8Array(len-4);
|
||||
|
||||
data.forEach((element,index) => {
|
||||
if (index>1 && index<len-1)
|
||||
{
|
||||
bf[p]=element;
|
||||
p=p+1;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
return {'cmd':cmd,'payload':bf};
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
const fs = require('fs');
|
||||
const readline = require('readline');
|
||||
const {google} = require('googleapis');
|
||||
|
||||
// If modifying these scopes, delete token.json.
|
||||
const SCOPES = ['https://www.googleapis.com/auth/calendar'];
|
||||
// The file token.json stores the user's access and refresh tokens, and is
|
||||
// created automatically when the authorization flow completes for the first
|
||||
// time.
|
||||
const TOKEN_PATH = 'token.json';
|
||||
|
||||
// Load client secrets from a local file.
|
||||
exports.apiCalendar=function(){
|
||||
fs.readFile('credentials.json', (err, content) => {
|
||||
if (err) return console.log('Error loading client secret file:', err);
|
||||
// Authorize a client with credentials, then call the Google Calendar API.
|
||||
authorize(JSON.parse(content), listEvents);
|
||||
authorize(JSON.parse(content), addEvents);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create an OAuth2 client with the given credentials, and then execute the
|
||||
* given callback function.
|
||||
* @param {Object} credentials The authorization client credentials.
|
||||
* @param {function} callback The callback to call with the authorized client.
|
||||
*/
|
||||
function authorize(credentials, callback) {
|
||||
const {client_secret, client_id, redirect_uris} = credentials.installed;
|
||||
const oAuth2Client = new google.auth.OAuth2(
|
||||
client_id, client_secret, redirect_uris[0]);
|
||||
|
||||
// Check if we have previously stored a token.
|
||||
fs.readFile(TOKEN_PATH, (err, token) => {
|
||||
if (err) return getAccessToken(oAuth2Client, callback);
|
||||
oAuth2Client.setCredentials(JSON.parse(token));
|
||||
callback(oAuth2Client);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and store new token after prompting for user authorization, and then
|
||||
* execute the given callback with the authorized OAuth2 client.
|
||||
* @param {google.auth.OAuth2} oAuth2Client The OAuth2 client to get token for.
|
||||
* @param {getEventsCallback} callback The callback for the authorized client.
|
||||
*/
|
||||
function getAccessToken(oAuth2Client, callback) {
|
||||
const authUrl = oAuth2Client.generateAuthUrl({
|
||||
access_type: 'offline',
|
||||
scope: SCOPES,
|
||||
});
|
||||
console.log('Authorize this app by visiting this url:', authUrl);
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
rl.question('Enter the code from that page here: ', (code) => {
|
||||
rl.close();
|
||||
oAuth2Client.getToken(code, (err, token) => {
|
||||
if (err) return console.error('Error retrieving access token', err);
|
||||
oAuth2Client.setCredentials(token);
|
||||
// Store the token to disk for later program executions
|
||||
fs.writeFile(TOKEN_PATH, JSON.stringify(token), (err) => {
|
||||
if (err) return console.error(err);
|
||||
console.log('Token stored to', TOKEN_PATH);
|
||||
});
|
||||
callback(oAuth2Client);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists the next 10 events on the user's primary calendar.
|
||||
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
|
||||
*/
|
||||
function listEvents(auth) {
|
||||
const calendar = google.calendar({version: 'v3', auth});
|
||||
calendar.events.list({
|
||||
calendarId: 'primary',
|
||||
timeMin: (new Date()).toISOString(),
|
||||
maxResults: 10,
|
||||
singleEvents: true,
|
||||
orderBy: 'startTime',
|
||||
}, (err, res) => {
|
||||
if (err) return console.log('The API returned an error: ' + err);
|
||||
const events = res.data.items;
|
||||
if (events.length) {
|
||||
console.log('Upcoming 10 events:');
|
||||
events.map((event, i) => {
|
||||
const start = event.start.dateTime || event.start.date;
|
||||
console.log(`${start} - ${event.summary}`);
|
||||
});
|
||||
} else {
|
||||
console.log('No upcoming events found.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addEvents(auth) {
|
||||
const calendar = google.calendar({version: 'v3', auth});
|
||||
|
||||
calendar.events.insert({
|
||||
calendarId: 'primary',
|
||||
resource: event,
|
||||
}, function(err, event) {
|
||||
if (err) {
|
||||
console.log('There was an error contacting the Calendar service: ' + err);
|
||||
return;
|
||||
}
|
||||
console.log('Event created: %s', event.data.htmlLink);
|
||||
});
|
||||
calendar.events.insert({
|
||||
calendarId: 'primary',
|
||||
timeMin: (new Date()).toISOString(),
|
||||
maxResults: 10,
|
||||
singleEvents: true,
|
||||
orderBy: 'startTime',
|
||||
}, (err, res) => {
|
||||
if (err) return console.log('The API returned an error: ' + err);
|
||||
const events = res.data.items;
|
||||
if (events.length) {
|
||||
console.log('Upcoming 10 events:');
|
||||
events.map((event, i) => {
|
||||
const start = event.start.dateTime || event.start.date;
|
||||
console.log(`${start} - ${event.summary}`);
|
||||
});
|
||||
} else {
|
||||
console.log('No upcoming events found.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Refer to the Node.js quickstart on how to setup the environment:
|
||||
// https://developers.google.com/calendar/quickstart/node
|
||||
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
|
||||
// stored credentials.
|
||||
|
||||
var event = {
|
||||
'summary': 'Göd trafó csere',
|
||||
'location': 'GÖD Samsung',
|
||||
'description': 'Transzformátor telepítése.',
|
||||
'start': {
|
||||
'date': '2021-05-10',
|
||||
'timeZone': 'America/Los_Angeles',
|
||||
},
|
||||
'end': {
|
||||
'date': '2021-05-14',
|
||||
'timeZone': 'America/Los_Angeles',
|
||||
},
|
||||
|
||||
'attendees': [
|
||||
{ 'email': 'klmuhely@gmail.com',
|
||||
'displayName': 'Kapusi Imre'},
|
||||
{'email': 'v.joszef@gmail.com',
|
||||
'displayName': 'Kiss Sándor'},
|
||||
{'email': 'kutafaja@hotmail.com',
|
||||
'displayName': 'Vincze József'},
|
||||
],
|
||||
'reminders': {
|
||||
'useDefault': false,
|
||||
'overrides': [
|
||||
{'method': 'email', 'minutes': 24 * 60},
|
||||
{'method': 'popup', 'minutes': 4320},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
const { worker } = require('cluster');
|
||||
const moment = require('moment');
|
||||
|
||||
function addMezo(arr,id,data){
|
||||
arr+="<mezo eazon="+id+">"+data+"</mezo>\n";
|
||||
}
|
||||
function makeMezo(id,data){
|
||||
var arr="<mezo eazon=\""+id+"\">"+data+"</mezo>\n";
|
||||
return arr;
|
||||
}
|
||||
const zeroPad = (num, places) => String(num).padStart(places, '0')
|
||||
|
||||
exports.generateXML=function(enaploContent, callback){
|
||||
//const fs = require('fs');
|
||||
var resztvevok=enaploContent.resztvevok;
|
||||
var docSaved="20230110074736900";
|
||||
var docName=enaploContent.docName;// "OENY_ENAPLO_NAPI_370826709_2021_1513_53-5";
|
||||
var docId=enaploContent.docId;//"OENY_ENAPLO_NAPI_370826709_2021_1513_53-5";
|
||||
var enaploAzonosito=enaploContent.naploAzonosito;
|
||||
var enaploAlnaploSzam=enaploContent.alnaploAzonosito;
|
||||
var enaploAzonositoNev=enaploContent.enaploAzonositoNev;
|
||||
var enaploAlnaploNev=enaploContent.enaploAlnaploNev;
|
||||
var feltoltoNUJ=enaploContent.feltoltoNUJ;
|
||||
var feltoltoNev=enaploContent.feltoltoNev;
|
||||
var munkaidoKezdeteHH=enaploContent.munkaidoKezdeteHH;
|
||||
var munkaidoVégeHH=enaploContent.munkaidoVégeHH;
|
||||
var bejegyzesDatuma=enaploContent.bejegyzesDatuma;
|
||||
var bejegyzesIdopont=enaploContent.bejegyzesIdopont;
|
||||
let XML="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
let xmlHead=" <head filetype=\"zn1810\">\n"+
|
||||
" <type>single</type>\n"+
|
||||
" <saved>"+docSaved+"</saved>\n"+
|
||||
"<docinfo name=\""+docName+"\" id=\""+docId+"\" count=\"1\" note=\"\" ver=\""+enaploContent.programVerzio+"\" org=\"OENY\""+
|
||||
" templatever=\""+enaploContent.nyomtatvanyVerzio+"\" tax_number=\"\" from_date=\"\" to_date=\"\" person_name=\"\" account_name=\"\" calculated=\"true\" seq=\"1\" avdh_cst=\"\" />\n"+
|
||||
" </head>\n";
|
||||
let nyomtatvanyInfo="<nyomtatvanyinformacio>\n"+
|
||||
"<nyomtatvanyazonosito>"+docId+"</nyomtatvanyazonosito>\n"+
|
||||
// "<nyomtatvanyverzio>"+enaploContent.nyomtatvanyVerzio+"</nyomtatvanyverzio>\n"+
|
||||
"</nyomtatvanyinformacio>\n";
|
||||
let nyomtatvanyok= " <nyomtatvanyok xmlns=\"http://iop.gov.hu/2007/01/nyk/altalanosnyomtatvany\" "+
|
||||
"template=\""+docId+"\" name=\""+docId+"\" id=\""+docId+"\">\n";//+
|
||||
/* "<abev>\n"+
|
||||
"<hibakszama>-1</hibakszama>\n"+
|
||||
"<programverzio>"+enaploContent.programVerzio+"</programverzio>\n"+
|
||||
"</abev>\n"; */
|
||||
let nyomtatvanyMezok="<mezok>\n";
|
||||
let closingElement=" </mezok>\n"+
|
||||
"</nyomtatvany>\n"+
|
||||
"</nyomtatvanyok>\n"+
|
||||
"</file>";
|
||||
|
||||
// Első lap
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D001A",enaploAzonosito);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D002A",enaploAzonositoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D003A",enaploAlnaploSzam);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D004A",enaploAlnaploNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D005A",feltoltoNUJ);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D006A",feltoltoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D007A",enaploContent.epitesiHelyszin);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001D008A",bejegyzesDatuma);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001E001A",bejegyzesDatuma);
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001E002A","X"); // Munkavégzés történt
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001E003A",munkaidoKezdeteHH); // Munkavégzés kezdés óra
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001E004A","0"); // Munkavégzés kezdés perc
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001E005A",munkaidoVégeHH); // Munkavégzés kezdés óra
|
||||
nyomtatvanyMezok+=makeMezo("0_0A0001E006A","0"); // Munkavégzés kezdés perc
|
||||
// Második lap
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D001A",enaploAzonosito);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D002A",enaploAzonositoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D003A",enaploAlnaploSzam);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D004A",enaploAlnaploNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D005A",feltoltoNUJ);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D006A",feltoltoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D007A",enaploContent.epitesiHelyszin);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001D008A",bejegyzesDatuma);
|
||||
var i=1;
|
||||
var resztvevok=0;
|
||||
enaploContent.resztvevok.forEach(resztvevo=>{
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001E"+zeroPad(i,3)+"A",resztvevo.szakma);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001E"+zeroPad(i+1,3)+"A",resztvevo.szama);
|
||||
resztvevok+=resztvevo.szama;
|
||||
i+=2;
|
||||
})
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001E045A",resztvevok);
|
||||
nyomtatvanyMezok+=makeMezo("0_0B0001E047A",resztvevok);
|
||||
// Harmadik lap
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D001A",enaploAzonosito);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D002A",enaploAzonositoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D003A",enaploAlnaploSzam);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D004A",enaploAlnaploNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D005A",feltoltoNUJ);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D006A",feltoltoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D007A",enaploContent.epitesiHelyszin);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001D008A",bejegyzesDatuma);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001E046A",resztvevok);
|
||||
nyomtatvanyMezok+=makeMezo("0_0C0001E047A",resztvevok);
|
||||
|
||||
// Negyedik lap
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD001A",enaploAzonosito);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD002A",enaploAzonositoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD003A",enaploAlnaploSzam);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD004A",enaploAlnaploNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD005A",feltoltoNUJ);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD006A",feltoltoNev);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD007A",enaploContent.epitesiHelyszin);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXD008A",bejegyzesDatuma);
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXE001A",bejegyzesIdopont); // óra
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXE002A","0"); // perc
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXE003A","napi jelentés");
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXE004A","Kivitelező - napijelentésért felelős");
|
||||
nyomtatvanyMezok+=makeMezo("0_0DXXXXE005A",enaploContent.jelentesSzovege);
|
||||
XML+="<file>\n"+xmlHead+nyomtatvanyok+"<nyomtatvany sn=\"n0\">\n"+nyomtatvanyInfo+nyomtatvanyMezok+closingElement;
|
||||
/* fs.writeFile("./enaplo/EN_"+enaploContent.workName+"_"+enaploContent.bejegyzesDatuma+'.frm.enyk', XML, function(err) {
|
||||
if(err) {
|
||||
return console.log(err);
|
||||
}
|
||||
console.log("The file was saved!");
|
||||
}); */
|
||||
callback({result: XML});
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// Admin check
|
||||
function checkUserAdmin3(req,callback)
|
||||
{
|
||||
// Find last id
|
||||
|
||||
if(req.user)
|
||||
{
|
||||
//console.log(req.user);
|
||||
if(req.user.username==='admisJacica' & req.user.auth==='ADMIN')
|
||||
{
|
||||
callback(null, true);
|
||||
}
|
||||
else {
|
||||
callback(null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = checkUserAdmin3;
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
const Log = require('../models/logmodel');
|
||||
let Article = require('../models/article');
|
||||
function logRemoveOld()
|
||||
{
|
||||
var date = new Date();
|
||||
var daysToDeletion = 60;
|
||||
var deletionDate = new Date(date.setDate(date.getDate() - daysToDeletion)).toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
|
||||
//console.log(deletionDate);
|
||||
|
||||
//var db = db.getSiblingDB('db')
|
||||
//db.getMongo().setSlaveOk();
|
||||
|
||||
//console.log(Article.find({deviceDate : {$lt : deletionDate}}).count());
|
||||
|
||||
//delete old Messages:
|
||||
Log.remove({deviceDate : {$lt : deletionDate}});
|
||||
}
|
||||
|
||||
// Append Log
|
||||
/*logAppend: function(message,user,msgType,callback)
|
||||
{
|
||||
|
||||
if (message){
|
||||
var mylog=new Log();
|
||||
mylog.bornDate=new Date.now();
|
||||
mylog.user=User.username;
|
||||
mylog.message=message;
|
||||
mylog.logType=msgType;
|
||||
|
||||
mylog.save(function(err){
|
||||
if(err){
|
||||
callback(err);
|
||||
}else{
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
|
||||
}else{
|
||||
error=new Error('Ismeretlen Log paraméter!');
|
||||
callback(error);
|
||||
}
|
||||
} */
|
||||
module.exports ={
|
||||
logAppend: function(message,user,targetId,targetDb,msgType)
|
||||
{
|
||||
|
||||
if (message){
|
||||
var dt = new Date();
|
||||
var mylog=new Log();
|
||||
mylog.bornDate=dt.toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
mylog.user=user.id;
|
||||
mylog.message=message;
|
||||
mylog.logType=msgType;
|
||||
mylog.target_id=targetId;
|
||||
mylog.target_db=targetDb;
|
||||
|
||||
mylog.save();
|
||||
logRemoveOld();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
var vid = document.getElementById("bgvid");
|
||||
var pauseButton = document.querySelector("#polina button");
|
||||
|
||||
if (window.matchMedia('(prefers-reduced-motion)').matches) {
|
||||
vid.removeAttribute("autoplay");
|
||||
vid.pause();
|
||||
pauseButton.innerHTML = "Paused";
|
||||
}
|
||||
|
||||
function vidFade() {
|
||||
vid.classList.add("stopfade");
|
||||
}
|
||||
|
||||
vid.addEventListener('ended', function()
|
||||
{
|
||||
// only functional if "loop" is removed
|
||||
vid.pause();
|
||||
// to capture IE10
|
||||
vidFade();
|
||||
});
|
||||
|
||||
|
||||
pauseButton.addEventListener("click", function() {
|
||||
vid.classList.toggle("stopfade");
|
||||
if (vid.paused) {
|
||||
vid.play();
|
||||
pauseButton.innerHTML = "Pause";
|
||||
} else {
|
||||
vid.pause();
|
||||
pauseButton.innerHTML = "Paused";
|
||||
}
|
||||
})
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
var nodemailer = require('nodemailer');
|
||||
// Szervízs értesítő
|
||||
var transporter = nodemailer.createTransport({
|
||||
host: 'mail.klelectro.hu',
|
||||
port: 465,
|
||||
secret: true,
|
||||
auth: {
|
||||
user: 'munkanyilvantarto@klelectro.hu',
|
||||
pass: 'IoSn1Pb1'
|
||||
}
|
||||
});
|
||||
|
||||
exports.sendEmail=function (mailList,subject,message)
|
||||
{
|
||||
|
||||
var mailOptions = {
|
||||
from: 'munkanyilvantarto@klelectro.hu',//'szamlaertesito@gmail.com',
|
||||
to: mailList,
|
||||
subject: subject,
|
||||
text: message
|
||||
};
|
||||
|
||||
//mailOptions.text='Tisztelt '+employee.name+'!\n\nMunkaidő megkezdve ekkor: '+timeArrive+'\nMunkaidő lezárva ekkor: '+timeGetaway+'\nEzen a helyszínen: '+location+'\nMunka órák: '+worktime;
|
||||
transporter.sendMail(mailOptions, function(error, info){
|
||||
if (error) {
|
||||
console.log(error);
|
||||
} else {
|
||||
console.log('Email sent: ' + info.response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
const { trusted } = require('mongoose');
|
||||
const sql = require('mssql');
|
||||
const { stringify } = require('uuid');
|
||||
|
||||
var config = {
|
||||
server: 'KLELECTROSERVER', //update me
|
||||
authentication: {
|
||||
type: 'default',
|
||||
options: {
|
||||
userName: 'nodes', //update me
|
||||
password: 'Nincsis12345678' //update me
|
||||
}
|
||||
},
|
||||
options: {
|
||||
// If you are on Microsoft Azure, you need encryption:
|
||||
encrypt: false,
|
||||
database: 'Cegmenedzser K-L Electro Bt', //update me
|
||||
rowCollectionOnRequestCompletion:true
|
||||
}
|
||||
};
|
||||
var Connection = require('tedious').Connection;
|
||||
|
||||
exports.sqlGetnewWork=function(wk,callback){
|
||||
if (!connection)
|
||||
var connection = new Connection(config);
|
||||
|
||||
|
||||
connection.on('connect', function(err) {
|
||||
if (err){
|
||||
console.log('SQL ERROR.');
|
||||
return 0;
|
||||
}
|
||||
// If no error, then good to proceed.
|
||||
console.log("Connected");
|
||||
executeStatement(connection,wk,function(err,dd){
|
||||
connection.close();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
connection.on('error',function(err){
|
||||
console.log('SQL ERROR.');
|
||||
connection.close;
|
||||
return 0;
|
||||
})
|
||||
connection.connect();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
var Request = require('tedious').Request;
|
||||
var TYPES = require('tedious').TYPES;
|
||||
|
||||
function executeStatement(connection1,workn,callback) {
|
||||
var jsonArray = [];
|
||||
if (!workn) return;
|
||||
var worknumber=workn.workNumber.replace('/','0');
|
||||
var request = new Request("SELECT TOP (100) [RendAzon] ,[Rogzites],[SzallDatum],[Megjegyzes],[SzamlNev],[Projekt],[Megjegyzes2],[Megnevezes],[KulsoRendSzam]\
|
||||
FROM [Cegmenedzser K-L Electro Bt].[dbo].[Vevorendeles_fej]\
|
||||
where ISnumeric(SUBSTRING(Replace([Megjegyzes],'/','0'),1,9))=1 AND SUBSTRING(Replace([Megjegyzes],'/','0'),1,9) >'"+worknumber+"'\
|
||||
Order By [RendAzon] DESC",function(err,rowCounts,rows)
|
||||
{
|
||||
if (err)
|
||||
{
|
||||
console.log(err);
|
||||
callback(err,null);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log(rowCounts + " rows returned");
|
||||
|
||||
|
||||
|
||||
//Now parse the data from each of the row and populate the array.
|
||||
for(var i=0; i < rowCounts; i++)
|
||||
{
|
||||
var singleRowData = rows[i];
|
||||
var rowObject= {};
|
||||
//console.log(singleRowData.length);
|
||||
for(var j =0; j < singleRowData.length; j++)
|
||||
{
|
||||
var tempColName = singleRowData[j].metadata.colName;
|
||||
var tempColData = singleRowData[j].value;
|
||||
rowObject[tempColName] = tempColData;
|
||||
}
|
||||
if (singleRowData.length>3)
|
||||
{
|
||||
var s=singleRowData[3].value;
|
||||
rowObject['Munkaszam KL']=s.substring(0,9);
|
||||
}
|
||||
jsonArray.push(rowObject);
|
||||
}
|
||||
//This line will print the array of JSON object.
|
||||
console.log(jsonArray);
|
||||
callback(null,jsonArray);
|
||||
}
|
||||
});
|
||||
request.on('requestCompleted', function () {console.log("Fasza") });
|
||||
connection1.execSql(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
|
||||
// Mongoose import
|
||||
|
||||
var mongoose = require('mongoose');
|
||||
let Vehicle = require('../models/vehicle');
|
||||
var getDate= new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '');
|
||||
//var Parser = require("binary-parser").Parser;
|
||||
const Net = require('net');
|
||||
var prot=require('../js/bprotocolparser');
|
||||
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const { uint8array } = require('jszip/lib/support');
|
||||
|
||||
Date.prototype.toUnixTime = function() { return this.getTime()/1000|0 };
|
||||
|
||||
/*// Protocol parser
|
||||
var trackParser=new Parser()
|
||||
.int32("TID")
|
||||
.int32("LAT")
|
||||
.int32("LON")
|
||||
.int32("ALT")
|
||||
.int32("SPD")
|
||||
.int32("HED")
|
||||
|
||||
|
||||
// Protocol test
|
||||
exports.testProt=function(buf)
|
||||
{
|
||||
console.log(trackParser.parse(buf));
|
||||
}
|
||||
*/
|
||||
Date.prototype.toUnixTime = function() { return this.getTime()/1000|0 };
|
||||
|
||||
// Eszköz kiszolgálás
|
||||
// Bejövő adatok rögzítése
|
||||
function splitLines(t) { return t.split(/\r\n|\r|\n/); }
|
||||
// Koordináták rögzítése deviceid alapján
|
||||
exports.pushtelemetry=function(data,callback) {
|
||||
|
||||
|
||||
//console.log("Coords: "+data);
|
||||
// callback(null,"OK");
|
||||
// if (gps.state.fix==="3D")
|
||||
|
||||
/*
|
||||
track_id: String,
|
||||
timestamp: String,
|
||||
latitude: Number,
|
||||
longitude: Number,
|
||||
altitude: Number,
|
||||
speed: Number
|
||||
*/
|
||||
let lat=(data.lat/10000000);
|
||||
let lon=(data.lon/10000000);
|
||||
let track={track_id:data.tid,timestamp: getDate, latitude:lat,longitude:lon,altitude:data.alt, speed:data.spd,heading:data.hed };
|
||||
Vehicle.updateOne({device_id:data.did,newTrack_id:data.tid},{$push:{tracks:track}},function(err,upd){
|
||||
if (err)
|
||||
{
|
||||
console.log("DB Err: "+err);
|
||||
callback('DBERR',null);
|
||||
// res.send("DB_ERR");
|
||||
}else
|
||||
{
|
||||
if (upd.nModified===0)
|
||||
{
|
||||
console.log('device not Found: '+data.did);
|
||||
//res.send({err: 'device not Found'});
|
||||
callback('Device Not Found',null)
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Track logged.');
|
||||
//res.send({result: 'ok'});
|
||||
callback(null,"OK");
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
};
|
||||
|
||||
// Új útvonal
|
||||
exports.newTrack=function(deviceId,callback){
|
||||
let trid=uuidv4();
|
||||
Vehicle.updateOne({device_id:deviceId},{$set:{newTrack_id:trid}},function(err,upd){
|
||||
if (err)
|
||||
{
|
||||
console.log("DB Err: "+err);
|
||||
//res.send("DB_ERR");
|
||||
callback('DB ERR',null);
|
||||
}else
|
||||
{
|
||||
if (upd.nModified===0)
|
||||
{
|
||||
console.log('Device Not Found: '+deviceId);
|
||||
//res.send({err: 'Not Found'});
|
||||
callback('Device not found',null);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('New Track: '+trid);
|
||||
//res.send({newTrack_id: trid});
|
||||
callback(null,trid);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// **** TCP SERVER **** //
|
||||
const port = 8081;
|
||||
// Create a new TCP server.
|
||||
const server = new Net.Server();
|
||||
// The server listens to a socket for a client to make a connection request.
|
||||
// Think of a socket as an end point.
|
||||
server.listen(port, function() {
|
||||
console.log(`Tracker Server listening on socket localhost:${port}`);
|
||||
});
|
||||
|
||||
|
||||
// When a client requests a connection with the server, the server creates a new
|
||||
// socket dedicated to that client.
|
||||
server.on('connection', function(socket) {
|
||||
console.log('A new connection has been established.');
|
||||
|
||||
// Now that a TCP connection has been established, the server can send data to
|
||||
// the client by writing to its socket.
|
||||
//socket.write('Hello, client.');
|
||||
//var ma=moment().format('DD.MM.YYYY');
|
||||
// The server can also receive data from the client by reading from its socket.
|
||||
socket.on('data', function(chunk) {
|
||||
var data= new TextEncoder("utf-8").encode("Seggem a fenék");
|
||||
|
||||
// logging.logAppend("SOCKET_LOG.",'TCP_SERVER',socket.remoteAddress,'nodekb','SOCKET_LOG');
|
||||
console.log(`BINARY: ${chunk}`);
|
||||
|
||||
var r=prot.parsePacket(chunk);
|
||||
console.log('cmd:'+ r.cmd);
|
||||
console.log('PAYLOAD:'+ Buffer.from(r.payload).toString("hex"));
|
||||
var p=prot.newPacket(0xAA,data);
|
||||
socket.write(p);
|
||||
console.log('PACK='+p.toString(16));
|
||||
|
||||
/* switch(data.cmd)
|
||||
{
|
||||
case 'NTRK':
|
||||
tracker.newTrack(data.id,function(err,result){
|
||||
if (err)
|
||||
{
|
||||
socket.write(JSON.stringify({
|
||||
status: 1,
|
||||
data: err
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
socket.write(JSON.stringify({
|
||||
status: 200,
|
||||
data: result
|
||||
}));
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 'PTM':
|
||||
tracker.pushtelemetry(data.data,function(err,result){
|
||||
if (err)
|
||||
{
|
||||
socket.write(JSON.stringify({
|
||||
status: 1,
|
||||
data: err
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
socket.write(JSON.stringify({
|
||||
status: 200,
|
||||
data: result
|
||||
}));
|
||||
}
|
||||
})
|
||||
break;
|
||||
default:
|
||||
socket.write(JSON.stringify({
|
||||
status: 200,
|
||||
data: "Cmd error"
|
||||
}));
|
||||
break;
|
||||
}*/
|
||||
|
||||
});
|
||||
|
||||
// When the client requests to end the TCP connection with the server, the server
|
||||
// ends the connection.
|
||||
socket.on('end', function() {
|
||||
console.log('Closing connection with the client');
|
||||
});
|
||||
|
||||
// Don't forget to catch error, for your own sake.
|
||||
socket.on('error', function(err) {
|
||||
console.log(`Error: ${err}`);
|
||||
});
|
||||
});
|
||||
|
||||
// **** END OF TCP SERVER **** //
|
||||
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
const LocalStrategy = require('passport-local').Strategy;
|
||||
const User = require('../models/user');
|
||||
|
||||
const config = require('../config/database');
|
||||
const bcrypt = require('bcryptjs');
|
||||
//var a = require('../models/works');
|
||||
|
||||
|
||||
// Admin check
|
||||
function checkUserAdmin(req,callback)
|
||||
{
|
||||
// Find last id
|
||||
|
||||
if(req.user)
|
||||
{
|
||||
//console.log(req.user);
|
||||
if(req.user.username==='admisJacica' & req.user.auth==='ADMIN')
|
||||
{
|
||||
callback(null, true);
|
||||
}
|
||||
else {
|
||||
callback(null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Access Control
|
||||
var ensureAuthenticated= function(req, res, next){
|
||||
var ad=false;
|
||||
if(req.isAuthenticated()){
|
||||
checkUserAdmin (req,function(err,res){ad=res;});
|
||||
return next();
|
||||
} else {
|
||||
if (req.originalUrl!='/')
|
||||
req.flash('danger', 'Kérem jelentkezzen be!');
|
||||
res.redirect('/users/login');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = Object.freeze({
|
||||
USER_PRIVILEGES_ADD: Object.freeze({
|
||||
USER: 0,
|
||||
WORK: 1,
|
||||
DEVICE: 2,
|
||||
FILES: 3
|
||||
})
|
||||
});
|
||||
module.exports = Object.freeze({
|
||||
USER_PRIVILEGES_MODIFY: Object.freeze({
|
||||
USER: 0,
|
||||
WORK: 1,
|
||||
DEVICE: 2
|
||||
}),
|
||||
USER_PRIVILEGES_DELETE: Object.freeze({
|
||||
USER: 0,
|
||||
WORK: 1,
|
||||
DEVICE: 2,
|
||||
FILES: 3
|
||||
})
|
||||
});
|
||||
module.exports = {checkUserAdmin: checkUserAdmin};
|
||||
module.exports = {ensureAuthenticated: ensureAuthenticated};
|
||||
|
|
@ -0,0 +1,254 @@
|
|||
let Vehicle = require('../models/vehicle.js');
|
||||
const asyncHandler = require('express-async-handler');
|
||||
const moment = require('moment');
|
||||
const { isValidObjectId } = require('mongoose');
|
||||
const { sendEmail } = require('./mailHelper.js');
|
||||
|
||||
|
||||
exports.apiVehicleSetCity=function(vehicleId,lastCity,rfid_device_id,callback){
|
||||
|
||||
|
||||
let lc={
|
||||
timestamp: new Date(),
|
||||
city:lastCity,
|
||||
rfid_device_id:rfid_device_id
|
||||
};
|
||||
|
||||
|
||||
|
||||
Vehicle.findByIdAndUpdate(vehicleId,
|
||||
{$push:{lastCity: lc}},
|
||||
function(error,success)
|
||||
{
|
||||
callback(error,success);
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
exports.apiGetVehicles=asyncHandler(async (req,res)=>{
|
||||
|
||||
const vehicles=await Vehicle.find();
|
||||
const lastkm=0;
|
||||
const {name, vehicleId, refueling}=vehicles;
|
||||
if (refueling)
|
||||
{
|
||||
const lastkm=refueling.slice(-1)
|
||||
}
|
||||
if (vehicles)
|
||||
{
|
||||
res.status(200).send(vehicles)
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(404).send('Error')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// Jármű adatainak lekérdezése
|
||||
exports.apiGetVehicle=asyncHandler(async (req,res)=>{
|
||||
|
||||
if (isValidObjectId(req.params.id)==false)
|
||||
{
|
||||
req.flash('error','Nem létező jármű');
|
||||
res.redirect('/');
|
||||
return;
|
||||
}
|
||||
|
||||
const vehicle=await Vehicle.findById(req.params.id);
|
||||
|
||||
if (vehicle)
|
||||
{
|
||||
res.status(200).send(vehicle)
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(404).send('Error')
|
||||
}
|
||||
|
||||
})
|
||||
// Módosítás
|
||||
exports.apiUpdateVehicle=asyncHandler(async (req,res) => {
|
||||
|
||||
// Get errors
|
||||
if (isValidObjectId(req.params.id)==false)
|
||||
{
|
||||
//req.flash('error','Nem létező jármű');
|
||||
res.status(400).send('Nem Létező Jármű!')
|
||||
return;
|
||||
}
|
||||
|
||||
let vehicle={}
|
||||
|
||||
Vehicle.findByIdAndUpdate(req.params.id,{
|
||||
name: req.body.Name,
|
||||
persons: req.body.persons,
|
||||
vehicle_id: req.body.vehicleId,
|
||||
oilChangeInterval: req.body.oilChangeInterval,
|
||||
oilChangeLast:req.body.oilChangeLast,
|
||||
visible: req.body.visible
|
||||
},function(err,docs){
|
||||
if (err){
|
||||
console.log(err)
|
||||
}
|
||||
else{
|
||||
console.log("Updated Vehicle : ", docs);
|
||||
req.flash('success','Jármű sikeresen módosítva');
|
||||
console.log('Jármű sikeresen módosítva');
|
||||
//res.redirect('/vehicles/view');
|
||||
res.status(203).send()
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
// Olajcsere
|
||||
exports.apiOilChangeVehicle=asyncHandler(async (req,res) => {
|
||||
|
||||
// Get errors
|
||||
if (isValidObjectId(req.params.id)==false)
|
||||
{
|
||||
//req.flash('error','Nem létező jármű');
|
||||
res.status(400).send('Nem Létező Jármű!')
|
||||
return;
|
||||
}
|
||||
|
||||
let vehicle={}
|
||||
|
||||
Vehicle.findByIdAndUpdate(req.params.id,{
|
||||
oilChangeLast: req.body.oilChangeLast
|
||||
},function(err,docs){
|
||||
if (err){
|
||||
console.log(err)
|
||||
}
|
||||
else{
|
||||
console.log("Updated Vehicle : ", docs);
|
||||
|
||||
console.log('Jármű sikeresen módosítva');
|
||||
//res.redirect('/vehicles/view');
|
||||
res.status(200).send('Sikeres rögzítés')
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Közeli dátum
|
||||
// az adott dátum előtt nem lehet nagyobb óraállás egyébként return -1
|
||||
// az adott dátum után nem lehet kisebb óraállás egyébként return 1
|
||||
// return 0 ha minden rendben
|
||||
function newFindClosest(dates, tDate, kmcounter) {
|
||||
var ret=0;
|
||||
var testDate=new Date(Date.parse(tDate));
|
||||
var max = dates.length;
|
||||
for(var i = 0; i < max; i++) {
|
||||
var tar = dates[i].dateTime;
|
||||
var arrDate = new Date (tar);//new Date(tar.day_year, tar.day_month, tar.day_number);
|
||||
// 3600 * 24 * 1000 = calculating milliseconds to days, for clarity.
|
||||
var diff = (arrDate - testDate) / (3600 * 24 * 1000);
|
||||
if(diff > 0) { // Ha van későbbi bejegyzés
|
||||
if (dates[i].kilometer<=kmcounter)
|
||||
{
|
||||
ret=1;
|
||||
}
|
||||
|
||||
} else { // Ha van korábbi bejegyzés
|
||||
if (dates[i].kilometer>=kmcounter)
|
||||
{
|
||||
ret=-1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
// Tankolás mentése
|
||||
exports.apiRefuelingById=asyncHandler(async (req,res)=>{
|
||||
const {refuelPicker, vehicleId,fueledHUF, kmcounter, fueledqty}=req.body;
|
||||
let lastkm=0
|
||||
if (isValidObjectId(vehicleId)==false)
|
||||
{
|
||||
req.flash('error','Nem létező jármű');
|
||||
res.redirect('/');
|
||||
return;
|
||||
}
|
||||
const vehicle=await Vehicle.findById(vehicleId);
|
||||
const resu=newFindClosest(vehicle.refueling,refuelPicker,kmcounter);
|
||||
console.log(resu);
|
||||
|
||||
if (resu<0){
|
||||
req.flash('error','Kilométeróra állás nem lehet kisebb mint az adott időszak legutóbbi állása!');
|
||||
res.redirect('/');
|
||||
return;
|
||||
}
|
||||
if (resu>0){
|
||||
req.flash('error','Kilométeróra állás nem lehet nagyobb mint az adott időszak legutóbbi állása!');
|
||||
res.redirect('/');
|
||||
return;
|
||||
}
|
||||
var nextOilChange=vehicle.oilChangeLast+vehicle.oilChangeInterval
|
||||
var remainingKilometers=nextOilChange-parseInt(kmcounter);
|
||||
if(nextOilChange<=(kmcounter+5000))
|
||||
{
|
||||
sendEmail("v.joszef@gmail.com","Szervíz esedékesség "+vehicle.vehicle_id,"Tisztelt Címzett!\n\nA(z) "+vehicle.vehicle_id+" rendszámú "+vehicle.name+" jármű olajcseréje esedékessé válik "+remainingKilometers+" km múlva!")
|
||||
}
|
||||
/* if (vehicle.refueling)
|
||||
{
|
||||
lastkm=vehicle.refueling[vehicle.refueling.length-1]
|
||||
//console.log(lastkm.kilometer)
|
||||
}
|
||||
if (lastkm.kilometer>= Number(kmcounter))
|
||||
{
|
||||
req.flash('error','Kilométeróra állás nem lehet kisebb mint a legutóbbi!');
|
||||
res.redirect('/');
|
||||
return;
|
||||
}*/
|
||||
console.log(req.body)
|
||||
//res.status(204).send()
|
||||
await Vehicle.findByIdAndUpdate(vehicleId,
|
||||
{$push:{refueling:{
|
||||
dateTime: Date.parse(refuelPicker),
|
||||
quantity:fueledqty,
|
||||
fueledHUF:fueledHUF,
|
||||
kilometer:kmcounter}
|
||||
}
|
||||
})
|
||||
req.flash('success','Sikeres mentés');
|
||||
res.redirect('/')
|
||||
|
||||
})
|
||||
// Tankolás adatainak lekérdezése
|
||||
exports.apiGetFueling=asyncHandler(async (req,res)=>{
|
||||
|
||||
if (isValidObjectId(req.params.id)==false)
|
||||
{
|
||||
req.flash('error','Nem létező jármű');
|
||||
res.redirect('/');
|
||||
return;
|
||||
}
|
||||
|
||||
const vehicle=await Vehicle.findById(req.params.id);
|
||||
|
||||
if (vehicle)
|
||||
{
|
||||
var fueling=[];
|
||||
vehicle.refueling.forEach(element => {
|
||||
fueling.push({
|
||||
id: element._id,
|
||||
title:"Tankolás <br /> "+element.quantity+" l "+element.kilometer+" km "+element.fueledHUF+" Ft",
|
||||
start:element.dateTime,
|
||||
allDay:false
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
res.status(200).send(fueling)
|
||||
}
|
||||
else
|
||||
{
|
||||
res.status(404).send('Error')
|
||||
}
|
||||
|
||||
})
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
title Munka nyílvántartó
|
||||
link(rel='stylesheet' href='/bower_components/bootstrap/dist/css/bootstrap.css')
|
||||
link(rel='stylesheet' href='/css/style.css')
|
||||
body
|
||||
nav.navbar.navbar-inverse
|
||||
.container
|
||||
.navbar-header
|
||||
button.navbar-toggle.collapsed(type='button', data-toggle='collapse', data-target='#navbar', aria-expanded='false', aria-controls='navbar')
|
||||
span.sr-only Toggle navigation
|
||||
span.icon-bar
|
||||
span.icon-bar
|
||||
span.icon-bar
|
||||
|
||||
img(src='/bower_components/brand.ico', width='50', height='50', class="d-inline-block align-top", alt='')
|
||||
a.navbar-brand(href='/') IO-Technic
|
||||
#navbar.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav
|
||||
if user
|
||||
li.active
|
||||
a(href='/') Munkák
|
||||
li
|
||||
a(href='/articles/add') Berendezés hozzáadása
|
||||
li
|
||||
a(href='/devices') Berendezések
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
if rot
|
||||
li
|
||||
a(href='/users/register') Regisztráció
|
||||
li
|
||||
a(href='/users/user_edit') Felhasználó
|
||||
if user
|
||||
li
|
||||
a(href='/users/logout') Kijelentkezés
|
||||
else
|
||||
li
|
||||
a(href='/users/login') Bejelentkezés
|
||||
.container
|
||||
!= messages('message', locals)
|
||||
if errors
|
||||
each error, i in errors
|
||||
div(class="alert alert-danger") #{error.msg}
|
||||
block content
|
||||
br
|
||||
hr
|
||||
footer
|
||||
p IO-Technic Hungary Copyright © 2018
|
||||
script(src='/bower_components/jquery/dist/jquery.js')
|
||||
script(src='/bower_components/bootstrap/dist/js/bootstrap.js')
|
||||
script(src='/js/main.js')
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 232 KiB |
|
After Width: | Height: | Size: 554 B |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
|
@ -0,0 +1,52 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let articleSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
title:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozó
|
||||
author:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
body:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Munkaszám
|
||||
workNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyártási szám
|
||||
deviceNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Elosztó jele
|
||||
workSign:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// rejtett gyáriszám
|
||||
deviceDate:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// rejtett gyáriszám
|
||||
deviceCounter:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
filePath:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Komponensek
|
||||
componentsArray: [{type: mongoose.Schema.Types.ObjectId}]
|
||||
});
|
||||
var Article = module.exports = mongoose.model('Article', articleSchema);
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
|
||||
let bidItemSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
title:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
body:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Cikkszám
|
||||
itemNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Nettó listaár
|
||||
netListPrice:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Kedvezmény
|
||||
discount:{
|
||||
type: Number,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Bevételezés Schema
|
||||
let bidSchema = mongoose.Schema({
|
||||
// Raktár
|
||||
warehouseId: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
certSerial:{ // Bizonylat száma
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
clientId: { // Ügyfél
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Tételek
|
||||
Items:[bidItemSchema],
|
||||
|
||||
// Nettó érték
|
||||
priceNet:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Bruttó Érték
|
||||
priceBr:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Dátum
|
||||
date:{
|
||||
type: String,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
var Bid = module.exports = mongoose.model('Bid', bidSchema);
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let certificateSchema = mongoose.Schema({
|
||||
// Terméknév
|
||||
berendezesnev:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Mennyiség
|
||||
mennyiseg:{
|
||||
type: number,
|
||||
require: true
|
||||
},
|
||||
// Mennyiség egység
|
||||
mennyisegegyseg:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyári szám
|
||||
gyariszam:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Egyéb azonosító
|
||||
egyebazonosito:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Ue
|
||||
feszeff:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Ie
|
||||
arameff:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Védettség
|
||||
vedettseg:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Dátum
|
||||
datum:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozó
|
||||
author:{
|
||||
type: String,
|
||||
require: true
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
var Certificate = module.exports = mongoose.model('Certificate', toolSchema);
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let clientSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
shortName:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
adoszam:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
address:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozó
|
||||
author:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyártói kedvezmény
|
||||
manufacturerDiscount:{
|
||||
type: Number,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
var Client = module.exports = mongoose.model('Client', clientSchema);
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
let mongoose = require('mongoose');
|
||||
let Article = require('../models/article');
|
||||
let Work=require('../models/works');
|
||||
// Article Schema
|
||||
let componentSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
ean1:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
itemNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
parameters:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
serial:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
deviceID: {type: mongoose.Schema.Types.ObjectId,ref: 'Article'},
|
||||
workID: {type: mongoose.Schema.Types.ObjectId, ref: 'Work'}
|
||||
|
||||
});
|
||||
var Component = module.exports = mongoose.model('Component', componentSchema);
|
||||
/*
|
||||
// Article Schema
|
||||
let componentSchemaList = mongoose.Schema({
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
parameters:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
serial:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
deviceName: {
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
workName: {
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
deviceID: {type: mongoose.Schema.Types.ObjectId},
|
||||
workID: {type: mongoose.Schema.Types.ObjectId}
|
||||
|
||||
});
|
||||
var ComponentList = module.exports = mongoose.model('ComponentList', componentSchema);*/
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Component base Schema
|
||||
let componentBaseSchema = mongoose.Schema({
|
||||
|
||||
// Gyártó
|
||||
manufacturer:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Cikkszám
|
||||
itemNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Vonalkód
|
||||
ean1:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Cikk csoport
|
||||
itemGroup:{
|
||||
type: String,
|
||||
//type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Paraméterek
|
||||
parameters:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Ár
|
||||
price:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Mennyiségi egység
|
||||
itemUnit:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Options
|
||||
options:{
|
||||
type: String,
|
||||
enum: [ 'IMPORTED','OWN'],
|
||||
default: 'IMPORTED',
|
||||
require: true
|
||||
},
|
||||
// Valuta
|
||||
valuta:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Készlet
|
||||
stock:{
|
||||
type: Number,
|
||||
require:true
|
||||
},
|
||||
// Minimál készlet
|
||||
minimumStock:{
|
||||
type: Number,
|
||||
require:true
|
||||
},
|
||||
// Beszállító
|
||||
supplierId:{
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
}
|
||||
});
|
||||
var ComponentBase = module.exports = mongoose.model('ComponentBase', componentBaseSchema);
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
let mongoose = require('mongoose');
|
||||
let dailyReportSchema = mongoose.Schema({
|
||||
|
||||
// Munka azonosítója
|
||||
workId: {type: mongoose.Schema.Types.ObjectId},
|
||||
|
||||
// Napi jelentés
|
||||
dailyReport:[{
|
||||
date: {type: String},
|
||||
foremanId: {type: String},
|
||||
workTitle: {type: String},
|
||||
employeeList:[{type: mongoose.Schema.Types.ObjectId}]
|
||||
}],
|
||||
|
||||
});
|
||||
let DailyReport = module.exports = mongoose.model('DailyReport', dailyReportSchema);
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let rfidDeviceSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
imei:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
ccid:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
assignment:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
state:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
swRevision:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
vehicle_id:{type: mongoose.Schema.Types.ObjectId}
|
||||
});
|
||||
var rfidDevice = module.exports = mongoose.model('rfidDevice', rfidDeviceSchema);
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
let mongoose = require('mongoose');
|
||||
const bcrypt = require('bcryptjs');
|
||||
// Employee Schema
|
||||
let employeeSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
shortName:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
accessCode:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
address:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
email:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
auth:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
password:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
// Létrehozó
|
||||
author:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Utolsó bejegyzés ID
|
||||
workingtimeId:{
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Éves szabadság
|
||||
vacationYear:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Kiadott szabadság
|
||||
vacationUsed:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Kiadott táppénz
|
||||
sickpayUsed:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
emailNotifyFlags:{
|
||||
arriving:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
getaway:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
monthlySummary:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
holiday:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
apiKey:{
|
||||
type: String,
|
||||
default: '-',
|
||||
required: true
|
||||
},
|
||||
uuid:{
|
||||
type: String,
|
||||
default: '-',
|
||||
required: true
|
||||
},
|
||||
isSubcontractor:{
|
||||
type: String,
|
||||
default: 'off',
|
||||
required: true
|
||||
},
|
||||
mobilePortalAccessEnabled:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
isForeman:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
isStudent:{
|
||||
type: String,
|
||||
default: 'off',
|
||||
required: true
|
||||
},
|
||||
konyvelesre:{
|
||||
type: String,
|
||||
default: 'off',
|
||||
required: true
|
||||
},
|
||||
holidayData: [{
|
||||
start_date: {type: String},
|
||||
end_date: {type: String},
|
||||
duration: {type: Number},
|
||||
|
||||
}],
|
||||
sickpayData: [{
|
||||
start_date: {type: String},
|
||||
end_date: {type: String},
|
||||
duration: {type: Number},
|
||||
|
||||
}]
|
||||
});
|
||||
|
||||
employeeSchema.methods.comparePassword = function(candidatePassword, cb) {
|
||||
bcrypt.compare(candidatePassword, this.password, function(err, isMatch) {
|
||||
if (err) return cb(err);
|
||||
cb(null, isMatch);
|
||||
});
|
||||
};
|
||||
var Employee = module.exports = mongoose.model('Employee', employeeSchema);
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Employee Schema
|
||||
let holidaysSchema = mongoose.Schema({
|
||||
// employeeId
|
||||
//ganttData: {
|
||||
id: String,
|
||||
employee_id: mongoose.Schema.Types.ObjectId,
|
||||
text: String,
|
||||
start_date: String,
|
||||
end_date: String,
|
||||
parent: String,
|
||||
duration: Number,
|
||||
progress: Number,
|
||||
render: String
|
||||
//}
|
||||
});
|
||||
var Holidays = module.exports = mongoose.model('Holidays', holidaysSchema);
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Invoice Schema
|
||||
let invoiceSchema = mongoose.Schema({
|
||||
// Kibocsátó
|
||||
owner:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozó
|
||||
author: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
body:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Számlaszám
|
||||
invoiceNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Esedékesség dátuma
|
||||
expiryDate:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Kibocsátás dátuma
|
||||
dateEmission:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozás dátuma
|
||||
creationDate:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Nettó Érték
|
||||
nPrice:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Határidő
|
||||
daysLeft:
|
||||
{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Haladék
|
||||
delayed:
|
||||
{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Státusz
|
||||
state:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Típus (Bejövő/Kimenő)
|
||||
itype:{
|
||||
type: Boolean,
|
||||
require: true
|
||||
},
|
||||
// Lezárás dátuma
|
||||
closingDate:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Pénznem
|
||||
currency:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Tranzakció azonosító
|
||||
transactionId:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
});
|
||||
var Invoice = module.exports = mongoose.model('Invoice', invoiceSchema);
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let itemSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
title:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
body:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyártó
|
||||
manufacturer:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Cikkszám
|
||||
itemNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Típus
|
||||
itemTypeCode:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Nettó listaár
|
||||
netListPrice:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Kedvezmény
|
||||
discount:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Készlet
|
||||
stock:{
|
||||
type: Number,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
var Item = module.exports = mongoose.model('Item', itemSchema);
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let itemGroupSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
var ItemGroup = module.exports = mongoose.model('ItemGroup', itemGroupSchema);
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// KifCert Schema
|
||||
let kifCertSchema = mongoose.Schema({
|
||||
|
||||
// Jegyzőkönyv azonosító
|
||||
deviceId:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Jegyzőkönyv neve
|
||||
jkvTitle:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozás dátuma
|
||||
bornDate:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
certType:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Létrehozó
|
||||
author:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megnevezes
|
||||
megnevezes:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Mennyiseg
|
||||
mennyiseg:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Mennyiseg egysege
|
||||
mennyisegegyseg:{//
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Munka szam
|
||||
munkaszam:{//
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyartasi szam
|
||||
gyariszam:{//
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Rajzszam
|
||||
rajzszam:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Védettség
|
||||
vedettseg:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Tipus
|
||||
tipus:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Egyéb azonosító adat
|
||||
egyebazonosito:{//
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Feszültség Ue
|
||||
feszUe:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Feszültség mértékegység
|
||||
feszEgyseg:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Áram Ie
|
||||
aramIe:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megrendelő
|
||||
megrendelo:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Vizsgáló feszültség
|
||||
vizsgfesz:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Vizsgáló feszültség 22kV
|
||||
vizsgfesz22:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
megjegyzes:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Minősítés
|
||||
minosites:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Vegeredmeny
|
||||
vegeredmeny:{
|
||||
type: Boolean,
|
||||
require: true
|
||||
},
|
||||
|
||||
szabvanyok: [Boolean],
|
||||
vizsgalat1: [Boolean],
|
||||
vizsgalat2: [Boolean],
|
||||
vizsgalat3: [Boolean],
|
||||
vizsgalat4: [Boolean],
|
||||
vizsgalat5: [Boolean],
|
||||
vizsgalat6: [Boolean],
|
||||
vizsgalat8: [Boolean],
|
||||
});
|
||||
var KifCert = module.exports = mongoose.model('KifCert',kifCertSchema);
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// log Schema
|
||||
let LogSchema = mongoose.Schema({
|
||||
// Dátum
|
||||
bornDate:{
|
||||
type:String,
|
||||
require: true
|
||||
},
|
||||
// Felhasználó
|
||||
user:{
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Múvelet az adatbázisban a következő id-vel
|
||||
target_id:{
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Adatbázis neve
|
||||
target_db:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Üzenet
|
||||
message:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Log típus
|
||||
logType:{
|
||||
type: String,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
var Log = module.exports = mongoose.model('Log', LogSchema);
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
// Article Schema
|
||||
let pdataSchema = mongoose.Schema({
|
||||
|
||||
// Utolsó automatikus Munkaszám
|
||||
workCounter:{
|
||||
type: Number,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
var Pdata = module.exports = mongoose.model('Pdata', pdataSchema);
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
|
||||
let itemSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
title:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
body:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyártó
|
||||
manufacturer:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Cikkszám
|
||||
itemNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Típus
|
||||
itemTypeCode:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Nettó listaár
|
||||
netListPrice:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Kedvezmény
|
||||
discount:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Készlet
|
||||
stock:{
|
||||
type: Number,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Bevételezés Schema
|
||||
let reciptSchema = mongoose.Schema({
|
||||
// Raktár
|
||||
warehouseId: {
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
certSerial:{ // Bizonylat száma
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
clientId: { // Beszállító
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
require: true
|
||||
},
|
||||
// Tételek
|
||||
Items:[itemSchema],
|
||||
|
||||
// Nettó érték
|
||||
priceNet:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Bruttó Érték
|
||||
priceBr:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
var Recipt = module.exports = mongoose.model('Recipt', reciptSchema);
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
const mongoose = require('mongoose');
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
// User Schema
|
||||
const UserSchema = mongoose.Schema({
|
||||
chatId:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
name:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
email:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
username:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
auth:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
password:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
isBanned:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
isAdmin:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
isEmployee:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
canAdd:{
|
||||
user:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
work:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
device:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
files:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
|
||||
},
|
||||
canModify:{
|
||||
user:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
work:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
device:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
canDelete:{
|
||||
user:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
work:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
device:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
files:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
canDownload:{
|
||||
type: String,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
notifyInvoices:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
canAccess:{
|
||||
invoices:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
clients:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
UserSchema.methods.comparePassword = function(candidatePassword, cb) {
|
||||
bcrypt.compare(candidatePassword, this.password, function(err, isMatch) {
|
||||
if (err) return cb(err);
|
||||
cb(null, isMatch);
|
||||
});
|
||||
};
|
||||
const User = module.exports = mongoose.model('User', UserSchema);
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
|
||||
const vehicleSchema=new mongoose.Schema({
|
||||
|
||||
name: {type: String, require: true},
|
||||
persons: Number,
|
||||
vehicle_id: {type: String, require: true},
|
||||
device_id: {type: String, require: true},
|
||||
refueling: [{
|
||||
dateTime:{type: Date,require: true},
|
||||
quantity:{type: Number,require: true},
|
||||
kilometer:{type: Number,require:true},
|
||||
fueledHUF:{type: Number,require:true}
|
||||
}],
|
||||
oilChangeInterval:{type: Number,require:true,default: 50000},
|
||||
oilChangeLast:{type: Number,require:true,default: 0},
|
||||
/* service: [
|
||||
{
|
||||
dateTime_Start:{type: Date,require: true},
|
||||
kilometer_Start: {type: Number,require:true},
|
||||
textField:{type:String,require: true},
|
||||
serviceCompany:{type:String,require: true},
|
||||
inService:{type:Boolean,default:false},
|
||||
dateTime_Stop:{type: Date,require: true},
|
||||
kilometer_Stop: {type: Number,require:true},
|
||||
textField:{type:String,require: true},
|
||||
|
||||
}
|
||||
],*/
|
||||
timestamp : {type: String, require: true},
|
||||
newTrack_id: {type:String,default : null},
|
||||
geodataStart: {type: String, default: 'unknown'},
|
||||
geodataStop: {type: String, default: 'unknown'},
|
||||
lastCity:[{
|
||||
timestamp: Date,
|
||||
city:String,
|
||||
rfid_device_id:{type: mongoose.Schema.Types.ObjectId}
|
||||
}],
|
||||
visible:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
tracks:[ {
|
||||
track_id: String,
|
||||
timestamp: String,
|
||||
latitude: Number,
|
||||
longitude: Number,
|
||||
altitude: Number,
|
||||
speed: Number,
|
||||
heading: Number
|
||||
} ]
|
||||
});
|
||||
//var Route = module.exports = mongoose.model('Route', routeSchema);
|
||||
var Vehicle = module.exports = mongoose.model('Vehicle', vehicleSchema);
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
let mongoose = require('mongoose');
|
||||
|
||||
let itemSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
title:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Megjegyzés
|
||||
body:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Gyártó
|
||||
manufacturer:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Cikkszám
|
||||
itemNumber:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Típus
|
||||
itemTypeCode:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
// Nettó listaár
|
||||
netListPrice:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Kedvezmény
|
||||
discount:{
|
||||
type: Number,
|
||||
require: true
|
||||
},
|
||||
// Készlet
|
||||
stock:{
|
||||
type: Number,
|
||||
require: true
|
||||
}
|
||||
|
||||
});
|
||||
// Raktár séma
|
||||
let warehouseSchema = mongoose.Schema({
|
||||
// Megnevezés
|
||||
name:{
|
||||
type: String,
|
||||
require: true
|
||||
},
|
||||
|
||||
// Tételek
|
||||
Items:[itemSchema]
|
||||
|
||||
|
||||
});
|
||||
|
||||
var Warehouse = module.exports = mongoose.model('Warehouse', warehouseSchema);
|
||||