Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
06dd4eea2a | |||
60dfe21df8 | |||
d67019aac6 | |||
a708009248 |
26
MainPage/.gitignore
vendored
Normal file
26
MainPage/.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
.parcel-cache
|
52
MainPage/LogForMainPage.js
Normal file
52
MainPage/LogForMainPage.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
const operateButton = document.getElementById("operate");
|
||||||
|
const operateStringButton = document.getElementById("operateString");
|
||||||
|
const val1 = document.getElementById("val1");
|
||||||
|
const val2 = document.getElementById("val2");
|
||||||
|
const select = document.getElementById("operation");
|
||||||
|
const finish = document.getElementById("finish");
|
||||||
|
const operateFButton = document.getElementById("operateF");
|
||||||
|
const operateFStringButton = document.getElementById("operateFString");
|
||||||
|
const float1 = document.getElementById("float1");
|
||||||
|
const float2 = document.getElementById("float2");
|
||||||
|
const selectF = document.getElementById("operationF");
|
||||||
|
const finishF = document.getElementById("finishF");
|
||||||
|
|
||||||
|
operateButton.onclick=function(){
|
||||||
|
operate("number");
|
||||||
|
};
|
||||||
|
|
||||||
|
operateStringButton.onclick=function(){
|
||||||
|
operate("string");
|
||||||
|
}
|
||||||
|
|
||||||
|
operateFButton.onclick=function(){
|
||||||
|
operate("numberF");
|
||||||
|
};
|
||||||
|
|
||||||
|
function operate(param){
|
||||||
|
switch(parseInt(select.value)){
|
||||||
|
case 1:
|
||||||
|
doOperation("calc1", param)
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
doOperation("calc2", param)
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
doOperation("calc3", param)
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
doOperation("calc4", param)
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkNumber(res){
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function doOperation(address, type){
|
||||||
|
console.log("Тип переменных: " + type)
|
||||||
|
fetch(`http://localhost:8080/${address}?val1=${val1.value}&val2=${val2.value}&type=${type}`)
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(res=>finish.innerHTML=checkNumber(res));
|
||||||
|
}
|
46
MainPage/MainPage.html
Normal file
46
MainPage/MainPage.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ru">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<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>MainPage</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<form class=" d-flex flex-column align-items-center text-center">
|
||||||
|
<div class="">
|
||||||
|
Введите число
|
||||||
|
<input id="val1" class="form-control" type="numberF" value="0" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Выберите действие
|
||||||
|
<select class="form-select" id="operation">
|
||||||
|
<option value="1">умножить</option>
|
||||||
|
<option value="2">сложить</option>
|
||||||
|
<option value="3">вычесть</option>
|
||||||
|
<option value="4">делить</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Введите второе число
|
||||||
|
<input id="val2" class="form-control" type="numberF" value="0" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button type="button" class="btn btn-primary" id="operate">Вычислить</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button type="button" class="btn btn-primary" id="operateF">Вычислить вещественное</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button type="button" class="btn btn-primary" id="operateString">Строки</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Результат:
|
||||||
|
<p id="finish"></p>
|
||||||
|
</div>
|
||||||
|
<script src="LogForMainPage.js"></script>
|
||||||
|
</body>
|
943
MainPage/package-lock.json
generated
Normal file
943
MainPage/package-lock.json
generated
Normal file
@ -0,0 +1,943 @@
|
|||||||
|
{
|
||||||
|
"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",
|
||||||
|
"axios": "^1.3.4",
|
||||||
|
"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/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"node_modules/axios": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.15.0",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||||
|
"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/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/minimist": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||||
|
"dev": true,
|
||||||
|
"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==",
|
||||||
|
"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.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
||||||
|
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
|
||||||
|
"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/proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
||||||
|
},
|
||||||
|
"axios": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "^1.15.0",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
},
|
||||||
|
"combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"requires": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
|
||||||
|
},
|
||||||
|
"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=="
|
||||||
|
},
|
||||||
|
"form-data": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||||
|
"requires": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||||
|
"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
|
||||||
|
},
|
||||||
|
"mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
|
||||||
|
},
|
||||||
|
"mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"requires": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimist": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||||
|
"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.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
|
||||||
|
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
MainPage/package.json
Normal file
17
MainPage/package.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "int-prog",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "MainPage.html",
|
||||||
|
"scripts": {
|
||||||
|
"start": "http-server -p 3000 ./",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-free": "6.2.0",
|
||||||
|
"axios": "^1.3.4",
|
||||||
|
"bootstrap": "5.2.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"http-server": "14.1.1"
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,13 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
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'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.example.demo.Books.Controller;
|
||||||
|
|
||||||
|
import com.example.demo.Books.Service.BookService;
|
||||||
|
import com.example.demo.Books.Models.Book;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/book")
|
||||||
|
public class BookController {
|
||||||
|
private final BookService bookService;
|
||||||
|
|
||||||
|
|
||||||
|
public BookController(BookService bookService) {
|
||||||
|
this.bookService = bookService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public String test() {
|
||||||
|
return "Test request";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public Book getBook(@PathVariable Long id) {
|
||||||
|
return bookService.findBook(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public List<Book> getBooks() {
|
||||||
|
return bookService.findAllBooks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/")
|
||||||
|
public Book createBook(@RequestParam String name) {
|
||||||
|
return bookService.addBook(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/{id}")
|
||||||
|
public Book updateBook(@PathVariable Long id,
|
||||||
|
@RequestParam("firstName") String name) {
|
||||||
|
return bookService.updateBook(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/add_genre/{id}")
|
||||||
|
public Book addGenre(@PathVariable Long id, @RequestParam Long genre_id) {
|
||||||
|
return bookService.addGenre(id, genre_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Book deleteBook(@PathVariable Long id) {
|
||||||
|
return bookService.deleteBook(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.example.demo.Books.Controller;
|
||||||
|
|
||||||
|
import com.example.demo.Books.Service.GenreService;
|
||||||
|
import com.example.demo.Books.Models.Genre;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/genre")
|
||||||
|
public class GenreController {
|
||||||
|
private final GenreService genreService;
|
||||||
|
|
||||||
|
public GenreController(GenreService genreService) {
|
||||||
|
this.genreService = genreService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public Genre getGenre(@PathVariable Long id) {
|
||||||
|
return genreService.findGenre(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public List<Genre> getGenres() {
|
||||||
|
return genreService.findAllGenres();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/")
|
||||||
|
public Genre createGenre(@RequestParam("name") String name) {
|
||||||
|
return genreService.addGenre(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/{id}")
|
||||||
|
public Genre updateGenre(@PathVariable Long id,
|
||||||
|
@RequestParam("name") String name) {
|
||||||
|
return genreService.updateGenre(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public Genre deleteGenre(@PathVariable Long id) {
|
||||||
|
return genreService.deleteGenre(id);
|
||||||
|
}
|
||||||
|
}
|
61
src/main/java/com/example/demo/Books/Models/Author.java
Normal file
61
src/main/java/com/example/demo/Books/Models/Author.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package com.example.demo.Books.Models;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Author {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
|
||||||
|
@ManyToMany(fetch = FetchType.EAGER, mappedBy = "authors")
|
||||||
|
private List<Book> books;
|
||||||
|
|
||||||
|
public Author() {}
|
||||||
|
|
||||||
|
public Author(String name, String surname) {
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Book> getBooks() {
|
||||||
|
return books;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String res = "\nBooks{" +
|
||||||
|
"id: " + id + "," +
|
||||||
|
"name: " + name + "," +
|
||||||
|
"surname: " + name + "," +
|
||||||
|
"books:" + (books == null ? "[]" : books.toString()) + "}"
|
||||||
|
;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
73
src/main/java/com/example/demo/Books/Models/Book.java
Normal file
73
src/main/java/com/example/demo/Books/Models/Book.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package com.example.demo.Books.Models;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.LazyCollection;
|
||||||
|
import org.hibernate.annotations.LazyCollectionOption;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Book {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ManyToMany
|
||||||
|
@LazyCollection(LazyCollectionOption.FALSE)
|
||||||
|
@JoinTable(name="books_genres",
|
||||||
|
joinColumns = @JoinColumn(name="book_id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name="genre_id")
|
||||||
|
)
|
||||||
|
private List<Genre> genres;
|
||||||
|
|
||||||
|
@ManyToMany(fetch = FetchType.EAGER)
|
||||||
|
@JoinTable(name="authors_books",
|
||||||
|
joinColumns = @JoinColumn(name="book_id"),
|
||||||
|
inverseJoinColumns = @JoinColumn(name="authors_id")
|
||||||
|
)
|
||||||
|
private List<Author> authors;
|
||||||
|
|
||||||
|
public Book() {}
|
||||||
|
|
||||||
|
public Book(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addGenre(Genre g) {
|
||||||
|
genres.add(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAuthor(Author author) {
|
||||||
|
authors.add(author);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Author> getAuthors() {
|
||||||
|
return authors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Genre> getGenres() {
|
||||||
|
return genres;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String res = "\nBook{" +
|
||||||
|
"id: " + id + "," +
|
||||||
|
"name: " + name + "," +
|
||||||
|
"genres:" + (genres == null ? "[]" : genres.toString()) + "}"
|
||||||
|
;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
36
src/main/java/com/example/demo/Books/Models/Genre.java
Normal file
36
src/main/java/com/example/demo/Books/Models/Genre.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.example.demo.Books.Models;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Genre {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public Genre() {}
|
||||||
|
public Genre(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 String toString() {
|
||||||
|
return "Genre{" +
|
||||||
|
"id=" + id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.example.demo.Books.Service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import com.example.demo.Books.Models.Author;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AuthorService {
|
||||||
|
|
||||||
|
@PersistenceContext
|
||||||
|
private EntityManager em;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Author addAuthor(String name, String surname) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Author name is null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
Author author = new Author(name, surname);
|
||||||
|
|
||||||
|
em.persist(author);
|
||||||
|
return em.find(Author.class, author.getId());
|
||||||
|
}
|
||||||
|
@Transactional
|
||||||
|
public Author addAuthor(String name, String surname, String path) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Author name is null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
Author author = new Author(name, surname);
|
||||||
|
em.persist(author);
|
||||||
|
return em.find(Author.class, author.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Author findAuthor(Long id) {
|
||||||
|
final Author author = em.find(Author.class, id);
|
||||||
|
if (author == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Author with id [%s] is not found", id));
|
||||||
|
}
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<Author> findAllAuthors() {
|
||||||
|
return em.createQuery("select f from Author f", Author.class)
|
||||||
|
.getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Author updateAuthor(Long id, String name, String surname) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Author name is null or empty");
|
||||||
|
}
|
||||||
|
final Author currentAuthor = findAuthor(id);
|
||||||
|
if(name != null) currentAuthor.setName(name);
|
||||||
|
if(surname != null) currentAuthor.setSurname(surname);
|
||||||
|
return em.merge(currentAuthor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Author deleteAuthor(Long id) {
|
||||||
|
final Author currentAuthor = findAuthor(id);
|
||||||
|
em.remove(currentAuthor);
|
||||||
|
return currentAuthor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void deleteAllAuthors() {
|
||||||
|
em.createQuery("delete from Author").executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
122
src/main/java/com/example/demo/Books/Service/BookService.java
Normal file
122
src/main/java/com/example/demo/Books/Service/BookService.java
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
package com.example.demo.Books.Service;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import com.example.demo.Books.Models.Author;
|
||||||
|
import com.example.demo.Books.Models.Book;
|
||||||
|
import com.example.demo.Books.Models.Genre;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BookService {
|
||||||
|
|
||||||
|
@PersistenceContext
|
||||||
|
private EntityManager em;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Book addBook(String name) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Book name is null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
Book book = new Book(name);
|
||||||
|
|
||||||
|
em.persist(book);
|
||||||
|
return em.find(Book.class, book.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Book addGenre(Long bookId, Long genreId) {
|
||||||
|
final Book book = em.find(Book.class, bookId);
|
||||||
|
|
||||||
|
if (book == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Book with id [%s] is not found", bookId));
|
||||||
|
}
|
||||||
|
|
||||||
|
final Genre genre = em.find(Genre.class, genreId);
|
||||||
|
if (genre == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", genreId));
|
||||||
|
}
|
||||||
|
|
||||||
|
book.addGenre(genre);
|
||||||
|
return em.merge(book);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Book addAuthor(Long bookId, Long authorId) {
|
||||||
|
final Book book = em.find(Book.class, bookId);
|
||||||
|
if (book == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Book with id [%s] is not found", bookId));
|
||||||
|
}
|
||||||
|
|
||||||
|
final Author author = em.find(Author.class, authorId);
|
||||||
|
if (author == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", authorId));
|
||||||
|
}
|
||||||
|
|
||||||
|
book.addAuthor(author);
|
||||||
|
return em.merge(book);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Book findBook(Long id) {
|
||||||
|
final Book book = em.find(Book.class, id);
|
||||||
|
if (book == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Book with id [%s] is not found", id));
|
||||||
|
}
|
||||||
|
return book;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<Book> findBookByGenre(Long id, Long genreId) {
|
||||||
|
Query query = em.createQuery("select f from Book f " +
|
||||||
|
"join f.genres g " +
|
||||||
|
"where g.id = :genreId", Book.class)
|
||||||
|
.setParameter("genreId", genreId);
|
||||||
|
|
||||||
|
List<Book> result = query.getResultList();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<Book> findBookByAuthor(Long id, String name) {
|
||||||
|
Query query = em.createQuery("select f from Book f " +
|
||||||
|
"join f.authors a " +
|
||||||
|
"where a.name like :authorName", Book.class)
|
||||||
|
.setParameter("authorName", '%' + name + '%');
|
||||||
|
|
||||||
|
List<Book> result = query.getResultList();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<Book> findAllBooks() {
|
||||||
|
return em.createQuery("select f from Book f", Book.class)
|
||||||
|
.getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Book updateBook(Long id, String name) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Book name is null or empty");
|
||||||
|
}
|
||||||
|
final Book currentBook = findBook(id);
|
||||||
|
currentBook.setName(name);
|
||||||
|
return em.merge(currentBook);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Book deleteBook(Long id) {
|
||||||
|
final Book currentBook = findBook(id);
|
||||||
|
em.remove(currentBook);
|
||||||
|
return currentBook;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void deleteAllBooks() {
|
||||||
|
em.createQuery("delete from Book").executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.example.demo.Books.Service;
|
||||||
|
|
||||||
|
import com.example.demo.Books.Models.Genre;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GenreService {
|
||||||
|
|
||||||
|
@PersistenceContext
|
||||||
|
private EntityManager em;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Genre addGenre(String name) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Genre name is null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
Genre genre = new Genre(name);
|
||||||
|
|
||||||
|
em.persist(genre);
|
||||||
|
return em.find(Genre.class, genre.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Genre findGenre(Long id) {
|
||||||
|
final Genre genre = em.find(Genre.class, id);
|
||||||
|
if (genre == null) {
|
||||||
|
throw new EntityNotFoundException(String.format("Genre with id [%s] is not found", id));
|
||||||
|
}
|
||||||
|
return genre;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<Genre> findAllGenres() {
|
||||||
|
return em.createQuery("select g from Genre g", Genre.class)
|
||||||
|
.getResultList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Genre updateGenre(Long id, String name) {
|
||||||
|
if (!StringUtils.hasText(name)) {
|
||||||
|
throw new IllegalArgumentException("Genre name is null or empty");
|
||||||
|
}
|
||||||
|
final Genre currentGenre = findGenre(id);
|
||||||
|
currentGenre.setName(name);
|
||||||
|
return em.merge(currentGenre);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Genre deleteGenre(Long id) {
|
||||||
|
final Genre currentGenre = findGenre(id);
|
||||||
|
em.remove(currentGenre);
|
||||||
|
return currentGenre;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void deleteAllGenres() {
|
||||||
|
em.createQuery("delete from Genre").executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.example.demo.Calculator.Controller;
|
||||||
|
|
||||||
|
import com.example.demo.Calculator.Service.CalculatorService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class CalculatorController {
|
||||||
|
private final CalculatorService calculatorService;
|
||||||
|
|
||||||
|
public CalculatorController(CalculatorService calculatorService){
|
||||||
|
this.calculatorService=calculatorService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/calc1")
|
||||||
|
public Object calc1(@RequestParam(value = "val1", defaultValue = "null") Object val1,
|
||||||
|
@RequestParam(value = "val2", defaultValue = "null") Object val2,
|
||||||
|
@RequestParam(value = "type", defaultValue = "string") String type){
|
||||||
|
return calculatorService.calc1(val1, val2, type);
|
||||||
|
}
|
||||||
|
@GetMapping("/calc2")
|
||||||
|
public Object calc2(@RequestParam(value = "val1", defaultValue = "null") Object val1,
|
||||||
|
@RequestParam(value = "val2", defaultValue = "null") Object val2,
|
||||||
|
@RequestParam(value = "type", defaultValue = "string") String type){
|
||||||
|
return calculatorService.calc2(val1, val2, type);
|
||||||
|
}
|
||||||
|
@GetMapping("/calc3")
|
||||||
|
public Object calc3(@RequestParam(value = "val1", defaultValue = "null") Object val1,
|
||||||
|
@RequestParam(value = "val2", defaultValue = "null") Object val2,
|
||||||
|
@RequestParam(value = "type", defaultValue = "string") String type){
|
||||||
|
return calculatorService.calc3(val1, val2, type);
|
||||||
|
}
|
||||||
|
@GetMapping("/calc4")
|
||||||
|
public Object calc4(@RequestParam(value = "val1", defaultValue = "null") Object val1,
|
||||||
|
@RequestParam(value = "val2", defaultValue = "null") Object val2,
|
||||||
|
@RequestParam(value = "type", defaultValue = "string") String type){
|
||||||
|
return calculatorService.calc4(val1, val2, type);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.example.demo.Calculator.Domain;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@Component(value="numberF")
|
||||||
|
public class CalculatorDoubleArray implements ICalculator<String[]>, InitializingBean, DisposableBean {
|
||||||
|
private final Logger log= LoggerFactory.getLogger(CalculatorDoubleArray.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet(){
|
||||||
|
log.info("calling CalculatorDoubleArray.afterPropertiesSet()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
log.info("calling CalculatorDoubleArray.destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] calc1(String[] val1, String[] val2) {
|
||||||
|
String[] resArr = Stream.concat(Arrays.stream(val1),
|
||||||
|
Arrays.stream(val2))
|
||||||
|
.toArray(String[]::new);;
|
||||||
|
return resArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] calc2(String[] val1, String[] val2) {
|
||||||
|
String[] resArr = Stream.concat(Arrays.stream(val1),
|
||||||
|
Arrays.stream(val2))
|
||||||
|
.toArray(String[]::new);;
|
||||||
|
return resArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] calc3(String[] val1, String[] val2) {
|
||||||
|
String[] resArr = Stream.concat(Arrays.stream(val1),
|
||||||
|
Arrays.stream(val2))
|
||||||
|
.toArray(String[]::new);;
|
||||||
|
return resArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] calc4(String[] val1, String[] val2) {
|
||||||
|
String[] resArr = Stream.concat(Arrays.stream(val1),
|
||||||
|
Arrays.stream(val2))
|
||||||
|
.toArray(String[]::new);;
|
||||||
|
return resArr;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.example.demo.Calculator.Domain;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component(value="number")
|
||||||
|
public class CalculatorNumber implements ICalculator<Integer>, InitializingBean, DisposableBean{
|
||||||
|
private final Logger log=LoggerFactory.getLogger(CalculatorNumber.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet(){
|
||||||
|
log.info("calling CalculatorNumber.afterPropertiesSet()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
log.info("calling CalculatorNumber.destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer calc1(Integer val1, Integer val2) {
|
||||||
|
return val1 * val2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer calc2(Integer val1, Integer val2) {
|
||||||
|
return val1 + val2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer calc3(Integer val1, Integer val2) {
|
||||||
|
return val1 - val2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer calc4(Integer val1, Integer val2) {
|
||||||
|
return val1 / val2;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.example.demo.Calculator.Domain;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component(value="string")
|
||||||
|
public class CalculatorString implements ICalculator<String>, InitializingBean, DisposableBean {
|
||||||
|
private final Logger log= LoggerFactory.getLogger(CalculatorString.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() {
|
||||||
|
log.info("calling CalculatorString.afterPropertiesSet()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
log.info("CalculatorString.destroy()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String calc1(String val1, String val2) {
|
||||||
|
String temp = val1;
|
||||||
|
for (int i = 0; i < Integer.parseInt(val2) - 1; i++) {
|
||||||
|
temp = calc2(temp, val1);
|
||||||
|
}
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String calc2(String val1, String val2) {
|
||||||
|
return val1.concat(val2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String calc3(String val1, String val2) {
|
||||||
|
return val1.replaceFirst(val2, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String calc4(String val1, String val2) {
|
||||||
|
return val1.replaceAll(val2, "");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.example.demo.Calculator.Domain;
|
||||||
|
|
||||||
|
public interface ICalculator<T> {
|
||||||
|
T calc1(T val1, T val2);
|
||||||
|
|
||||||
|
T calc2(T val1, T val2);
|
||||||
|
|
||||||
|
T calc3(T val1, T val2);
|
||||||
|
|
||||||
|
T calc4(T val1, T val2);
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
package com.example.demo.Calculator.Service;
|
||||||
|
|
||||||
|
import com.example.demo.Calculator.Domain.ICalculator;
|
||||||
|
import com.example.demo.Calculator.Domain.CalculatorNumber;
|
||||||
|
import com.example.demo.Calculator.Domain.CalculatorDoubleArray;
|
||||||
|
import com.example.demo.Calculator.Domain.CalculatorString;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CalculatorService {
|
||||||
|
private final ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
public CalculatorService(ApplicationContext applicationContext){
|
||||||
|
this.applicationContext=applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object calc2(Object val1, Object val2, String type){
|
||||||
|
final ICalculator temp=(ICalculator) applicationContext.getBean(type);
|
||||||
|
if (type.equals("string")) {
|
||||||
|
return temp.calc2(val1.toString(), val2.toString());
|
||||||
|
}
|
||||||
|
else if (type.equals("number")) {
|
||||||
|
return temp.calc2(Integer.parseInt(val1.toString()), Integer.parseInt(val2.toString()));
|
||||||
|
}
|
||||||
|
else if (type.equals("numberF")) {
|
||||||
|
return temp.calc2(convToArr(val1) , convToArr(val2));
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object calc1(Object val1, Object val2, String type){
|
||||||
|
final ICalculator temp=(ICalculator) applicationContext.getBean(type);
|
||||||
|
if (type.equals("string")) {
|
||||||
|
return temp.calc1(val1.toString(), val2.toString());
|
||||||
|
}
|
||||||
|
else if (type.equals("number")) {
|
||||||
|
return temp.calc1(Integer.parseInt(val1.toString()), Integer.parseInt(val2.toString()));
|
||||||
|
}
|
||||||
|
else if (type.equals("numberF")) {
|
||||||
|
return temp.calc1(convToArr(val1) , convToArr(val2));
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object calc3(Object val1, Object val2, String type){
|
||||||
|
final ICalculator temp=(ICalculator) applicationContext.getBean(type);
|
||||||
|
if (type.equals("string")) {
|
||||||
|
return temp.calc3(val1.toString(), val2.toString());
|
||||||
|
}
|
||||||
|
else if (type.equals("number")) {
|
||||||
|
return temp.calc3(Integer.parseInt(val1.toString()), Integer.parseInt(val2.toString()));
|
||||||
|
}
|
||||||
|
else if (type.equals("numberF")) {
|
||||||
|
return temp.calc3(convToArr(val1) , convToArr(val2));
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object calc4(Object val1, Object val2, String type){
|
||||||
|
final ICalculator temp=(ICalculator) applicationContext.getBean(type);
|
||||||
|
if (type.equals("string")) {
|
||||||
|
return temp.calc4(val1.toString(), val2.toString());
|
||||||
|
}
|
||||||
|
else if (type.equals("number")) {
|
||||||
|
return temp.calc4(Integer.parseInt(val1.toString()), Integer.parseInt(val2.toString()));
|
||||||
|
}
|
||||||
|
else if (type.equals("numberF")) {
|
||||||
|
return temp.calc4(convToArr(val1) , convToArr(val2));
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] convToArr(Object arr){
|
||||||
|
return Arrays.stream(arr.toString().split("[\\(\\)\\,\\[\\] \\!\\?\\:\\;]")).filter(e -> e.trim().length()>0).toArray(String[]::new);
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@ public class DemoApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/hello")
|
/*@GetMapping("/hello")
|
||||||
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
|
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||||
return String.format("Hello %s!", name);
|
return String.format("Hello %s!", name);
|
||||||
}
|
}
|
||||||
@ -60,5 +60,5 @@ public class DemoApplication {
|
|||||||
} else {
|
} else {
|
||||||
return calc4(val1 - 1) + calc4(val1 - 2);
|
return calc4(val1 - 1) + calc4(val1 - 2);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
13
src/main/java/com/example/demo/WebConfig.java
Normal file
13
src/main/java/com/example/demo/WebConfig.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
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 WebConfig implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry){
|
||||||
|
registry.addMapping("/**").allowedMethods("*");
|
||||||
|
}
|
||||||
|
}
|
@ -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,13 +1,109 @@
|
|||||||
package com.example.demo;
|
package com.example.demo;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import com.example.demo.Calculator.Service.CalculatorService;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class DemoApplicationTests {
|
class DemoApplicationTests {
|
||||||
|
@Autowired
|
||||||
|
CalculatorService calculatorService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void contextLoads() {
|
void testCalculatorNumberCalc2() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc2(val1, val2, "number");
|
||||||
|
Assertions.assertEquals("110", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorNumberCalc3() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc3(val1, val2, "number");
|
||||||
|
Assertions.assertEquals("90", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorNumberCalc1() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc1(val1, val2, "number");
|
||||||
|
Assertions.assertEquals("1000", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorNumberCalc4() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc4(val1, val2, "number");
|
||||||
|
Assertions.assertEquals("10", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorStringCalc2() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc2(val1.toString(), val2.toString(), "string");
|
||||||
|
Assertions.assertEquals("10010", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorStringCalc3() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc3(val1.toString(), val2.toString(), "string");
|
||||||
|
Assertions.assertEquals("0", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorStringCalc1() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc1(val1.toString(), val2.toString(), "string");
|
||||||
|
Assertions.assertEquals("100100100100100100100100100100", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorStringCalc4() {
|
||||||
|
Object val1 = 100;
|
||||||
|
Object val2 = 10;
|
||||||
|
final Object result = calculatorService.calc4(val1.toString(), val2.toString(), "string");
|
||||||
|
Assertions.assertEquals("0", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorFloatNumberCalc2() {
|
||||||
|
Object val1 = 100.10;
|
||||||
|
Object val2 = 10.10;
|
||||||
|
final Object result = calculatorService.calc2(val1, val2, "numberF");
|
||||||
|
Assertions.assertEquals("110.20", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorFloatNumberCalc3() {
|
||||||
|
Object val1 = 100.10;
|
||||||
|
Object val2 = 10.10;
|
||||||
|
final Object result = calculatorService.calc3(val1, val2, "numberF");
|
||||||
|
Assertions.assertEquals("90", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorFloatNumberCalc1() {
|
||||||
|
Object val1 = 100.10;
|
||||||
|
Object val2 = 10.10;
|
||||||
|
final Object result = calculatorService.calc1(val1, val2, "numberF");
|
||||||
|
Assertions.assertEquals("1011.01", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCalculatorFloatNumberCalc4() {
|
||||||
|
Object val1 = 10.5;
|
||||||
|
Object val2 = 2;
|
||||||
|
final Object result = calculatorService.calc4(val1, val2, "numberF");
|
||||||
|
Assertions.assertEquals("5.25", result);
|
||||||
|
}
|
||||||
}
|
}
|
92
src/test/java/com/example/demo/JpaAuthorsTest.java
Normal file
92
src/test/java/com/example/demo/JpaAuthorsTest.java
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
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 com.example.demo.Books.Models.Author;
|
||||||
|
import com.example.demo.Books.Models.Book;
|
||||||
|
import com.example.demo.Books.Models.Genre;
|
||||||
|
import com.example.demo.Books.Service.AuthorService;
|
||||||
|
import com.example.demo.Books.Service.BookService;
|
||||||
|
import com.example.demo.Books.Service.GenreService;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
public class JpaAuthorsTest {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(JpaBooksTest.class);
|
||||||
|
@Autowired
|
||||||
|
BookService bookService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AuthorService authorService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testBookCreate() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
log.info(author.toString());
|
||||||
|
Assertions.assertNotNull(author.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testBookReadNotFound() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
Assertions.assertThrows(EntityNotFoundException.class, () -> authorService.findAuthor(-1L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findBook() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
log.info(author.toString());
|
||||||
|
final Author findAuthor = authorService.findAuthor(author.getId());
|
||||||
|
log.info(findAuthor.toString());
|
||||||
|
Assertions.assertEquals(author.toString(), findAuthor.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testReadAll() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
log.info(author.toString());
|
||||||
|
final List<Author> authors = authorService.findAllAuthors();
|
||||||
|
Assertions.assertEquals(authors.size(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateAuthor() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
authorService.updateAuthor(author.getId(), "Alexei", null);
|
||||||
|
final Author findAuthor = authorService.findAuthor(author.getId());
|
||||||
|
log.info(findAuthor.toString());
|
||||||
|
Assertions.assertEquals(findAuthor.getName() + " " + findAuthor.getSurname(), "Alexei Ivanov");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteAuthor() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
log.info(author.toString());
|
||||||
|
authorService.deleteAuthor(author.getId());
|
||||||
|
Assertions.assertThrows(EntityNotFoundException.class, () -> authorService.findAuthor(author.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void addBook() {
|
||||||
|
authorService.deleteAllAuthors();
|
||||||
|
bookService.findAllBooks();
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
|
||||||
|
bookService.addAuthor(book.getId(), author.getId());
|
||||||
|
|
||||||
|
final Author findAuthor = authorService.findAuthor(author.getId());
|
||||||
|
Assertions.assertEquals(findAuthor.getBooks().get(0).getId(), book.getId());
|
||||||
|
}
|
||||||
|
}
|
139
src/test/java/com/example/demo/JpaBooksTest.java
Normal file
139
src/test/java/com/example/demo/JpaBooksTest.java
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
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 com.example.demo.Books.Models.Author;
|
||||||
|
import com.example.demo.Books.Models.Book;
|
||||||
|
import com.example.demo.Books.Models.Genre;
|
||||||
|
import com.example.demo.Books.Service.AuthorService;
|
||||||
|
import com.example.demo.Books.Service.BookService;
|
||||||
|
import com.example.demo.Books.Service.GenreService;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
public class JpaBooksTest {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(JpaBooksTest.class);
|
||||||
|
@Autowired
|
||||||
|
BookService bookService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
GenreService genreService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AuthorService authorService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testBookCreate() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
log.info(book.toString());
|
||||||
|
Assertions.assertNotNull(book.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testBookReadNotFound() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
Assertions.assertThrows(EntityNotFoundException.class, () -> bookService.findBook(-1L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findBook() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
log.info(book.toString());
|
||||||
|
final Book findBook = bookService.findBook(book.getId());
|
||||||
|
log.info(findBook.toString());
|
||||||
|
Assertions.assertEquals(book.toString(), findBook.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateBook() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
bookService.updateBook(book.getId(), "book 2");
|
||||||
|
final Book findBook = bookService.findBook(book.getId());
|
||||||
|
log.info(findBook.toString());
|
||||||
|
Assertions.assertEquals(findBook.getName(), "book 2");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testReadAll() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
log.info(book.toString());
|
||||||
|
final List<Book> books = bookService.findAllBooks();
|
||||||
|
Assertions.assertEquals(books.size(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteBook() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
log.info(book.toString());
|
||||||
|
bookService.deleteBook(book.getId());
|
||||||
|
Assertions.assertThrows(EntityNotFoundException.class, () -> bookService.findBook(book.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findBooksByGenres() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
bookService.addBook("book 2");
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
|
||||||
|
bookService.addGenre(book.getId(), genre.getId());
|
||||||
|
|
||||||
|
final List<Book> books = bookService.findBookByGenre(book.getId(), genre.getId());
|
||||||
|
Assertions.assertEquals(books.size(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findBooksByActor() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
final Book book2 = bookService.addBook("book 2");
|
||||||
|
bookService.addBook("book 3");
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
final Author author2 = authorService.addAuthor("Alexei", "Ivanov");
|
||||||
|
|
||||||
|
bookService.addAuthor(book.getId(), author.getId());
|
||||||
|
bookService.addAuthor(book2.getId(), author2.getId());
|
||||||
|
|
||||||
|
final List<Book> books = bookService.findBookByAuthor(book.getId(), "Alexei");
|
||||||
|
Assertions.assertEquals(books.size(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void addGenre() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
|
||||||
|
bookService.addGenre(book.getId(), genre.getId());
|
||||||
|
|
||||||
|
final Book findBook = bookService.findBook(book.getId());
|
||||||
|
Assertions.assertEquals(findBook.getGenres().get(0).toString(), genre.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void addAuthor() {
|
||||||
|
bookService.deleteAllBooks();
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Book book = bookService.addBook("book");
|
||||||
|
final Author author = authorService.addAuthor("Ivan", "Ivanov");
|
||||||
|
|
||||||
|
bookService.addAuthor(book.getId(), author.getId());
|
||||||
|
|
||||||
|
final Book findBook = bookService.findBook(book.getId());
|
||||||
|
Assertions.assertEquals(findBook.getAuthors().get(0).getId(), author.getId());
|
||||||
|
}
|
||||||
|
}
|
76
src/test/java/com/example/demo/JpaGenresTest.java
Normal file
76
src/test/java/com/example/demo/JpaGenresTest.java
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
package com.example.demo;
|
||||||
|
|
||||||
|
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 com.example.demo.Books.Models.Genre;
|
||||||
|
import com.example.demo.Books.Service.BookService;
|
||||||
|
import com.example.demo.Books.Service.GenreService;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
public class JpaGenresTest {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(JpaGenresTest.class);
|
||||||
|
@Autowired
|
||||||
|
BookService bookService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
GenreService genreService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGenreCreate() {
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
log.info(genre.toString());
|
||||||
|
Assertions.assertNotNull(genre.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGenreReadNotFound() {
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
Assertions.assertThrows(EntityNotFoundException.class, () -> genreService.findGenre(-1L));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findGenre() {
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
log.info(genre.toString());
|
||||||
|
final Genre findGenre = genreService.findGenre(genre.getId());
|
||||||
|
log.info(findGenre.toString());
|
||||||
|
Assertions.assertEquals(genre.toString(), findGenre.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testReadAll() {
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
log.info(genre.toString());
|
||||||
|
final List<Genre> genres = genreService.findAllGenres();
|
||||||
|
Assertions.assertEquals(genres.size(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void updateGenre() {
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
genreService.updateGenre(genre.getId(), "Roman");
|
||||||
|
final Genre findGenre = genreService.findGenre(genre.getId());
|
||||||
|
log.info(findGenre.toString());
|
||||||
|
Assertions.assertEquals(findGenre.getName(), "Roman");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deleteGenre() {
|
||||||
|
genreService.deleteAllGenres();
|
||||||
|
final Genre genre = genreService.addGenre("Comedy");
|
||||||
|
log.info(genre.toString());
|
||||||
|
genreService.deleteGenre(genre.getId());
|
||||||
|
Assertions.assertThrows(EntityNotFoundException.class, () -> bookService.findBook(genre.getId()));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user