Archived
2

small fixes

This commit is contained in:
VLE2FE 2020-08-12 10:56:12 +02:00
parent f94653f389
commit a30f24f018
15 changed files with 97 additions and 47 deletions

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4"> <module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.nyc_output" />
<excludeFolder url="file://$MODULE_DIR$/data_import" />
<excludeFolder url="file://$MODULE_DIR$/dist" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>

View File

@ -1,37 +1,53 @@
<component name="ProjectDictionaryState"> <component name="ProjectDictionaryState">
<dictionary name="VLE2FE"> <dictionary name="VLE2FE">
<words> <words>
<w>adminnew</w>
<w>adminxx</w>
<w>akro</w> <w>akro</w>
<w>amodel</w> <w>amodel</w>
<w>anwendungsbeschränkt</w> <w>anwendungsbeschränkt</w>
<w>apidoc</w>
<w>arora</w>
<w>batchgranulate</w> <w>batchgranulate</w>
<w>bcrypt</w> <w>bcrypt</w>
<w>bnpd</w> <w>bnpd</w>
<w>bsontype</w>
<w>cfenv</w> <w>cfenv</w>
<w>changeadmin</w>
<w>colordesignatiomsuppl</w> <w>colordesignatiomsuppl</w>
<w>colordesignationsuppl</w> <w>colordesignationsuppl</w>
<w>contentin</w> <w>contentin</w>
<w>crastin</w>
<w>definma</w> <w>definma</w>
<w>dfopdb</w> <w>dfopdb</w>
<w>dosiergeschw</w> <w>dosiergeschw</w>
<w>dpts</w> <w>dpts</w>
<w>einspritzgeschw</w> <w>einspritzgeschw</w>
<w>errback</w>
<w>frameguard</w> <w>frameguard</w>
<w>frankland</w>
<w>functionlink</w> <w>functionlink</w>
<w>glassfibrecontent</w> <w>glassfibrecontent</w>
<w>isin</w> <w>isin</w>
<w>janedoe</w> <w>janedoe</w>
<w>johndoe</w>
<w>johnnydoe</w> <w>johnnydoe</w>
<w>kfingew</w> <w>kfingew</w>
<w>latamid</w> <w>latamid</w>
<w>lati</w> <w>lati</w>
<w>lyucy</w> <w>lyucy</w>
<w>materialnumber</w> <w>materialnumber</w>
<w>nvmrc</w>
<w>oldpass</w>
<w>opblock</w>
<w>pagesize</w> <w>pagesize</w>
<w>pagesizes</w>
<w>pnach</w> <w>pnach</w>
<w>preaged</w> <w>preaged</w>
<w>puneet</w>
<w>reinforcementmaterial</w> <w>reinforcementmaterial</w>
<w>reinforcingmaterial</w> <w>reinforcingmaterial</w>
<w>rewatch</w>
<w>samplenumber</w> <w>samplenumber</w>
<w>sdpt</w> <w>sdpt</w>
<w>signalviolet</w> <w>signalviolet</w>
@ -42,7 +58,10 @@
<w>stringin</w> <w>stringin</w>
<w>testcomment</w> <w>testcomment</w>
<w>ultramid</w> <w>ultramid</w>
<w>unknownroute</w>
<w>vorgealtert</w> <w>vorgealtert</w>
<w>xcopy</w>
<w>yankov</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>

View File

@ -1,8 +1,25 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="CheckDtdRefs" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="CheckTagEmptyBody" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CheckXmlFileWithXercesValidator" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<scope name="Tests" level="WEAK WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="JSUnfilteredForInLoop" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="JSUnfilteredForInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="Tests" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="ReservedWordUsedAsNameJS" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="ReservedWordUsedAsNameJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlDefaultAttributeValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlDeprecatedElement" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlDuplicatedId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlHighlighting" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlInvalidId" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlPathReference" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="XmlUnboundNsPrefix" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlUnusedNamespaceDeclaration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="XmlWrongRootElement" enabled="false" level="ERROR" enabled_by_default="false" />
</profile> </profile>
</component> </component>

View File

@ -1,4 +1,4 @@
# Digital fingerprint of plastics - API # DeFinMa - API
This is the API to access the database of the digital fingerprint of plastics project. This is the API to access the database of the digital fingerprint of plastics project.

View File

@ -1,6 +1,5 @@
openapi: 3.0.2 openapi: 3.0.2
info: info:
title: Digital fingerprint of plastics - API title: Digital fingerprint of plastics - API
version: 1.0.0 version: 1.0.0

View File

@ -67,6 +67,7 @@ function resolveXDoc (doc) { // resolve x-doc properties recursively
// templates // templates
// noinspection LongLine
const htmlTplString = ` const htmlTplString = `
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">

View File

@ -10,7 +10,7 @@
/* =================== USAGE =================== /* =================== USAGE ===================
import * as express from "express"; import * as express from "express";
var app = express(); let app = express();
=============================================== */ =============================================== */
@ -29,40 +29,44 @@ declare function e(): core.Express;
declare namespace e { declare namespace e {
/** /**
* This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser. * This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on
* body-parser.
* @since 4.16.0 * @since 4.16.0
*/ */
var json: typeof bodyParser.json; let json: typeof bodyParser.json;
/** /**
* This is a built-in middleware function in Express. It parses incoming requests with Buffer payloads and is based on body-parser. * This is a built-in middleware function in Express. It parses incoming requests with Buffer payloads and is based
* on body-parser.
* @since 4.17.0 * @since 4.17.0
*/ */
var raw: typeof bodyParser.raw; let raw: typeof bodyParser.raw;
/** /**
* This is a built-in middleware function in Express. It parses incoming requests with text payloads and is based on body-parser. * This is a built-in middleware function in Express. It parses incoming requests with text payloads and is based on
* body-parser.
* @since 4.17.0 * @since 4.17.0
*/ */
var text: typeof bodyParser.text; let text: typeof bodyParser.text;
/** /**
* These are the exposed prototypes. * These are the exposed prototypes.
*/ */
var application: Application; let application: Application;
var request: Request; let request: Request;
var response: Response; let response: Response;
/** /**
* This is a built-in middleware function in Express. It serves static files and is based on serve-static. * This is a built-in middleware function in Express. It serves static files and is based on serve-static.
*/ */
var static: typeof serveStatic; let static: typeof serveStatic;
/** /**
* This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser. * This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is
* based on body-parser.
* @since 4.16.0 * @since 4.16.0
*/ */
var urlencoded: typeof bodyParser.urlencoded; let urlencoded: typeof bodyParser.urlencoded;
/** /**
* This is a built-in middleware function in Express. It parses incoming request query parameters. * This is a built-in middleware function in Express. It parses incoming request query parameters.
@ -95,7 +99,8 @@ declare namespace e {
interface Application extends core.Application { } interface Application extends core.Application { }
interface CookieOptions extends core.CookieOptions { } interface CookieOptions extends core.CookieOptions { }
interface Errback extends core.Errback { } interface Errback extends core.Errback { }
interface ErrorRequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> interface ErrorRequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any,
ReqQuery = core.Query>
extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery> { } extends core.ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery> { }
interface Express extends core.Express { } interface Express extends core.Express { }
interface Handler extends core.Handler { } interface Handler extends core.Handler { }
@ -105,8 +110,10 @@ declare namespace e {
interface IRouterMatcher<T> extends core.IRouterMatcher<T> { } interface IRouterMatcher<T> extends core.IRouterMatcher<T> { }
interface MediaType extends core.MediaType { } interface MediaType extends core.MediaType { }
interface NextFunction extends core.NextFunction { } interface NextFunction extends core.NextFunction { }
interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { } interface Request<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any,
interface RequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { } ReqQuery = core.Query> extends core.Request<P, ResBody, ReqBody, ReqQuery> { }
interface RequestHandler<P extends core.Params = core.ParamsDictionary, ResBody = any, ReqBody = any,
ReqQuery = core.Query> extends core.RequestHandler<P, ResBody, ReqBody, ReqQuery> { }
interface RequestParamHandler extends core.RequestParamHandler { } interface RequestParamHandler extends core.RequestParamHandler { }
export interface Response<ResBody = any> extends core.Response<ResBody> { } export interface Response<ResBody = any> extends core.Response<ResBody> { }
interface Router extends core.Router { } interface Router extends core.Router { }

View File

@ -3,7 +3,6 @@ import MaterialModel from '../models/material';
import MaterialGroupModel from '../models/material_groups'; import MaterialGroupModel from '../models/material_groups';
import MaterialSupplierModel from '../models/material_suppliers'; import MaterialSupplierModel from '../models/material_suppliers';
import TestHelper from "../test/helper"; import TestHelper from "../test/helper";
import globals from '../globals';
describe('/material', () => { describe('/material', () => {

View File

@ -581,27 +581,13 @@ router.get('/sample/number/:number', (req, res, next) => {
router.put('/sample/restore/' + IdValidate.parameter(), (req, res, next) => { router.put('/sample/restore/' + IdValidate.parameter(), (req, res, next) => {
if (!req.auth(res, ['dev', 'admin'], 'basic')) return; if (!req.auth(res, ['dev', 'admin'], 'basic')) return;
SampleModel.findByIdAndUpdate(req.params.id, {status: globals.status.new}).log(req).lean().exec((err, data) => { setStatus(globals.status.new, req, res, next);
if (err) return next(err);
if (!data) {
return res.status(404).json({status: 'Not found'});
}
res.json({status: 'OK'});
});
}); });
router.put('/sample/validate/' + IdValidate.parameter(), (req, res, next) => { router.put('/sample/validate/' + IdValidate.parameter(), (req, res, next) => {
if (!req.auth(res, ['dev', 'admin'], 'basic')) return; if (!req.auth(res, ['dev', 'admin'], 'basic')) return;
SampleModel.findByIdAndUpdate(req.params.id, {status: globals.status.val}).log(req).lean().exec((err, data) => { setStatus(globals.status.val, req, res, next);
if (err) return next(err);
if (!data) {
return res.status(404).json({status: 'Not found'});
}
res.json({status: 'OK'});
});
}); });
router.post('/sample/new', async (req, res, next) => { router.post('/sample/new', async (req, res, next) => {
@ -899,4 +885,15 @@ async function sampleReturn (sampleData, req, res, next) {
else { else {
res.status(404).json({status: 'Not found'}); res.status(404).json({status: 'Not found'});
} }
}
function setStatus (status, req, res, next) {
SampleModel.findByIdAndUpdate(req.params.id, {status}).log(req).lean().exec((err, data) => {
if (err) return next(err);
if (!data) {
return res.status(404).json({status: 'Not found'});
}
res.json({status: 'OK'});
});
} }

View File

@ -1,7 +1,10 @@
import Joi from 'joi'; import Joi from 'joi';
export default class IdValidate { export default class IdValidate {
private static id = Joi.string().pattern(new RegExp('[0-9a-f]{24}')).length(24).messages({'string.pattern.base': 'Invalid object id'}); private static id = Joi.string()
.pattern(new RegExp('[0-9a-f]{24}'))
.length(24)
.messages({'string.pattern.base': 'Invalid object id'});
static get () { // return joi validation static get () { // return joi validation
return this.id; return this.id;
@ -17,7 +20,8 @@ export default class IdValidate {
static stringify (data) { // convert all ObjectID objects to plain strings static stringify (data) { // convert all ObjectID objects to plain strings
Object.keys(data).forEach(key => { Object.keys(data).forEach(key => {
if (data[key] !== null && data[key].hasOwnProperty('_bsontype') && data[key]._bsontype === 'ObjectID') { // stringify id // stringify id
if (data[key] !== null && data[key].hasOwnProperty('_bsontype') && data[key]._bsontype === 'ObjectID') {
data[key] = data[key].toString(); data[key] = data[key].toString();
} }
else if (typeof data[key] === 'object' && data[key] !== null) { // deeper into recursion else if (typeof data[key] === 'object' && data[key] !== null) { // deeper into recursion

View File

@ -1,7 +1,8 @@
import Joi from 'joi'; import Joi from 'joi';
export default class ParametersValidate { export default class ParametersValidate {
static input (data, parameters, param) { // data to validate, parameters from template, param: 'new', 'change', 'null'(null values are allowed) // data to validate, parameters from template, param: 'new', 'change', 'null'(null values are allowed)
static input (data, parameters, param) {
let joiObject = {}; let joiObject = {};
parameters.forEach(parameter => { parameters.forEach(parameter => {
if (parameter.range.hasOwnProperty('values')) { // append right validation method according to parameter if (parameter.range.hasOwnProperty('values')) { // append right validation method according to parameter

View File

@ -23,7 +23,6 @@
.go-btn button { .go-btn button {
color: #ffffff; color: #ffffff;
border-color: #008ecf; border-color: #008ecf;
background: linear-gradient(to bottom, #005691 0%, #005691 50%, #008ecf 50%, #008ecf 100%);
border-width: 1px; border-width: 1px;
line-height: 40px; line-height: 40px;
padding: 30px 60px; padding: 30px 60px;
@ -33,7 +32,7 @@
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
transition: border, background cubic-bezier(0.38, 0.04, 0.35, 0.96) 600ms; transition: border, background cubic-bezier(0.38, 0.04, 0.35, 0.96) 600ms;
background-position: 0 0; background: linear-gradient(to bottom, #005691 0%, #005691 50%, #008ecf 50%, #008ecf 100%) 0 0;
background-size: 100% 200%; background-size: 100% 200%;
} }

View File

@ -31,7 +31,7 @@
color: #000; color: #000;
position: absolute; position: absolute;
bottom: 10px; bottom: 10px;
font-size: 8.5px; font-size: 9px;
left: 39px; left: 39px;
} }

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>DeFinMaDB - Introduction</title> <title>DeFinMaDB - Introduction</title>
<meta charset="utf-8"> <meta charset="utf-8">
@ -248,7 +248,7 @@ layout: true
class: content, theme-dark-green class: content, theme-dark-green
layout: true layout: true
# Thats all # That's all
--- ---
@ -264,7 +264,7 @@ layout: true
<script src="assets/remark-latest.min.js"> <script src="assets/remark-latest.min.js">
</script> </script>
<script> <script>
var slideshow = remark.create({ let slideshow = remark.create({
ratio: '16:9', ratio: '16:9',
slideNumberFormat: '%current% <div class="footer"><span class="intern">Intern</span>| CR/APS1 | 2020/08/07</div>', slideNumberFormat: '%current% <div class="footer"><span class="intern">Intern</span>| CR/APS1 | 2020/08/07</div>',
countIncrementalSlides: false countIncrementalSlides: false

View File

@ -229,7 +229,10 @@ body:after {
color: var(--red); color: var(--red);
} }
/*Remove colored parameters bar*/ /*Remove colored parameters bar*/
.swagger-ui .opblock.opblock-get .tab-header .tab-item.active h4 span::after, .swagger-ui .opblock.opblock-post .tab-header .tab-item.active h4 span::after, .swagger-ui .opblock.opblock-put .tab-header .tab-item.active h4 span::after, .swagger-ui .opblock.opblock-delete .tab-header .tab-item.active h4 span::after { .swagger-ui .opblock.opblock-get .tab-header .tab-item.active h4 span::after,
.swagger-ui .opblock.opblock-post .tab-header .tab-item.active h4 span::after,
.swagger-ui .opblock.opblock-put .tab-header .tab-item.active h4 span::after,
.swagger-ui .opblock.opblock-delete .tab-header .tab-item.active h4 span::after {
background: none; background: none;
} }