Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b56c295266 | ||
|
b2815fd417 | ||
|
8c516e69f1 | ||
|
1b4d36a1e2 | ||
|
70a17c4b7c | ||
|
7ae556be81 | ||
|
a25b5454a7 | ||
|
fd8a8e32c6 | ||
|
ca392cb92b | ||
|
a9e7a9fc6b | ||
|
b77b39e859 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,7 +4,7 @@ build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
node_modules
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
|
40
Front/index.html
Normal file
40
Front/index.html
Normal file
@ -0,0 +1,40 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
<link href="node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet"/>
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="frm-items" class="row g-3">
|
||||
<div class="d-flex flex-column w-25 my-5 mx-3">
|
||||
Введите первое число
|
||||
<input id="first"></input>
|
||||
Введите второе число
|
||||
<input id="second" ></input>
|
||||
Выберите операцию
|
||||
<div>
|
||||
<button type="button" class="btn btn-primary" id="buttonPlus">+</button>
|
||||
<button type="button" class="btn btn-primary" id="buttonMinus">-</button>
|
||||
<button type="button" class="btn btn-primary" id="buttonMulti">*</button>
|
||||
<button type="button" class="btn btn-primary" id="buttonDiv">/</button>
|
||||
</div>
|
||||
Выберите тип данных
|
||||
<div>
|
||||
<select id="type" class="form-select" >
|
||||
<option value="int">Число</option>
|
||||
<option value="string">Строка</option>
|
||||
</select>
|
||||
</div>
|
||||
Результат
|
||||
<input id="res" type="text"></input>
|
||||
</div>
|
||||
</form>
|
||||
<script src="/script.js"></script>
|
||||
</body>
|
||||
</html>
|
814
Front/package-lock.json
generated
Normal file
814
Front/package-lock.json
generated
Normal file
@ -0,0 +1,814 @@
|
||||
{
|
||||
"name": "int-prog",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "int-prog",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "6.2.0",
|
||||
"bootstrap": "5.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"http-server": "14.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
|
||||
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==",
|
||||
"hasInstallScript": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.1.tgz",
|
||||
"integrity": "sha512-UQi3v2NpVPEi1n35dmRRzBJFlgvWHYwyem6yHhuT6afYF+sziEt46McRbT//kVXZ7b1YUYEVGdXEH74Nx3xzGA==",
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/corser": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
|
||||
"integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
|
||||
"integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
|
||||
"integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"async": "^2.6.4",
|
||||
"debug": "^3.2.7",
|
||||
"mkdirp": "^0.5.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.11.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
||||
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"iconv-lite": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
|
||||
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ=="
|
||||
},
|
||||
"@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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.2"
|
||||
}
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.1.tgz",
|
||||
"integrity": "sha512-UQi3v2NpVPEi1n35dmRRzBJFlgvWHYwyem6yHhuT6afYF+sziEt46McRbT//kVXZ7b1YUYEVGdXEH74Nx3xzGA==",
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"corser": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
|
||||
"integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
|
||||
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
|
||||
"dev": true
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||
"dev": true
|
||||
},
|
||||
"get-intrinsic": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
|
||||
"integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||
"dev": true
|
||||
},
|
||||
"he": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"dev": true
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
|
||||
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"object-inspect": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
|
||||
"integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
|
||||
"dev": true
|
||||
},
|
||||
"opener": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
|
||||
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
|
||||
"dev": true
|
||||
},
|
||||
"portfinder": {
|
||||
"version": "1.0.32",
|
||||
"resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.32.tgz",
|
||||
"integrity": "sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"async": "^2.6.4",
|
||||
"debug": "^3.2.7",
|
||||
"mkdirp": "^0.5.6"
|
||||
}
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.11.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
|
||||
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"dev": true
|
||||
},
|
||||
"secure-compare": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
|
||||
"integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==",
|
||||
"dev": true
|
||||
},
|
||||
"side-channel": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
|
||||
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true,
|
||||
"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==",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"iconv-lite": "0.6.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
Front/package.json
Normal file
16
Front/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "int-prog",
|
||||
"version": "1.0.0",
|
||||
"main": "index.html",
|
||||
"scripts": {
|
||||
"start": "http-server -p 3000 ./",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap": "5.2.1",
|
||||
"@fortawesome/fontawesome-free": "6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"http-server": "14.1.1"
|
||||
}
|
||||
}
|
51
Front/script.js
Normal file
51
Front/script.js
Normal file
@ -0,0 +1,51 @@
|
||||
let calculateButton = document.getElementById("calculate");
|
||||
let numberOneInput = document.getElementById("first");
|
||||
let numberTwoInput = document.getElementById("second");
|
||||
let resultInput = document.getElementById("res");
|
||||
let typeInput = document.getElementById("type");
|
||||
|
||||
buttonPlus.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
let num_1 = numberOneInput.value;
|
||||
let num_2 = numberTwoInput.value;
|
||||
let type = typeInput.value;
|
||||
fetch(`http://localhost:8080/sum?first=${num_1}&second=${num_2}&type=${type}`)
|
||||
.then(response => response.text())
|
||||
.then(res => {
|
||||
resultInput.value = res;
|
||||
});
|
||||
}
|
||||
buttonMinus.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
let num_1 = numberOneInput.value;
|
||||
let num_2 = numberTwoInput.value;
|
||||
let type = typeInput.value;
|
||||
fetch(`http://localhost:8080/minus?first=${num_1}&second=${num_2}&type=${type}`)
|
||||
.then(response => response.text())
|
||||
.then(res => {
|
||||
resultInput.value = res;
|
||||
});
|
||||
}
|
||||
buttonMulti.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
let num_1 = numberOneInput.value;
|
||||
let num_2 = numberTwoInput.value;
|
||||
let type = typeInput.value;
|
||||
fetch(`http://localhost:8080/multi?first=${num_1}&second=${num_2}&type=${type}`)
|
||||
.then(response => response.text())
|
||||
.then(res => {
|
||||
resultInput.value = res;
|
||||
});
|
||||
}
|
||||
buttonDiv.onclick = function(event) {
|
||||
event.preventDefault();
|
||||
let num_1 = numberOneInput.value;
|
||||
let num_2 = numberTwoInput.value;
|
||||
let type = typeInput.value;
|
||||
fetch(`http://localhost:8080/div?first=${num_1}&second=${num_2}&type=${type}`)
|
||||
.then(response => response.text())
|
||||
.then(res =>
|
||||
{
|
||||
resultInput.value = res;
|
||||
});
|
||||
}
|
@ -14,7 +14,11 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
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'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
|
@ -2,8 +2,6 @@ package ip.labwork;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@SpringBootApplication
|
||||
@ -12,8 +10,4 @@ public class LabworkApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(LabworkApplication.class, args);
|
||||
}
|
||||
@GetMapping("/hello")
|
||||
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||
return String.format("Hello %s!", name);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package ip.labwork.method.controller;
|
||||
|
||||
import ip.labwork.method.service.MethodService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class MethodController {
|
||||
private final MethodService speakerService;
|
||||
|
||||
public MethodController(MethodService speakerService) {
|
||||
this.speakerService = speakerService;
|
||||
}
|
||||
|
||||
@GetMapping("/sum")
|
||||
public String Sum(@RequestParam(value = "first", defaultValue = "1") Object first,
|
||||
@RequestParam(value = "second", defaultValue = "1") Object second,
|
||||
@RequestParam(value = "type", defaultValue = "int") String type) {
|
||||
return speakerService.Sum(first,second,type);
|
||||
}
|
||||
|
||||
@GetMapping("/minus")
|
||||
public String Ras(@RequestParam(value = "first", defaultValue = "1") Object first,
|
||||
@RequestParam(value = "second", defaultValue = "1") Object second,
|
||||
@RequestParam(value = "type", defaultValue = "int") String type) {
|
||||
return speakerService.Ras(first,second,type);
|
||||
}
|
||||
|
||||
@GetMapping("/multi")
|
||||
public String Pros(@RequestParam(value = "first", defaultValue = "1") Object first,
|
||||
@RequestParam(value = "second", defaultValue = "1") Object second,
|
||||
@RequestParam(value = "type", defaultValue = "int") String type) {
|
||||
return speakerService.Pros(first,second,type);
|
||||
}
|
||||
|
||||
@GetMapping("/div")
|
||||
public String Del(@RequestParam(value = "first", defaultValue = "1") Object first,
|
||||
@RequestParam(value = "second", defaultValue = "1") Object second,
|
||||
@RequestParam(value = "type", defaultValue = "int") String type) {
|
||||
return speakerService.Del(first,second,type);
|
||||
}
|
||||
}
|
11
src/main/java/ip/labwork/method/domain/IMethod.java
Normal file
11
src/main/java/ip/labwork/method/domain/IMethod.java
Normal file
@ -0,0 +1,11 @@
|
||||
package ip.labwork.method.domain;
|
||||
|
||||
public interface IMethod<T> {
|
||||
T Sum(T first, T second);
|
||||
|
||||
T Multiply(T first, Integer second);
|
||||
|
||||
T Minus(T first, Integer second);
|
||||
|
||||
T Div(T first, T second);
|
||||
}
|
27
src/main/java/ip/labwork/method/domain/MethodInt.java
Normal file
27
src/main/java/ip/labwork/method/domain/MethodInt.java
Normal file
@ -0,0 +1,27 @@
|
||||
package ip.labwork.method.domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component(value="int")
|
||||
public class MethodInt implements IMethod<Integer>{
|
||||
public Integer Sum(Integer first, Integer second) {
|
||||
return Integer.parseInt(first.toString()) + Integer.parseInt(second.toString());
|
||||
}
|
||||
|
||||
public Integer Multiply(Integer first, Integer second) {
|
||||
return Integer.parseInt(first.toString()) * Integer.parseInt(second.toString());
|
||||
}
|
||||
|
||||
public Integer Minus(Integer first, Integer second) {
|
||||
return Integer.parseInt(first.toString()) - Integer.parseInt(second.toString());
|
||||
}
|
||||
|
||||
public Integer Div(Integer first, Integer second) {
|
||||
int num = Integer.parseInt(second.toString());
|
||||
if (num == 0){
|
||||
return null;
|
||||
}else{
|
||||
return Integer.parseInt(first.toString()) / num;
|
||||
}
|
||||
}
|
||||
}
|
44
src/main/java/ip/labwork/method/domain/MethodString.java
Normal file
44
src/main/java/ip/labwork/method/domain/MethodString.java
Normal file
@ -0,0 +1,44 @@
|
||||
package ip.labwork.method.domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component(value="string")
|
||||
public class MethodString implements IMethod<String>{
|
||||
@Override
|
||||
public String Sum(String first, String second) {
|
||||
return first.concat(second);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String Multiply(String first, Integer second) {
|
||||
if (second != 0){
|
||||
String temp = "";
|
||||
for (int i = 0; i < second; i++){
|
||||
temp = temp.concat(first);
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
else{
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String Minus(String first, Integer second) {
|
||||
String temp = first;
|
||||
if(temp.length() >= second){
|
||||
return temp.substring(0, first.length() - second);
|
||||
}else{
|
||||
return first;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String Div(String first, String second) {
|
||||
if (first.contains(second)){
|
||||
return "true";
|
||||
}else{
|
||||
return "false";
|
||||
}
|
||||
}
|
||||
}
|
51
src/main/java/ip/labwork/method/service/MethodService.java
Normal file
51
src/main/java/ip/labwork/method/service/MethodService.java
Normal file
@ -0,0 +1,51 @@
|
||||
package ip.labwork.method.service;
|
||||
|
||||
import ip.labwork.method.domain.IMethod;
|
||||
import ip.labwork.method.domain.MethodString;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MethodService {
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
public MethodService(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public String Sum(Object first, Object second, String type) {
|
||||
final IMethod speaker = (IMethod) applicationContext.getBean(type);
|
||||
if (speaker instanceof MethodString){
|
||||
return String.format("%s", speaker.Sum(first,second));
|
||||
}else{
|
||||
return String.format("%s", speaker.Sum(Integer.parseInt(first.toString()),Integer.parseInt(second.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
public String Ras(Object first, Object second, String type) {
|
||||
final IMethod speaker = (IMethod) applicationContext.getBean(type);
|
||||
if (speaker instanceof MethodString){
|
||||
return String.format("%s", speaker.Minus(first,Integer.parseInt(second.toString())));
|
||||
}else{
|
||||
return String.format("%s", speaker.Minus(Integer.parseInt(first.toString()),Integer.parseInt(second.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
public String Pros(Object first, Object second, String type) {
|
||||
final IMethod speaker = (IMethod) applicationContext.getBean(type);
|
||||
if (speaker instanceof MethodString){
|
||||
return String.format("%s", speaker.Multiply(first,Integer.parseInt(second.toString())));
|
||||
}else{
|
||||
return String.format("%s", speaker.Multiply(Integer.parseInt(first.toString()),Integer.parseInt(second.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
public String Del(Object first, Object second, String type) {
|
||||
final IMethod speaker = (IMethod) applicationContext.getBean(type);
|
||||
if (speaker instanceof MethodString){
|
||||
return String.format("%s", speaker.Div(first,second));
|
||||
}else {
|
||||
return String.format("%s", speaker.Div(Integer.parseInt(first.toString()), Integer.parseInt(second.toString())));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package ip.labwork.shop.controller;
|
||||
|
||||
import ip.labwork.shop.model.Component;
|
||||
import ip.labwork.shop.service.ComponentService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/component")
|
||||
|
||||
public class ComponentController {
|
||||
private final ComponentService componentService;
|
||||
|
||||
public ComponentController(ComponentService componentService) {
|
||||
this.componentService = componentService;
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public Component create(@RequestParam("name") String name,
|
||||
@RequestParam("price") Integer price) {
|
||||
return componentService.addComponent(name, price);
|
||||
}
|
||||
|
||||
@GetMapping("/update")
|
||||
public Component update(@RequestParam("id") Long id,
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("price") Integer price) {
|
||||
return componentService.updateComponent(id, name, price);
|
||||
}
|
||||
|
||||
@GetMapping("/remove")
|
||||
public Component remove(@RequestParam("id") Long id) {
|
||||
return componentService.deleteComponent(id);
|
||||
}
|
||||
|
||||
@GetMapping("/removeAll")
|
||||
public void remove() {
|
||||
componentService.deleteAllComponent();
|
||||
}
|
||||
|
||||
@GetMapping("/find")
|
||||
public Component find(@RequestParam("id") Long id) {
|
||||
return componentService.findComponent(id);
|
||||
}
|
||||
|
||||
@GetMapping("/findAll")
|
||||
public List<Component> findAll() {
|
||||
return componentService.findAllComponent();
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package ip.labwork.shop.controller;
|
||||
|
||||
import ip.labwork.shop.service.ProductService;
|
||||
import ip.labwork.shop.model.Order;
|
||||
import ip.labwork.shop.service.OrderService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OrderController {
|
||||
private final OrderService orderService;
|
||||
private final ProductService productService;
|
||||
public OrderController(OrderService orderService, ProductService productService) {
|
||||
this.orderService = orderService;
|
||||
this.productService = productService;
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public Order create(@RequestParam("date") String date,
|
||||
@RequestParam("price") Integer price,
|
||||
@RequestParam("count") Integer[] count,
|
||||
@RequestParam("prod") Long[] prod){
|
||||
return orderService.addOrder(date, price, count, productService.findFiltredProducts(prod));
|
||||
}
|
||||
@GetMapping("/update")
|
||||
public Order update(@RequestParam("id") Long id,
|
||||
@RequestParam("date") String date,
|
||||
@RequestParam("price") Integer price,
|
||||
@RequestParam("count") Integer[] count,
|
||||
@RequestParam("prod") Long[] prod){
|
||||
return orderService.updateOrder(id, date, price, count, productService.findFiltredProducts(prod));
|
||||
}
|
||||
@GetMapping("/remove")
|
||||
public Order remove(@RequestParam("id") Long id){
|
||||
return orderService.deleteOrder(id);
|
||||
}
|
||||
@GetMapping("/removeAll")
|
||||
public void remove(){
|
||||
orderService.deleteAllOrder();
|
||||
}
|
||||
@GetMapping("/find")
|
||||
public Order find(@RequestParam("id") Long id){
|
||||
return orderService.findOrder(id);
|
||||
}
|
||||
@GetMapping("/findAll")
|
||||
public List<Order> findAll(){
|
||||
return orderService.findAllOrder();
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package ip.labwork.shop.controller;
|
||||
|
||||
import ip.labwork.shop.service.ProductService;
|
||||
import ip.labwork.shop.model.Product;
|
||||
import ip.labwork.shop.service.ComponentService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/product")
|
||||
public class ProductController {
|
||||
private final ProductService productService;
|
||||
private final ComponentService componentService;
|
||||
|
||||
public ProductController(ProductService productService, ComponentService componentService) {
|
||||
this.productService = productService;
|
||||
this.componentService = componentService;
|
||||
}
|
||||
|
||||
@GetMapping("/add")
|
||||
public Product create(@RequestParam("name") String name,
|
||||
@RequestParam("price") Integer price,
|
||||
@RequestParam("count") Integer[] count,
|
||||
@RequestParam("comp") Long[] comp){
|
||||
return productService.addProduct(name, price, count, componentService.findFiltredComponents(comp));
|
||||
}
|
||||
@GetMapping("/update")
|
||||
public Product update(@RequestParam("id") Long id,
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("price") Integer price,
|
||||
@RequestParam("count") Integer[] count,
|
||||
@RequestParam("comp") Long[] comp){
|
||||
return productService.updateProduct(id, name, price, count, componentService.findFiltredComponents(comp));
|
||||
}
|
||||
@GetMapping("/remove")
|
||||
public Product remove(@RequestParam("id") Long id){
|
||||
return productService.deleteProduct(id);
|
||||
}
|
||||
@GetMapping("/removeAll")
|
||||
public void remove(){
|
||||
productService.deleteAllProduct();
|
||||
}
|
||||
@GetMapping("/find")
|
||||
public Product find(@RequestParam("id") Long id){
|
||||
return productService.findProduct(id);
|
||||
}
|
||||
@GetMapping("/findAll")
|
||||
public List<Product> findAll(){
|
||||
return productService.findAllProduct();
|
||||
}
|
||||
}
|
95
src/main/java/ip/labwork/shop/model/Component.java
Normal file
95
src/main/java/ip/labwork/shop/model/Component.java
Normal file
@ -0,0 +1,95 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "components")
|
||||
public class Component {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
@Column(name = "name")
|
||||
private String componentName;
|
||||
@Column(name = "price")
|
||||
private Integer price;
|
||||
|
||||
@OneToMany(mappedBy = "component", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JsonIgnore
|
||||
private List<ProductComponents> products;
|
||||
|
||||
public Component() {
|
||||
}
|
||||
|
||||
public Component(String componentName, Integer price) {
|
||||
this.componentName = componentName;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getComponentName() {
|
||||
return componentName;
|
||||
}
|
||||
|
||||
public void setComponentName(String componentName) {
|
||||
this.componentName = componentName;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Integer price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public List<ProductComponents> getProducts() {
|
||||
return products;
|
||||
}
|
||||
|
||||
public void setProducts(List<ProductComponents> products) {
|
||||
this.products = products;
|
||||
}
|
||||
|
||||
public void addProduct(ProductComponents productComponents) {
|
||||
if (products == null) {
|
||||
products = new ArrayList<>();
|
||||
}
|
||||
if (!products.contains(productComponents))
|
||||
this.products.add(productComponents);
|
||||
}
|
||||
|
||||
public void removeProduct(ProductComponents productComponents) {
|
||||
if (products.contains(productComponents))
|
||||
this.products.remove(productComponents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Component component = (Component) o;
|
||||
return Objects.equals(id, component.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Component{" +
|
||||
"id=" + id +
|
||||
", componentName='" + componentName + '\'' +
|
||||
", price='" + price + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
85
src/main/java/ip/labwork/shop/model/Order.java
Normal file
85
src/main/java/ip/labwork/shop/model/Order.java
Normal file
@ -0,0 +1,85 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "orders")
|
||||
public class Order {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
@Column(name = "date")
|
||||
private Date date;
|
||||
@Column(name = "price")
|
||||
private Integer price;
|
||||
@OneToMany(mappedBy = "order", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private List<OrderProducts> products;
|
||||
public Order(){
|
||||
|
||||
}
|
||||
|
||||
public Order(Date date, Integer price) {
|
||||
this.date = date;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Integer price) {
|
||||
this.price = price;
|
||||
}
|
||||
public List<OrderProducts> getProducts() {
|
||||
return products;
|
||||
}
|
||||
|
||||
public void setProducts(List<OrderProducts> products) {
|
||||
this.products = products;
|
||||
}
|
||||
|
||||
public void addProduct(OrderProducts orderProducts){
|
||||
if (products == null){
|
||||
this.products = new ArrayList<>();
|
||||
}
|
||||
if (!products.contains(orderProducts))
|
||||
this.products.add(orderProducts);
|
||||
}
|
||||
public void removeProducts(OrderProducts orderProducts){
|
||||
if (products.contains(orderProducts))
|
||||
this.products.remove(orderProducts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Order order)) return false;
|
||||
return Objects.equals(getId(), order.getId()) && Objects.equals(getDate(), order.getDate()) && Objects.equals(getPrice(), order.getPrice());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getId(), getDate(), getPrice());
|
||||
}
|
||||
}
|
66
src/main/java/ip/labwork/shop/model/OrderProducts.java
Normal file
66
src/main/java/ip/labwork/shop/model/OrderProducts.java
Normal file
@ -0,0 +1,66 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "order_product")
|
||||
public class OrderProducts {
|
||||
@EmbeddedId
|
||||
private OrderProductsKey id;
|
||||
@ManyToOne
|
||||
@MapsId("productId")
|
||||
@JoinColumn(name = "product_id")
|
||||
private Product product;
|
||||
@ManyToOne
|
||||
@MapsId("orderId")
|
||||
@JoinColumn(name = "order_id")
|
||||
@JsonIgnore
|
||||
private Order order;
|
||||
@Column(name = "count")
|
||||
private Integer count;
|
||||
|
||||
public OrderProducts() {
|
||||
}
|
||||
|
||||
public OrderProducts(Order order, Product product, Integer count) {
|
||||
this.order = order;
|
||||
this.id = new OrderProductsKey(product.getId(), order.getId());
|
||||
this.id.setOrderId(order.getId());
|
||||
this.id.setProductId(product.getId());
|
||||
this.product = product;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public OrderProductsKey getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(OrderProductsKey id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Order order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
48
src/main/java/ip/labwork/shop/model/OrderProductsKey.java
Normal file
48
src/main/java/ip/labwork/shop/model/OrderProductsKey.java
Normal file
@ -0,0 +1,48 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Embeddable
|
||||
public class OrderProductsKey implements Serializable {
|
||||
private Long productId;
|
||||
private Long orderId;
|
||||
|
||||
public OrderProductsKey() {
|
||||
}
|
||||
|
||||
public OrderProductsKey(Long productId, Long orderId) {
|
||||
this.productId = productId;
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Long orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof OrderProductsKey that)) return false;
|
||||
return Objects.equals(getProductId(), that.getProductId()) && Objects.equals(getOrderId(), that.getOrderId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getProductId(), getOrderId());
|
||||
}
|
||||
}
|
126
src/main/java/ip/labwork/shop/model/Product.java
Normal file
126
src/main/java/ip/labwork/shop/model/Product.java
Normal file
@ -0,0 +1,126 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@Table(name = "products")
|
||||
public class Product {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Long id;
|
||||
@Column(name = "name")
|
||||
private String productName;
|
||||
@Column(name = "price")
|
||||
private Integer price;
|
||||
|
||||
@OneToMany(mappedBy = "product", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private List<ProductComponents> components;
|
||||
|
||||
@OneToMany(mappedBy = "product", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JsonIgnore
|
||||
private List<OrderProducts> orders;
|
||||
|
||||
|
||||
public Product() {
|
||||
|
||||
}
|
||||
|
||||
public Product(String productName, Integer price) {
|
||||
this.productName = productName;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Integer price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public List<ProductComponents> getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
public void setComponents(List<ProductComponents> components) {
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
public void update(Product product){
|
||||
this.productName = product.productName;
|
||||
this.price = product.price;
|
||||
this.components = product.getComponents();
|
||||
}
|
||||
|
||||
public void addComponent(ProductComponents productComponents){
|
||||
if (components == null){
|
||||
this.components = new ArrayList<>();
|
||||
}
|
||||
if (!components.contains(productComponents))
|
||||
this.components.add(productComponents);
|
||||
}
|
||||
public void removeComponent(ProductComponents productComponents){
|
||||
if (components.contains(productComponents))
|
||||
this.components.remove(productComponents);
|
||||
}
|
||||
|
||||
public List<OrderProducts> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(List<OrderProducts> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
public void addOrder(OrderProducts orderProducts){
|
||||
if (orders == null){
|
||||
orders = new ArrayList<>();
|
||||
}
|
||||
if (!orders.contains(orderProducts))
|
||||
this.orders.add(orderProducts);
|
||||
}
|
||||
public void removeOrder(OrderProducts orderProducts){
|
||||
if (orders.contains(orderProducts))
|
||||
this.orders.remove(orderProducts);
|
||||
}
|
||||
|
||||
|
||||
@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 +
|
||||
", productName='" + productName + '\'' +
|
||||
", price='" + price + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
66
src/main/java/ip/labwork/shop/model/ProductComponents.java
Normal file
66
src/main/java/ip/labwork/shop/model/ProductComponents.java
Normal file
@ -0,0 +1,66 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "product_component")
|
||||
public class ProductComponents {
|
||||
@EmbeddedId
|
||||
private ProductComponentsKey id;
|
||||
@ManyToOne
|
||||
@MapsId("componentId")
|
||||
@JoinColumn(name = "component_id")
|
||||
private Component component;
|
||||
@ManyToOne
|
||||
@MapsId("productId")
|
||||
@JoinColumn(name = "product_id")
|
||||
@JsonIgnore
|
||||
private Product product;
|
||||
@Column(name = "count")
|
||||
private Integer count;
|
||||
|
||||
public ProductComponents() {
|
||||
}
|
||||
|
||||
public ProductComponents(Component component, Product product, Integer count) {
|
||||
this.component = component;
|
||||
this.id = new ProductComponentsKey(product.getId(), component.getId());
|
||||
this.id.setComponentId(component.getId());
|
||||
this.id.setProductId(product.getId());
|
||||
this.product = product;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public ProductComponentsKey getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(ProductComponentsKey id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Component getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(Component component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package ip.labwork.shop.model;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@Embeddable
|
||||
public class ProductComponentsKey implements Serializable {
|
||||
private Long productId;
|
||||
private Long componentId;
|
||||
|
||||
public ProductComponentsKey() {
|
||||
}
|
||||
|
||||
public ProductComponentsKey(Long productId, Long componentId) {
|
||||
this.productId = productId;
|
||||
this.componentId = componentId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getComponentId() {
|
||||
return componentId;
|
||||
}
|
||||
|
||||
public void setComponentId(Long componentId) {
|
||||
this.componentId = componentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof ProductComponentsKey that)) return false;
|
||||
return Objects.equals(getProductId(), that.getProductId()) && Objects.equals(getComponentId(), that.getComponentId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getProductId(), getComponentId());
|
||||
}
|
||||
}
|
88
src/main/java/ip/labwork/shop/service/ComponentService.java
Normal file
88
src/main/java/ip/labwork/shop/service/ComponentService.java
Normal file
@ -0,0 +1,88 @@
|
||||
package ip.labwork.shop.service;
|
||||
|
||||
import ip.labwork.shop.model.Component;
|
||||
import ip.labwork.shop.model.OrderProducts;
|
||||
import ip.labwork.shop.model.Product;
|
||||
import ip.labwork.shop.model.ProductComponents;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ComponentService {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Transactional
|
||||
public Component addComponent(String componentName, Integer price) {
|
||||
if (!StringUtils.hasText(componentName) || price == 0) {
|
||||
throw new IllegalArgumentException("Component is null or empty");
|
||||
}
|
||||
final Component component = new Component(componentName, price);
|
||||
em.persist(component);
|
||||
return component;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Component findComponent(Long id) {
|
||||
final Component component = em.find(Component.class, id);
|
||||
if (component == null) {
|
||||
throw new EntityNotFoundException(String.format("Component with id [%s] is not found", id));
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Component> findAllComponent() {
|
||||
return em.createQuery("select c from Component c", Component.class)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Component> findFiltredComponents(Long[] arr) {
|
||||
if (arr.length == 0) {
|
||||
throw new IllegalArgumentException("Array id is empty");
|
||||
}
|
||||
List<Component> componentList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
componentList.add(em.find(Component.class, arr[i]));
|
||||
}
|
||||
return componentList;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Component updateComponent(Long id, String componentName, Integer price) {
|
||||
if (!StringUtils.hasText(componentName) || price == 0) {
|
||||
throw new IllegalArgumentException("Component is null or empty");
|
||||
}
|
||||
final Component currentComponent = findComponent(id);
|
||||
currentComponent.setComponentName(componentName);
|
||||
currentComponent.setPrice(price);
|
||||
return em.merge(currentComponent);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Component deleteComponent(Long id) {
|
||||
final Component currentComponent = findComponent(id);
|
||||
int size = currentComponent.getProducts().size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ProductComponents temp = currentComponent.getProducts().get(0);
|
||||
temp.getComponent().removeProduct(temp);
|
||||
temp.getProduct().removeComponent(temp);
|
||||
em.remove(temp);
|
||||
}
|
||||
em.remove(currentComponent);
|
||||
return currentComponent;
|
||||
}
|
||||
@Transactional
|
||||
public void deleteAllComponent() {
|
||||
em.createQuery("delete from ProductComponents").executeUpdate();
|
||||
em.createQuery("delete from Component").executeUpdate();
|
||||
}
|
||||
}
|
118
src/main/java/ip/labwork/shop/service/OrderService.java
Normal file
118
src/main/java/ip/labwork/shop/service/OrderService.java
Normal file
@ -0,0 +1,118 @@
|
||||
package ip.labwork.shop.service;
|
||||
|
||||
import ip.labwork.shop.model.Order;
|
||||
import ip.labwork.shop.model.OrderProducts;
|
||||
import ip.labwork.shop.model.Product;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class OrderService {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Transactional
|
||||
public Order addOrder(String date, Integer price, Integer[] count, List<Product> products) {
|
||||
if (!StringUtils.hasText(date) || price == 0 || count.length == 0 || Arrays.stream(count).filter(c -> c == 0).toList().size() != 0 || products.size() == 0 || products.stream().filter(Objects::isNull).toList().size() != 0 || count.length != products.size()) {
|
||||
throw new IllegalArgumentException("Order is null or empty");
|
||||
}
|
||||
Date correctDate = getDate(date);
|
||||
final Order order = new Order(correctDate, price);
|
||||
em.persist(order);
|
||||
for (int i = 0; i < products.size(); i++) {
|
||||
final OrderProducts orderProducts = new OrderProducts(order, products.get(i), count[i]);
|
||||
order.addProduct(orderProducts);
|
||||
products.get(i).addOrder(orderProducts);
|
||||
em.persist(orderProducts);
|
||||
}
|
||||
return order;
|
||||
}
|
||||
|
||||
public Date getDate(String date) {
|
||||
SimpleDateFormat format = new SimpleDateFormat();
|
||||
format.applyPattern("dd.MM.yyyy");
|
||||
Date newDate;
|
||||
try {
|
||||
newDate = format.parse(date);
|
||||
} catch (Exception exception) {
|
||||
newDate = new Date();
|
||||
}
|
||||
return newDate;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Order findOrder(Long id) {
|
||||
final Order order = em.find(Order.class, id);
|
||||
if (order == null) {
|
||||
throw new EntityNotFoundException(String.format("Order with id [%s] is not found", id));
|
||||
}
|
||||
return order;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<Order> findAllOrder() {
|
||||
return em.createQuery("select o from Order o", Order.class)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Order updateOrder(Long id, String date, Integer price, Integer[] count, List<Product> products) {
|
||||
if (!StringUtils.hasText(date) || price == 0 || count.length == 0 || Arrays.stream(count).filter(c -> c == 0).toList().size() != 0 || products.size() == 0 || products.stream().filter(Objects::isNull).toList().size() != 0 || count.length != products.size()) {
|
||||
throw new IllegalArgumentException("Order is null or empty");
|
||||
}
|
||||
final Order currentOrder = findOrder(id);
|
||||
currentOrder.setDate(getDate(date));
|
||||
currentOrder.setPrice(price);
|
||||
em.merge(currentOrder);
|
||||
List<OrderProducts> orderProductsList = em.createQuery("select o from OrderProducts o where o.id.orderId = " + id, OrderProducts.class)
|
||||
.getResultList();
|
||||
List<Long> product_id = new ArrayList<>(orderProductsList.stream().map(p -> p.getId().getProductId()).toList());
|
||||
for (int i = 0; i < products.size(); i++) {
|
||||
final Long currentId = products.get(i).getId();
|
||||
if (product_id.contains(currentId)) {
|
||||
final OrderProducts orderProducts = orderProductsList.stream().filter(x -> Objects.equals(x.getId().getProductId(), currentId)).toList().get(0);
|
||||
orderProductsList.remove(orderProducts);
|
||||
product_id.remove(products.get(i).getId());
|
||||
orderProducts.setCount(count[i]);
|
||||
em.merge(orderProducts);
|
||||
} else {
|
||||
final OrderProducts orderProducts = new OrderProducts(currentOrder, products.get(i), count[i]);
|
||||
currentOrder.addProduct(orderProducts);
|
||||
products.get(i).addOrder(orderProducts);
|
||||
em.persist(orderProducts);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < orderProductsList.size(); i++) {
|
||||
orderProductsList.get(i).getProduct().removeOrder(orderProductsList.get(i));
|
||||
orderProductsList.get(i).getOrder().removeProducts(orderProductsList.get(i));
|
||||
em.remove(orderProductsList.get(i));
|
||||
}
|
||||
return currentOrder;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Order deleteOrder(Long id) {
|
||||
final Order currentOrder = findOrder(id);
|
||||
int size = currentOrder.getProducts().size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
OrderProducts temp = currentOrder.getProducts().get(0);
|
||||
temp.getProduct().removeOrder(temp);
|
||||
temp.getOrder().removeProducts(temp);
|
||||
em.remove(temp);
|
||||
}
|
||||
em.remove(currentOrder);
|
||||
return currentOrder;
|
||||
}
|
||||
@Transactional
|
||||
public void deleteAllOrder() {
|
||||
em.createQuery("delete from OrderProducts").executeUpdate();
|
||||
em.createQuery("delete from Order").executeUpdate();
|
||||
}
|
||||
}
|
129
src/main/java/ip/labwork/shop/service/ProductService.java
Normal file
129
src/main/java/ip/labwork/shop/service/ProductService.java
Normal file
@ -0,0 +1,129 @@
|
||||
package ip.labwork.shop.service;
|
||||
|
||||
import ip.labwork.shop.model.Component;
|
||||
import ip.labwork.shop.model.OrderProducts;
|
||||
import ip.labwork.shop.model.Product;
|
||||
import ip.labwork.shop.model.ProductComponents;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
import jakarta.persistence.PersistenceContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class ProductService {
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@Transactional
|
||||
public Product addProduct(String productName, Integer price, Integer[] count, List<Component> components) {
|
||||
if (!StringUtils.hasText(productName) || price == 0 || count.length == 0 || Arrays.stream(count).filter(c -> c == 0).toList().size() != 0 || components.size() == 0 || components.stream().filter(Objects::isNull).toList().size() != 0 || count.length != components.size()) {
|
||||
throw new IllegalArgumentException("Product name is null or empty");
|
||||
}
|
||||
final Product product = new Product(productName, price);
|
||||
em.persist(product);
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
final ProductComponents productComponents = new ProductComponents(components.get(i), product, count[i]);
|
||||
product.addComponent(productComponents);
|
||||
components.get(i).addProduct(productComponents);
|
||||
em.persist(productComponents);
|
||||
}
|
||||
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> findAllProduct() {
|
||||
return em.createQuery("select p from Product p", Product.class)
|
||||
.getResultList();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Product updateProduct(Long id, String productName, Integer price, Integer[] count, List<Component> components) {
|
||||
if (!StringUtils.hasText(productName) || price == 0 || count.length == 0 || Arrays.stream(count).filter(c -> c == 0).toList().size() != 0 || components.size() == 0 || components.stream().filter(Objects::isNull).toList().size() != 0 || count.length != components.size()) {
|
||||
throw new IllegalArgumentException("Product name is null or empty");
|
||||
}
|
||||
final Product currentProduct = findProduct(id);
|
||||
currentProduct.setProductName(productName);
|
||||
currentProduct.setPrice(price);
|
||||
em.merge(currentProduct);
|
||||
List<ProductComponents> productComponentsList = em.createQuery("select p from ProductComponents p where p.id.productId = " + id, ProductComponents.class)
|
||||
.getResultList();
|
||||
List<Long> component_id = new ArrayList<>(productComponentsList.stream().map(p -> p.getId().getComponentId()).toList());
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
final Long currentId = components.get(i).getId();
|
||||
if (component_id.contains(currentId)) {
|
||||
final ProductComponents productComponents = productComponentsList.stream().filter(x -> Objects.equals(x.getId().getComponentId(), currentId)).toList().get(0);
|
||||
productComponentsList.remove(productComponents);
|
||||
component_id.remove(components.get(i).getId());
|
||||
productComponents.setCount(count[i]);
|
||||
em.merge(productComponents);
|
||||
} else {
|
||||
final ProductComponents productComponents = new ProductComponents(components.get(i), currentProduct, count[i]);
|
||||
currentProduct.addComponent(productComponents);
|
||||
components.get(i).addProduct(productComponents);
|
||||
em.persist(productComponents);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < productComponentsList.size(); i++) {
|
||||
productComponentsList.get(i).getComponent().removeProduct(productComponentsList.get(i));
|
||||
productComponentsList.get(i).getProduct().removeComponent(productComponentsList.get(i));
|
||||
em.remove(productComponentsList.get(i));
|
||||
}
|
||||
return currentProduct;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Product deleteProduct(Long id) {
|
||||
final Product currentProduct = findProduct(id);
|
||||
int size = currentProduct.getComponents().size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ProductComponents temp = currentProduct.getComponents().get(0);
|
||||
temp.getComponent().removeProduct(temp);
|
||||
temp.getProduct().removeComponent(temp);
|
||||
em.remove(temp);
|
||||
}
|
||||
int ordSize = currentProduct.getOrders().size();
|
||||
for (int i = 0; i < ordSize; i++){
|
||||
OrderProducts temp = currentProduct.getOrders().get(0);
|
||||
temp.getProduct().removeOrder(temp);
|
||||
temp.getOrder().removeProducts(temp);
|
||||
em.remove(temp);
|
||||
}
|
||||
em.remove(currentProduct);
|
||||
return currentProduct;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteAllProduct() {
|
||||
em.createQuery("delete from ProductComponents").executeUpdate();
|
||||
em.createQuery("delete from OrderProducts ").executeUpdate();
|
||||
em.createQuery("delete from Product").executeUpdate();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<Product> findFiltredProducts(Long[] arr) {
|
||||
if (arr.length == 0) {
|
||||
throw new IllegalArgumentException("Array id is empty");
|
||||
}
|
||||
List<Product> productList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
productList.add(em.find(Product.class, arr[i]));
|
||||
}
|
||||
return productList;
|
||||
}
|
||||
}
|
@ -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
|
101
src/test/java/ip/labwork/JpaStudentTests.java
Normal file
101
src/test/java/ip/labwork/JpaStudentTests.java
Normal file
@ -0,0 +1,101 @@
|
||||
package ip.labwork;
|
||||
|
||||
import ip.labwork.shop.model.Component;
|
||||
import ip.labwork.shop.model.Order;
|
||||
import ip.labwork.shop.model.Product;
|
||||
import ip.labwork.shop.service.ComponentService;
|
||||
import ip.labwork.shop.service.OrderService;
|
||||
import ip.labwork.shop.service.ProductService;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
public class JpaStudentTests {
|
||||
private static final Logger log = LoggerFactory.getLogger(JpaStudentTests.class);
|
||||
@Autowired
|
||||
ComponentService componentService;
|
||||
@Autowired
|
||||
ProductService productService;
|
||||
@Autowired
|
||||
OrderService orderService;
|
||||
@Test
|
||||
void test() {
|
||||
componentService.deleteAllComponent();
|
||||
productService.deleteAllProduct();
|
||||
orderService.deleteAllOrder();
|
||||
//TestCreate
|
||||
final Component component = componentService.addComponent("Огурец", 4);
|
||||
log.info(component.toString());
|
||||
Assertions.assertNotNull(component.getId());
|
||||
|
||||
List<Component> componentList = new ArrayList<>();
|
||||
componentList.add(componentService.findComponent(component.getId()));
|
||||
final Product product = productService.addProduct("Бургер", 100, new Integer[]{ 2 }, componentList);
|
||||
log.info(product.toString());
|
||||
Assertions.assertNotNull(product.getId());
|
||||
|
||||
List<Product> productList = new ArrayList<>();
|
||||
productList.add(productService.findProduct(product.getId()));
|
||||
final Order order = orderService.addOrder(new Date().toString(), 200, new Integer[]{ 3 }, productList);
|
||||
log.info(order.toString());
|
||||
Assertions.assertNotNull(order.getId());
|
||||
|
||||
//TestRead
|
||||
final Component findComponent = componentService.findComponent(component.getId());
|
||||
log.info(findComponent.toString());
|
||||
Assertions.assertEquals(component, findComponent);
|
||||
|
||||
final Product findProduct = productService.findProduct(product.getId());
|
||||
log.info(findProduct.toString());
|
||||
Assertions.assertEquals(product, findProduct);
|
||||
|
||||
final Order findOrder = orderService.findOrder(order.getId());
|
||||
log.info(findOrder.toString());
|
||||
Assertions.assertEquals(order, findOrder);
|
||||
|
||||
//TestReadAll
|
||||
final List<Component> components = componentService.findAllComponent();
|
||||
log.info(components.toString());
|
||||
Assertions.assertEquals(components.size(), 1);
|
||||
|
||||
final List<Product> products = productService.findAllProduct();
|
||||
log.info(products.toString());
|
||||
Assertions.assertEquals(products.size(), 1);
|
||||
|
||||
final List<Order> orders = orderService.findAllOrder();
|
||||
log.info(orders.toString());
|
||||
Assertions.assertEquals(orders.size(), 1);
|
||||
|
||||
|
||||
//TestReadNotFound
|
||||
componentService.deleteAllComponent();
|
||||
productService.deleteAllProduct();
|
||||
orderService.deleteAllOrder();
|
||||
|
||||
Assertions.assertThrows(EntityNotFoundException.class, () -> componentService.findComponent(-1L));
|
||||
Assertions.assertThrows(EntityNotFoundException.class, () -> productService.findProduct(-1L));
|
||||
Assertions.assertThrows(EntityNotFoundException.class, () -> orderService.findOrder(-1L));
|
||||
|
||||
//TestReadAllEmpty
|
||||
final List<Component> newComponents = componentService.findAllComponent();
|
||||
log.info(newComponents.toString());
|
||||
Assertions.assertEquals(newComponents.size(), 0);
|
||||
|
||||
final List<Product> newProducts = productService.findAllProduct();
|
||||
log.info(newProducts.toString());
|
||||
Assertions.assertEquals(newProducts.size(), 0);
|
||||
|
||||
final List<Order> newOrders = orderService.findAllOrder();
|
||||
log.info(newOrders.toString());
|
||||
Assertions.assertEquals(newOrders.size(), 0);
|
||||
}
|
||||
}
|
@ -1,13 +1,62 @@
|
||||
package ip.labwork;
|
||||
|
||||
import ip.labwork.method.service.MethodService;
|
||||
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;
|
||||
|
||||
@SpringBootTest
|
||||
class LabworkApplicationTests {
|
||||
|
||||
@Autowired
|
||||
MethodService speakerService;
|
||||
@Test
|
||||
void contextLoads() {
|
||||
void testIntSum() {
|
||||
final String res = speakerService.Sum(20,10,"int");
|
||||
Assertions.assertEquals(30, Integer.parseInt(res));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIntMinus() {
|
||||
final String res = speakerService.Ras(20,10,"int");
|
||||
Assertions.assertEquals(10, Integer.parseInt(res));
|
||||
}
|
||||
@Test
|
||||
void testIntMulti() {
|
||||
final String res = speakerService.Pros(20,10,"int");
|
||||
Assertions.assertEquals(200, Integer.parseInt(res));
|
||||
}
|
||||
@Test
|
||||
void testIntDiv() {
|
||||
final String res = speakerService.Del(20,10,"int");
|
||||
Assertions.assertEquals(2, Integer.parseInt(res));
|
||||
}
|
||||
@Test
|
||||
void testStringSum() {
|
||||
final String res = speakerService.Sum("20","10","string");
|
||||
Assertions.assertEquals("2010", res);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStringMinus() {
|
||||
final String res = speakerService.Ras("300",1,"string");
|
||||
Assertions.assertEquals("30", res);
|
||||
}
|
||||
@Test
|
||||
void testStringMulti() {
|
||||
final String res = speakerService.Pros("20",2,"string");
|
||||
Assertions.assertEquals("2020", res);
|
||||
}
|
||||
@Test
|
||||
void testStringDiv() {
|
||||
final String res = speakerService.Del("20","2","string");
|
||||
Assertions.assertEquals("true", res);
|
||||
}
|
||||
@Test
|
||||
void testSpeakerErrorWired() {
|
||||
Assertions.assertThrows(NoSuchBeanDefinitionException.class, () -> speakerService.Sum("10", "20", "double"));
|
||||
}
|
||||
|
||||
}
|
||||
|
6
src/test/resources/application.properties
Normal file
6
src/test/resources/application.properties
Normal file
@ -0,0 +1,6 @@
|
||||
spring.datasource.url=jdbc:h2:mem:testdb
|
||||
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=create-drop
|
Loading…
Reference in New Issue
Block a user