Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
98d5474e3c | |||
56bc353670 | |||
4b358e7975 | |||
|
b5775f0abb | ||
e95c311912 | |||
efe8945d3b | |||
194ff8ca33 | |||
|
15bc523a42 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,3 +35,4 @@ out/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/frontend/node_modules/
|
||||
|
@ -13,7 +13,16 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/commons-io/commons-io
|
||||
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'com.h2database:h2:2.1.210'
|
||||
|
||||
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5'
|
||||
|
||||
implementation 'org.hibernate.validator:hibernate-validator:7.0.1.Final'
|
||||
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
}
|
||||
|
||||
|
46
frontend/index.html
Normal file
46
frontend/index.html
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<form class="" id="form">
|
||||
<h2>Калькулятор</h2>
|
||||
<div class="container row">
|
||||
<div class="form-group col-3">
|
||||
<label>num1</label>
|
||||
<input name="num1" class="form-control col-3" placeholder="Первый аргумент">
|
||||
</div>
|
||||
<div class="form-group col-3">
|
||||
<label>Оператор</label>
|
||||
<select name="selected" id="inputState" class="form-control">
|
||||
<option selected>+</option>
|
||||
<option>-</option>
|
||||
<option>*</option>
|
||||
<option>/</option>
|
||||
</select>
|
||||
<label>Тип данных</label>
|
||||
<select name="type" class="form-control">
|
||||
<option selected>Int</option>
|
||||
<option>String</option>
|
||||
<option>FloatArray</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-3">
|
||||
<label>num2</label>
|
||||
<input name="num2" type="number" class="form-control col-3" placeholder="Второй аргумент">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary m-3">Посчитать</button>
|
||||
</form>
|
||||
|
||||
<h2 class="text" id="res"></h2>
|
||||
|
||||
<script src="./node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<script src="../js/script.js"></script>
|
||||
</body>
|
||||
</html>
|
59
frontend/js/script.js
Normal file
59
frontend/js/script.js
Normal file
@ -0,0 +1,59 @@
|
||||
let form = document.getElementById("form");
|
||||
let info = document.getElementById("res");
|
||||
|
||||
|
||||
form.onsubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
if(form.num1.value === "") return;
|
||||
if(form.num2.value === "") return;
|
||||
|
||||
let index = form.selected.selectedIndex;
|
||||
let indexType = form.type.selectedIndex;
|
||||
|
||||
let op = form.selected.options[index].textContent;
|
||||
let type = form.type.options[indexType].textContent;
|
||||
let res = "";
|
||||
|
||||
function calc() {
|
||||
switch(op) {
|
||||
case "+":
|
||||
return "sum";
|
||||
break;
|
||||
|
||||
case "-":
|
||||
return "diff";
|
||||
break;
|
||||
|
||||
case "*":
|
||||
return "mul";
|
||||
break;
|
||||
|
||||
case "/":
|
||||
return "div";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function typeOfCalc() {
|
||||
switch(type) {
|
||||
case "Int":
|
||||
return "int";
|
||||
break;
|
||||
|
||||
case "String":
|
||||
return "string";
|
||||
break;
|
||||
|
||||
case "FloatArray":
|
||||
return "floatArray";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (form.num2.value == 0 && calc(op) == "divide") return;
|
||||
res = await fetch(`http://localhost:8080/${calc()}?num1=${form.num1.value}&num2=${form.num2.value}&operationType=${typeOfCalc()}`)
|
||||
res = await res.text();
|
||||
|
||||
info.textContent = res;
|
||||
}
|
723
frontend/package-lock.json
generated
Normal file
723
frontend/package-lock.json
generated
Normal file
@ -0,0 +1,723 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.2.3",
|
||||
"http-server": "^14.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@popperjs/core": {
|
||||
"version": "2.11.6",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
|
||||
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/async": {
|
||||
"version": "2.6.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
|
||||
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.14"
|
||||
}
|
||||
},
|
||||
"node_modules/basic-auth": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
|
||||
"integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/twbs"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
}
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@popperjs/core": "^2.11.6"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/corser": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
|
||||
"integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eventemitter3": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/he": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
|
||||
"bin": {
|
||||
"he": "bin/he"
|
||||
}
|
||||
},
|
||||
"node_modules/html-encoding-sniffer": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
|
||||
"integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
|
||||
"dependencies": {
|
||||
"whatwg-encoding": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/http-proxy": {
|
||||
"version": "1.18.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
||||
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
||||
"dependencies": {
|
||||
"eventemitter3": "^4.0.0",
|
||||
"follow-redirects": "^1.0.0",
|
||||
"requires-port": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/http-server": {
|
||||
"version": "14.1.1",
|
||||
"resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz",
|
||||
"integrity": "sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==",
|
||||
"dependencies": {
|
||||
"basic-auth": "^2.0.1",
|
||||
"chalk": "^4.1.2",
|
||||
"corser": "^2.0.1",
|
||||
"he": "^1.2.0",
|
||||
"html-encoding-sniffer": "^3.0.0",
|
||||
"http-proxy": "^1.18.1",
|
||||
"mime": "^1.6.0",
|
||||
"minimist": "^1.2.6",
|
||||
"opener": "^1.5.1",
|
||||
"portfinder": "^1.0.28",
|
||||
"secure-compare": "3.0.1",
|
||||
"union": "~0.5.0",
|
||||
"url-join": "^4.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"http-server": "bin/http-server"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
|
||||
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.6"
|
||||
},
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.12.3",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
||||
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/opener": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
|
||||
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
|
||||
"bin": {
|
||||
"opener": "bin/opener-bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/portfinder": {
|
||||
"version": "1.0.32",
|
||||
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz",
|
||||
"integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==",
|
||||
"dependencies": {
|
||||
"async": "^2.6.4",
|
||||
"debug": "^3.2.7",
|
||||
"mkdirp": "^0.5.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.11.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz",
|
||||
"integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/secure-compare": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
|
||||
"integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw=="
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.0",
|
||||
"get-intrinsic": "^1.0.2",
|
||||
"object-inspect": "^1.9.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/union": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
|
||||
"integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
|
||||
"dependencies": {
|
||||
"qs": "^6.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-join": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
|
||||
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
|
||||
},
|
||||
"node_modules/whatwg-encoding": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
|
||||
"integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
|
||||
"dependencies": {
|
||||
"iconv-lite": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@popperjs/core": {
|
||||
"version": "2.11.6",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
|
||||
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
|
||||
"peer": true
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"async": {
|
||||
"version": "2.6.4",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
|
||||
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.14"
|
||||
}
|
||||
},
|
||||
"basic-auth": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.2"
|
||||
}
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.3.tgz",
|
||||
"integrity": "sha512-cEKPM+fwb3cT8NzQZYEu4HilJ3anCrWqh3CHAok1p9jXqMPsPTBhU25fBckEJHJ/p+tTxTFTsFQGM+gaHpi3QQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"call-bind": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
|
||||
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"get-intrinsic": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"corser": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
|
||||
"integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"eventemitter3": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
|
||||
},
|
||||
"get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"has": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||
"requires": {
|
||||
"function-bind": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
|
||||
},
|
||||
"he": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
|
||||
},
|
||||
"html-encoding-sniffer": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
|
||||
"integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
|
||||
"requires": {
|
||||
"whatwg-encoding": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"http-proxy": {
|
||||
"version": "1.18.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
|
||||
"integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
|
||||
"requires": {
|
||||
"eventemitter3": "^4.0.0",
|
||||
"follow-redirects": "^1.0.0",
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"http-server": {
|
||||
"version": "14.1.1",
|
||||
"resolved": "https://registry.npmjs.org/http-server/-/http-server-14.1.1.tgz",
|
||||
"integrity": "sha512-+cbxadF40UXd9T01zUHgA+rlo2Bg1Srer4+B4NwIHdaGxAGGv59nYRnGGDJ9LBk7alpS0US+J+bLLdQOOkJq4A==",
|
||||
"requires": {
|
||||
"basic-auth": "^2.0.1",
|
||||
"chalk": "^4.1.2",
|
||||
"corser": "^2.0.1",
|
||||
"he": "^1.2.0",
|
||||
"html-encoding-sniffer": "^3.0.0",
|
||||
"http-proxy": "^1.18.1",
|
||||
"mime": "^1.6.0",
|
||||
"minimist": "^1.2.6",
|
||||
"opener": "^1.5.1",
|
||||
"portfinder": "^1.0.28",
|
||||
"secure-compare": "3.0.1",
|
||||
"union": "~0.5.0",
|
||||
"url-join": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
|
||||
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
|
||||
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
|
||||
"requires": {
|
||||
"minimist": "^1.2.6"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.12.3",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
||||
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g=="
|
||||
},
|
||||
"opener": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
|
||||
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A=="
|
||||
},
|
||||
"portfinder": {
|
||||
"version": "1.0.32",
|
||||
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz",
|
||||
"integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==",
|
||||
"requires": {
|
||||
"async": "^2.6.4",
|
||||
"debug": "^3.2.7",
|
||||
"mkdirp": "^0.5.6"
|
||||
}
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.11.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz",
|
||||
"integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==",
|
||||
"requires": {
|
||||
"side-channel": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ=="
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"secure-compare": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
|
||||
"integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw=="
|
||||
},
|
||||
"side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||
"requires": {
|
||||
"call-bind": "^1.0.0",
|
||||
"get-intrinsic": "^1.0.2",
|
||||
"object-inspect": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"union": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
|
||||
"integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
|
||||
"requires": {
|
||||
"qs": "^6.4.0"
|
||||
}
|
||||
},
|
||||
"url-join": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
|
||||
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA=="
|
||||
},
|
||||
"whatwg-encoding": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
|
||||
"integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
|
||||
"requires": {
|
||||
"iconv-lite": "0.6.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
frontend/package.json
Normal file
15
frontend/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "http-server -p 3000 -c-1 -o ./"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bootstrap": "^5.2.3",
|
||||
"http-server": "^14.1.1"
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Product;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.services.ProductService;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/product")
|
||||
public class ProductController {
|
||||
|
||||
@Autowired
|
||||
private final ProductService productService;
|
||||
|
||||
public ProductController(ProductService productService) {
|
||||
this.productService = productService;
|
||||
}
|
||||
|
||||
@GetMapping("/test")
|
||||
public String test() {
|
||||
return "Test";
|
||||
}
|
||||
|
||||
@PostMapping("/uploadImage")
|
||||
public Product createProduct(@RequestParam Integer price, @RequestParam MultipartFile file) {
|
||||
try {
|
||||
byte[] byteImage = file.getBytes();
|
||||
return productService.addProduct(price, byteImage);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.models;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
public class Category {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
private String name;
|
||||
|
||||
public Category() {
|
||||
|
||||
}
|
||||
|
||||
public Category(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() { return id;}
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(id, category.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Category{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.models;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
public class Manufacturer {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER,
|
||||
mappedBy = "manufacturerList")
|
||||
private List<Product> productList;
|
||||
|
||||
@Column
|
||||
private String name;
|
||||
private String address;
|
||||
|
||||
|
||||
public Manufacturer() {
|
||||
|
||||
}
|
||||
|
||||
public Manufacturer(String name, String address) {
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Long getId() { return id;}
|
||||
|
||||
public String getName() { return name; }
|
||||
|
||||
public String getAddress() { return address; }
|
||||
|
||||
public List<Product> getProductList() { return productList; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
|
||||
public void setAddress(String address) { this.address = address; }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Manufacturer manufacturer = (Manufacturer) o;
|
||||
return Objects.equals(id, manufacturer.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Manufacturer{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.models;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.groups.ConvertGroup;
|
||||
|
||||
@Entity
|
||||
public class Product {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "category_id")
|
||||
private Category category;
|
||||
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "products_manufacturers",
|
||||
joinColumns = @JoinColumn(name = "product_fk"),
|
||||
inverseJoinColumns = @JoinColumn(name = "manufacturer_fk"))
|
||||
private List<Manufacturer> manufacturerList;
|
||||
|
||||
@Column
|
||||
private Integer price;
|
||||
|
||||
@Lob
|
||||
private byte[] photo;
|
||||
|
||||
public Product() {
|
||||
|
||||
}
|
||||
|
||||
public Product(Integer price, byte[] photo)
|
||||
{
|
||||
this.price = price;
|
||||
this.photo = photo;
|
||||
}
|
||||
|
||||
public Long getId() { return id; }
|
||||
|
||||
public Integer getPrice() { return price; }
|
||||
|
||||
public byte[] getPhoto() { return photo; }
|
||||
|
||||
public void setPrice(Integer price) { this.price = price; }
|
||||
|
||||
public void setPhoto(byte[] photo) { this.photo = photo; }
|
||||
|
||||
public List<Manufacturer> getManufacturerList() { return manufacturerList; }
|
||||
|
||||
public Category getCategory() { return category; }
|
||||
|
||||
public void addCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public void addManufacturer(Manufacturer manufacturer) {
|
||||
manufacturerList.add(manufacturer);
|
||||
}
|
||||
|
||||
public void removeManufacturer(Manufacturer manufacturer) {
|
||||
manufacturerList.remove(manufacturer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Product product = (Product) o;
|
||||
return Objects.equals(id, product.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Product{" +
|
||||
"id=" + id +
|
||||
", price='" + price + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.services;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Category;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CategoryService {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Transactional
|
||||
public Category addCategory(String name) {
|
||||
if (!StringUtils.hasText(name)) {
|
||||
throw new IllegalArgumentException("Category name is null or empty");
|
||||
}
|
||||
final Category category = new Category(name);
|
||||
em.persist(category);
|
||||
return category;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Category findCategory(Long id) {
|
||||
final Category category = em.find(Category.class, id);
|
||||
if (category == null) {
|
||||
throw new EntityNotFoundException(String.format("Category with id [%s] is not found", id));
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Category> findAllCategories() {
|
||||
return em.createQuery("select s from Category s", Category.class)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Category updateCategory(Long id, String name) {
|
||||
if (!StringUtils.hasText(name)) {
|
||||
throw new IllegalArgumentException("Category name is null or empty");
|
||||
}
|
||||
final Category currentCategory = findCategory(id);
|
||||
currentCategory.setName(name);
|
||||
return em.merge(currentCategory);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Category deleteCategory(Long id) {
|
||||
final Category currentCategory = findCategory(id);
|
||||
em.remove(currentCategory);
|
||||
return currentCategory;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllCategories() {
|
||||
em.createQuery("delete from Category").executeUpdate();
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.services;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Manufacturer;
|
||||
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ManufacturerService {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Transactional
|
||||
public Manufacturer addManufacturer(String name, String address) {
|
||||
if (!StringUtils.hasText(name) || !StringUtils.hasText(address)) {
|
||||
throw new IllegalArgumentException("Manufacturer name or address is null or empty");
|
||||
}
|
||||
final Manufacturer manufacturer = new Manufacturer(name, address);
|
||||
em.persist(manufacturer);
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Manufacturer findManufacturer(Long id) {
|
||||
final Manufacturer manufacturer = em.find(Manufacturer.class, id);
|
||||
if (manufacturer == null) {
|
||||
throw new EntityNotFoundException(String.format("Manufacturer with id [%s] is not found", id));
|
||||
}
|
||||
return manufacturer;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Manufacturer> findAllManufacturers() {
|
||||
return em.createQuery("select s from Manufacturer s", Manufacturer.class)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manufacturer updateManufacturer(Long id, String name, String address) {
|
||||
if (!StringUtils.hasText(name) || !StringUtils.hasText(address)) {
|
||||
throw new IllegalArgumentException("Manufacturer name or address is null or empty");
|
||||
}
|
||||
final Manufacturer currentManufacturer = findManufacturer(id);
|
||||
currentManufacturer.setName(name);
|
||||
currentManufacturer.setName(address);
|
||||
return em.merge(currentManufacturer);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Manufacturer deleteManufacturer(Long id) {
|
||||
final Manufacturer currentManufacturer = findManufacturer(id);
|
||||
em.remove(currentManufacturer);
|
||||
return currentManufacturer;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllManufacturers() {
|
||||
em.createQuery("delete from Manufacturer").executeUpdate();
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package ru.ulstu.is.sbapp.HardwareShop.services;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Manufacturer;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Product;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ProductService {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Transactional
|
||||
public Product addProduct(Integer price, byte[] image) {
|
||||
if (price == 0) {
|
||||
throw new IllegalArgumentException("Product price equal 0");
|
||||
}
|
||||
final Product product = new Product(price, image);
|
||||
em.persist(product);
|
||||
return product;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Product findProduct(Long id) {
|
||||
final Product product = em.find(Product.class, id);
|
||||
if (product == null) {
|
||||
throw new EntityNotFoundException(String.format("Product with id [%s] is not found", id));
|
||||
}
|
||||
return product;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Product> findAllProducts() {
|
||||
return em.createQuery("select s from Product s", Product.class)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Product updateProduct(Long id, Integer price) {
|
||||
if (price == 0) {
|
||||
throw new IllegalArgumentException("Product price equal 0");
|
||||
}
|
||||
final Product currentProduct = findProduct(id);
|
||||
currentProduct.setPrice(price);
|
||||
return em.merge(currentProduct);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Product deleteProduct(Long id) {
|
||||
final Product currentProduct = findProduct(id);
|
||||
em.remove(currentProduct);
|
||||
return currentProduct;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllProducts() {
|
||||
em.createQuery("delete from Product").executeUpdate();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void addManufacturersToProduct(Long id, Manufacturer manufacturer) {
|
||||
final Product product = findProduct(id);
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("Product with id " + id + " not found");
|
||||
}
|
||||
product.addManufacturer(manufacturer);
|
||||
em.merge(product);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void removeManufacturersToProduct(Long id, Manufacturer manufacturer) {
|
||||
final Product product = findProduct(id);
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("Product with id " + id + " not found");
|
||||
}
|
||||
product.removeManufacturer(manufacturer);
|
||||
em.merge(product);
|
||||
}
|
||||
}
|
@ -13,38 +13,4 @@ public class SbappApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SbappApplication.class, args);
|
||||
}
|
||||
|
||||
@GetMapping("/hello")
|
||||
public String hello() {
|
||||
return "Hello, i'm working!";
|
||||
}
|
||||
|
||||
@GetMapping("/ToUpper")
|
||||
public String ToUpper(@RequestParam(value = "", defaultValue = "default") String text) {
|
||||
return String.format(text).toUpperCase();
|
||||
}
|
||||
|
||||
@GetMapping("/calc")
|
||||
public Integer calc(@RequestParam(defaultValue = "10") Integer num1,
|
||||
@RequestParam(defaultValue = "10") Integer num2) {
|
||||
return num1 + num2;
|
||||
}
|
||||
|
||||
@GetMapping("/concate")
|
||||
public String concate(@RequestParam String text) {
|
||||
return "Word-"+ text;
|
||||
}
|
||||
|
||||
@GetMapping("/divider")
|
||||
public String IsInt(@RequestParam int num1,
|
||||
@RequestParam(defaultValue = "1") int num2) {
|
||||
if (num1 % num2 == 0)
|
||||
{
|
||||
return String.format("Делится на цело, результат: %s", num1 / num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.format("Неделится на цело, результат: %s", num1 / num2 + " Остаток: " + num1 % num2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
src/main/java/ru/ulstu/is/sbapp/WebConfiguration.java
Normal file
13
src/main/java/ru/ulstu/is/sbapp/WebConfiguration.java
Normal file
@ -0,0 +1,13 @@
|
||||
package ru.ulstu.is.sbapp;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class WebConfiguration implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedMethods("*");
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package ru.ulstu.is.sbapp.calc.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.ulstu.is.sbapp.calc.domain.FloatArrayCalculator;
|
||||
import ru.ulstu.is.sbapp.calc.domain.IntCalculator;
|
||||
import ru.ulstu.is.sbapp.calc.domain.StringCalculator;
|
||||
|
||||
@Configuration
|
||||
public class TypeConfiguration {
|
||||
@Bean(value = "int")
|
||||
public IntCalculator createIntType() {
|
||||
return new IntCalculator();
|
||||
}
|
||||
|
||||
@Bean(value = "string")
|
||||
public StringCalculator createStringCalculator() { return new StringCalculator(); }
|
||||
|
||||
@Bean(value = "floatArray")
|
||||
public FloatArrayCalculator createfloatArrayCalculator() { return new FloatArrayCalculator(); }
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ru.ulstu.is.sbapp.calc.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.ulstu.is.sbapp.calc.service.CalculatorService;
|
||||
|
||||
@RestController
|
||||
public class CalculatorController {
|
||||
private final CalculatorService calculatorService;
|
||||
|
||||
public CalculatorController(CalculatorService calculatorService) { this.calculatorService = calculatorService; }
|
||||
|
||||
@GetMapping("/sum")
|
||||
public Object sum(@RequestParam Object num1, @RequestParam int num2, @RequestParam(value = "operationType") String operationType) {
|
||||
return calculatorService.getSum(num1, num2, operationType);
|
||||
}
|
||||
|
||||
@GetMapping("/diff")
|
||||
public Object diff(@RequestParam Object num1, @RequestParam int num2, @RequestParam(value = "operationType") String operationType) {
|
||||
return calculatorService.getDiff(num1, num2, operationType);
|
||||
}
|
||||
|
||||
@GetMapping("/mul")
|
||||
public Object mul(@RequestParam Object num1, @RequestParam int num2, @RequestParam(value = "operationType") String operationType) {
|
||||
return calculatorService.getMul(num1, num2, operationType);
|
||||
}
|
||||
|
||||
@GetMapping("/div")
|
||||
public Object div(@RequestParam Object num1, @RequestParam int num2, @RequestParam(value = "operationType") String operationType) {
|
||||
return calculatorService.getDiv(num1, num2, operationType);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package ru.ulstu.is.sbapp.calc.domain;
|
||||
|
||||
public interface Calculator<T> {
|
||||
public T sum(T num1, int num2);
|
||||
public T diff(T num1, int num2);
|
||||
public T multiply(T num1, int num2);
|
||||
public T divide(T num1, int num2);
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package ru.ulstu.is.sbapp.calc.domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FloatArrayCalculator implements Calculator<ArrayList<Float>>{
|
||||
|
||||
@Override
|
||||
public ArrayList<Float> sum(ArrayList<Float> num1, int num2) {
|
||||
ArrayList<Float> res = new ArrayList<>();
|
||||
for (int i = 0; i < num1.size(); ++i) {
|
||||
res.add(num1.get(i) + Float.parseFloat(Integer.toString(num2)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Float> diff(ArrayList<Float> num1, int num2) {
|
||||
ArrayList<Float> res = new ArrayList<>();
|
||||
for (int i = 0; i < num1.size(); ++i) {
|
||||
res.add(num1.get(i) - Float.parseFloat(Integer.toString(num2)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Float> multiply(ArrayList<Float> num1, int num2) {
|
||||
ArrayList<Float> res = new ArrayList<>();
|
||||
for (int i = 0; i < num1.size(); ++i) {
|
||||
res.add(num1.get(i) * Float.parseFloat(Integer.toString(num2)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Float> divide(ArrayList<Float> num1, int num2) {
|
||||
ArrayList<Float> res = new ArrayList<>();
|
||||
for (int i = 0; i < num1.size(); ++i) {
|
||||
res.add(num1.get(i) / Float.parseFloat(Integer.toString(num2)));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package ru.ulstu.is.sbapp.calc.domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
public class IntCalculator implements Calculator<Integer>{
|
||||
|
||||
@Override
|
||||
public Integer sum(Integer num1, int num2) {
|
||||
return num1 + num2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer diff(Integer num1, int num2) {
|
||||
return num1 - num2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer multiply(Integer num1, int num2) {
|
||||
return num1 * num2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer divide(Integer num1, int num2) {
|
||||
return num1 / num2;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package ru.ulstu.is.sbapp.calc.domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
public class StringCalculator implements Calculator<String>{
|
||||
@Override
|
||||
public String sum(String num1, int num2) {
|
||||
return num1.concat(String.format(String.valueOf(num2)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String diff(String num1, int num2) {
|
||||
String res = "";
|
||||
if (num1.length() <= num2) {
|
||||
return "Длинна первого аргумента меньше значения второго.";
|
||||
}
|
||||
for (int i = 0; i < num1.length() - num2; ++i) {
|
||||
res += num1.charAt(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String multiply(String num1, int num2) {
|
||||
String res = "";
|
||||
for (int i = 0; i < num2; ++i) {
|
||||
res += num1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String divide(String num1, int num2) {
|
||||
String res = "";
|
||||
int len = num1.length() / num2;
|
||||
if (len == 0) {
|
||||
return "Длинна первого аргумента слишком маленькая относительно значения второго.";
|
||||
}
|
||||
for (int i = 0; i < len; ++i) {
|
||||
res += num1.charAt(i);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package ru.ulstu.is.sbapp.calc.service;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.is.sbapp.calc.domain.Calculator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CalculatorService {
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
public CalculatorService(ApplicationContext applicationContext) { this.applicationContext = applicationContext; }
|
||||
|
||||
private Calculator _calculator;
|
||||
Object arg1 = "";
|
||||
|
||||
private void Num1Type(Object num1, int num2, String operationType) {
|
||||
_calculator = (Calculator) applicationContext.getBean(operationType);
|
||||
switch (operationType) {
|
||||
case "int" -> {
|
||||
try {
|
||||
arg1 = Integer.valueOf(num1.toString());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
arg1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
case "floatArray" -> {
|
||||
try {
|
||||
arg1 = Arrays.stream(num1.toString().split(";"))
|
||||
.map(Float::parseFloat)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
arg1 = num1.toString();
|
||||
}
|
||||
}
|
||||
|
||||
case "string" -> {
|
||||
arg1 = num1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object getSum(Object num1, int num2, String operationType) {
|
||||
Num1Type(num1, num2, operationType);
|
||||
return _calculator.sum(arg1, num2);
|
||||
}
|
||||
|
||||
public Object getDiff(Object num1, int num2, String operationType) {
|
||||
Num1Type(num1, num2, operationType);
|
||||
return _calculator.diff(arg1, num2);
|
||||
}
|
||||
|
||||
public Object getMul(Object num1, int num2, String operationType) {
|
||||
Num1Type(num1, num2, operationType);
|
||||
return _calculator.multiply(arg1, num2);
|
||||
}
|
||||
|
||||
public Object getDiv(Object num1, int num2, String operationType) {
|
||||
Num1Type(num1, num2, operationType);
|
||||
return _calculator.divide(arg1, num2);
|
||||
}
|
||||
}
|
@ -1 +1,11 @@
|
||||
|
||||
spring.main.banner-mode=off
|
||||
#server.port=8080
|
||||
spring.datasource.url=jdbc:h2:file:./data
|
||||
spring.datasource.driverClassName=org.h2.Driver
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=password
|
||||
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.h2.console.enabled=true
|
||||
spring.h2.console.settings.trace=false
|
||||
spring.h2.console.settings.web-allow-others=false
|
@ -1,3 +0,0 @@
|
||||
h1 {
|
||||
color: red;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
function test() {
|
||||
fetch("http://localhost:8080/hello", {
|
||||
mode:
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th = "http://www.thymeleaf.org">
|
||||
<head>
|
||||
<link rel="stylesheet" href="/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1> IA WORK!</h1>
|
||||
</body>
|
||||
|
||||
</html>
|
63
src/test/java/ru/ulstu/is/sbapp/JpaCategoryTests.java
Normal file
63
src/test/java/ru/ulstu/is/sbapp/JpaCategoryTests.java
Normal file
@ -0,0 +1,63 @@
|
||||
package ru.ulstu.is.sbapp;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Category;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.services.CategoryService;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
public class JpaCategoryTests {
|
||||
private static final Logger log = LoggerFactory.getLogger(JpaCategoryTests.class);
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Test
|
||||
void testCategoryCreate() {
|
||||
categoryService.deleteAllCategories();
|
||||
final Category category = categoryService.addCategory("Электроника");
|
||||
log.info(category.toString());
|
||||
Assertions.assertNotNull(category.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCategoryRead() {
|
||||
categoryService.deleteAllCategories();
|
||||
final Category category = categoryService.addCategory("Электроника");
|
||||
log.info(category.toString());
|
||||
final Category findCategory = categoryService.findCategory(category.getId());
|
||||
log.info(findCategory.toString());
|
||||
Assertions.assertEquals(category, findCategory);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCategoryReadNotFound() {
|
||||
categoryService.deleteAllCategories();
|
||||
Assertions.assertThrows(EntityNotFoundException.class, () -> categoryService.findCategory(-1L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCategoryReadAll() {
|
||||
categoryService.deleteAllCategories();
|
||||
categoryService.addCategory("Электроника");
|
||||
categoryService.addCategory("Электроника 2");
|
||||
final List<Category> categoryList = categoryService.findAllCategories();
|
||||
log.info(categoryList.toString());
|
||||
Assertions.assertEquals(categoryList.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCategoryReadAllEmpty() {
|
||||
categoryService.deleteAllCategories();
|
||||
final List<Category> categoryList = categoryService.findAllCategories();
|
||||
log.info(categoryList.toString());
|
||||
Assertions.assertEquals(categoryList.size(), 0);
|
||||
}
|
||||
}
|
63
src/test/java/ru/ulstu/is/sbapp/JpaManufacturerTests.java
Normal file
63
src/test/java/ru/ulstu/is/sbapp/JpaManufacturerTests.java
Normal file
@ -0,0 +1,63 @@
|
||||
package ru.ulstu.is.sbapp;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Manufacturer;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.services.ManufacturerService;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
public class JpaManufacturerTests {
|
||||
private static final Logger log = LoggerFactory.getLogger(JpaManufacturerTests.class);
|
||||
|
||||
@Autowired
|
||||
private ManufacturerService manufacturerService;
|
||||
|
||||
@Test
|
||||
void testManufacturerCreate() {
|
||||
manufacturerService.deleteAllManufacturers();
|
||||
final Manufacturer manufacturer = manufacturerService.addManufacturer("Производитель 1", "ул.Камышинская д.107");
|
||||
log.info(manufacturer.toString());
|
||||
Assertions.assertNotNull(manufacturer.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testManufacturerRead() {
|
||||
manufacturerService.deleteAllManufacturers();
|
||||
final Manufacturer manufacturer = manufacturerService.addManufacturer("Производитель 1", "ул.Камышинская д.107");
|
||||
log.info(manufacturer.toString());
|
||||
final Manufacturer findManufacturer = manufacturerService.findManufacturer(manufacturer.getId());
|
||||
log.info(findManufacturer.toString());
|
||||
Assertions.assertEquals(manufacturer, findManufacturer);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testManufacturerReadNotFound() {
|
||||
manufacturerService.deleteAllManufacturers();
|
||||
Assertions.assertThrows(EntityNotFoundException.class, () -> manufacturerService.findManufacturer(-1L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testManufacturerReadAll() {
|
||||
manufacturerService.deleteAllManufacturers();
|
||||
manufacturerService.addManufacturer("Производитель 1", "ул.Камышинская д.107");
|
||||
manufacturerService.addManufacturer("Производитель 2", "ул.Камышинская д.108");
|
||||
final List<Manufacturer> manufacturerList = manufacturerService.findAllManufacturers();
|
||||
log.info(manufacturerList.toString());
|
||||
Assertions.assertEquals(manufacturerList.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testManufacturerReadAllEmpty() {
|
||||
manufacturerService.deleteAllManufacturers();
|
||||
final List<Manufacturer> manufacturerList = manufacturerService.findAllManufacturers();
|
||||
log.info(manufacturerList.toString());
|
||||
Assertions.assertEquals(manufacturerList.size(), 0);
|
||||
}
|
||||
}
|
115
src/test/java/ru/ulstu/is/sbapp/JpaProductTests.java
Normal file
115
src/test/java/ru/ulstu/is/sbapp/JpaProductTests.java
Normal file
@ -0,0 +1,115 @@
|
||||
package ru.ulstu.is.sbapp;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Category;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.services.CategoryService;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.models.Product;
|
||||
import ru.ulstu.is.sbapp.HardwareShop.services.ProductService;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
public class JpaProductTests {
|
||||
private static final Logger log = LoggerFactory.getLogger(JpaProductTests.class);
|
||||
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
private MultipartFile ConvertFile() throws IOException {
|
||||
File file = new File("C:\\Users\\aleyc\\IdeaProjects\\IP_Aleikin_PIbd-22\\src\\test\\java\\ru\\ulstu\\is\\sbapp\\cart.png");
|
||||
String name = "file";
|
||||
String originalFileName = file.getName();
|
||||
String contentType = "image/jpeg";
|
||||
byte[] content = new byte[(int) file.length()];
|
||||
FileInputStream inputStream = new FileInputStream(file);
|
||||
inputStream.read(content);
|
||||
MultipartFile multipartFile = new MockMultipartFile(name, originalFileName, contentType, content);
|
||||
return multipartFile;
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProductCreate() throws Exception {
|
||||
MultipartFile localFile = ConvertFile();
|
||||
String strImage;
|
||||
strImage = ("data:" + localFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(localFile.getBytes()));
|
||||
productService.deleteAllProducts();
|
||||
final Product product = productService.addProduct(15000, strImage.getBytes());
|
||||
log.info(product.toString());
|
||||
Assertions.assertNotNull(product.getId());
|
||||
Assertions.assertNotNull(product.getPhoto());
|
||||
}
|
||||
|
||||
/*@Test
|
||||
void testProductRead() {
|
||||
productService.deleteAllProducts();
|
||||
final Product product = productService.addProduct(15000);
|
||||
log.info(product.toString());
|
||||
final Product findProduct = productService.findProduct(product.getId());
|
||||
log.info(findProduct.toString());
|
||||
Assertions.assertEquals(product, findProduct);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProductReadNotFound() {
|
||||
productService.deleteAllProducts();
|
||||
Assertions.assertThrows(EntityNotFoundException.class, () -> productService.findProduct(-1L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProductReadAll() {
|
||||
productService.deleteAllProducts();
|
||||
productService.addProduct(15000);
|
||||
productService.addProduct(20000);
|
||||
final List<Product> productList = productService.findAllProducts();
|
||||
log.info(productList.toString());
|
||||
Assertions.assertEquals(productList.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProductReadAllEmpty() {
|
||||
productService.deleteAllProducts();
|
||||
final List<Product> productList = productService.findAllProducts();
|
||||
log.info(productList.toString());
|
||||
Assertions.assertEquals(productList.size(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProductUpdate() {
|
||||
productService.deleteAllProducts();
|
||||
final Product product = productService.addProduct(15000);
|
||||
log.info(product.toString());
|
||||
productService.updateProduct(product.getId(), 20000);
|
||||
log.info(product.toString());
|
||||
Assertions.assertEquals(product.getPrice(), 20000);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testProductAddCategory() {
|
||||
productService.deleteAllProducts();
|
||||
final Product product = productService.addProduct(15000);
|
||||
final Category category = categoryService.addCategory("Электроника");
|
||||
product.addCategory(category);
|
||||
log.info(product.toString() + product.getCategory().getName());
|
||||
Assertions.assertEquals(product.getCategory().getName(), "Электроника");
|
||||
productService.deleteAllProducts();
|
||||
categoryService.deleteAllCategories();
|
||||
}*/
|
||||
}
|
@ -1,13 +1,91 @@
|
||||
package ru.ulstu.is.sbapp;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import ru.ulstu.is.sbapp.calc.service.CalculatorService;
|
||||
|
||||
@SpringBootTest
|
||||
class SbappApplicationTests {
|
||||
@Autowired
|
||||
CalculatorService calculatorService;
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
void IntSum() {
|
||||
final String res = calculatorService.getSum(3, 6, "int").toString();
|
||||
Assertions.assertEquals("9", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void IntDiff() {
|
||||
final String res = calculatorService.getDiff(15, 3, "int").toString();
|
||||
Assertions.assertEquals("12", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void IntMul() {
|
||||
final String res = calculatorService.getMul(12, 3, "int").toString();
|
||||
Assertions.assertEquals("36", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void IntDiv() {
|
||||
final String res = calculatorService.getDiv(12, 3, "int").toString();
|
||||
Assertions.assertEquals("4", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void StringSum() {
|
||||
final String res = calculatorService.getSum("abc", 6, "string").toString();
|
||||
Assertions.assertEquals("abc6", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void StringDiff() {
|
||||
final String res = calculatorService.getDiff("abc", 2, "string").toString();
|
||||
Assertions.assertEquals("a", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void StringMul() {
|
||||
final String res = calculatorService.getMul("abc", 3, "string").toString();
|
||||
Assertions.assertEquals("abcabcabc", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void StringDiv() {
|
||||
final String res = calculatorService.getDiv("abc", 3, "string").toString();
|
||||
Assertions.assertEquals("a", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void FloatArraySum() {
|
||||
final String res = calculatorService.getSum("3.2;5.6", 3, "floatArray").toString();
|
||||
Assertions.assertEquals("[6.2, 8.6]", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void FloatArrayDiff() {
|
||||
final String res = calculatorService.getDiff("3.2;5.6", 2, "floatArray").toString();
|
||||
Assertions.assertEquals("[1.2, 3.6]", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void FloatArrayMul() {
|
||||
final String res = calculatorService.getMul("3.2;5.6", 2, "floatArray").toString();
|
||||
Assertions.assertEquals("[6.4, 11.2]", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void FloatArrayDiv() {
|
||||
final String res = calculatorService.getDiv("3.2;5.6", 2, "floatArray").toString();
|
||||
Assertions.assertEquals("[1.6, 2.8]", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testErrorErrorWired() {
|
||||
Assertions.assertThrows(NoSuchBeanDefinitionException.class, () -> calculatorService.getSum(1, 2, "date"));
|
||||
}
|
||||
}
|
||||
|
BIN
src/test/java/ru/ulstu/is/sbapp/cart.png
Normal file
BIN
src/test/java/ru/ulstu/is/sbapp/cart.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue
Block a user