Compare commits

..

6 Commits

27 changed files with 6789 additions and 14 deletions

View File

@ -14,6 +14,13 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'com.h2database:h2:2.1.210'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

BIN
backend/ipLab/data.mv.db Normal file

Binary file not shown.

4804
backend/ipLab/data.trace.db Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
package com.example.ipLab.StoreDataBase.Model;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Entity
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column
private String lastName;
@Column
private String firstName;
@Column
private String middleName;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "customer", cascade = CascadeType.ALL)
private List<Ordered> orders;
public void AddOrdered(Ordered ordered){
this.orders.add(ordered);
if (ordered.getCustomer() != this){
ordered.setCustomer(this);
}
}
public Customer(){}
public Customer(String lastName, String firstName, String middleName){
this.lastName = lastName;
this.firstName = firstName;
this.middleName = middleName;
this.orders = new ArrayList<Ordered>();
}
public Long getId() {
return id;
}
public String getLastName() {
return lastName;
}
public String getMiddleName() {
return middleName;
}
public String getFirstName() {
return firstName;
}
public List<Ordered> getOrders() {
return orders;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setMiddleName(String middleName) {
this.middleName = middleName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Customer customer = (Customer) obj;
return Objects.equals(id, customer.id);
}
@Override
public int hashCode(){
return Objects.hashCode(id);
}
}

View File

@ -0,0 +1,84 @@
package com.example.ipLab.StoreDataBase.Model;
import jakarta.persistence.*;
import java.util.Objects;
@Entity
public class Ordered {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="store_fk")
private Store store;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="customer_fk")
private Customer customer;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name="product_fk")
private Product product;
@Column
private int quantity;
public Ordered(){}
public Ordered(int quantity){
this.quantity = quantity;
}
public Long getId() {
return id;
}
public Store getStore() {
return store;
}
public Customer getCustomer() {
return customer;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
if (!product.getOrders().contains(this)){
product.AddOrdered(this);
}
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public void setStore(Store store) {
this.store = store;
if (!store.getOrders().contains(this)){
store.AddOrdered(this);
}
}
public void setCustomer(Customer customer) {
this.customer = customer;
if (!customer.getOrders().contains(this)){
customer.AddOrdered(this);
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Ordered order = (Ordered) obj;
return Objects.equals(id, order.id);
}
@Override
public int hashCode(){
return Objects.hashCode(id);
}
}

View File

@ -0,0 +1,77 @@
package com.example.ipLab.StoreDataBase.Model;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Entity
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column
private String name;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "store_fk")
private Store store;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "product", cascade = CascadeType.ALL)
private List<Ordered> orders;
public Product(){}
public Product(String name){
this.name = name;
this.orders = new ArrayList<Ordered>();
}
public Product(Store store, String name){
this.store = store;
this.name = name;
this.orders = new ArrayList<Ordered>();
}
public void AddOrdered(Ordered ordered){
this.orders.add(ordered);
if (ordered.getProduct() != this){
ordered.setProduct(this);
}
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public Store getStore() {
return store;
}
public List<Ordered> getOrders() {
return orders;
}
public void setName(String name) {
this.name = name;
}
public void setStore(Store store) {
this.store = store;
if (!store.getProducts().contains(this)){
store.AddProduct(this);
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Product product = (Product) obj;
return Objects.equals(id, product.id);
}
@Override
public int hashCode(){
return Objects.hashCode(id);
}
}

View File

@ -0,0 +1,72 @@
package com.example.ipLab.StoreDataBase.Model;
import com.example.ipLab.StoreDataBase.Service.ProductService;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Entity
public class Store {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column
private String storeName;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "store", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Product> products;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "store", cascade = CascadeType.ALL)
private List<Ordered> orders;
public Store(){}
public Store(String storeName){
this.storeName = storeName;
this.orders = new ArrayList<>();
this.products = new ArrayList<>();
}
public Long getId() {
return id;
}
public String getStoreName() {
return storeName;
}
public List<Ordered> getOrders() {
return orders;
}
public List<Product> getProducts() {
return products;
}
public void AddProduct(Product product){
this.products.add(product);
if (product.getStore() != this){
product.setStore(this);
}
}
public void AddOrdered(Ordered ordered){
this.orders.add(ordered);
if (ordered.getStore() != this){
ordered.setStore(this);
}
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
Store store = (Store) obj;
return Objects.equals(id, store.id);
}
@Override
public int hashCode(){
return Objects.hashCode(id);
}
}

View File

@ -0,0 +1,64 @@
package com.example.ipLab.StoreDataBase.Service;
import com.example.ipLab.StoreDataBase.Model.Customer;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.PersistenceContext;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class CustomerService {
@PersistenceContext
private EntityManager em;
@Transactional
public Customer addCustomer(String customerLastName, String customerFirstName, String customerMiddleName){
if (!StringUtils.hasText(customerLastName) || !StringUtils.hasText(customerFirstName) || !StringUtils.hasText(customerMiddleName)){
throw new IllegalArgumentException("Customer name is null or empty");
}
final Customer customer = new Customer(customerLastName, customerFirstName, customerMiddleName);
em.persist(customer);
return customer;
}
@Transactional()
public Customer getCustomer(Long id){
Customer customer = em.find(Customer.class, id);
if (customer == null){
throw new EntityNotFoundException(String.format("Customer with id = %s isn't found", id));
}
return customer;
}
@Transactional
public List<Customer> getAllCustomers(){
return em.createQuery("SELECT c from Customer c", Customer.class).getResultList();
}
@Transactional
public Customer updateCustomer(Long id, String customerLastName, String customerFirstName, String customerMiddleName){
if (!StringUtils.hasText(customerLastName) || !StringUtils.hasText(customerFirstName) || !StringUtils.hasText(customerMiddleName)){
throw new IllegalArgumentException("Customer name is null or empty");
}
final Customer customer = getCustomer(id);
customer.setLastName(customerLastName);
customer.setFirstName(customerFirstName);
customer.setMiddleName(customerMiddleName);
return em.merge(customer);
}
@Transactional
public Customer deleteCustomer(Long id){
final Customer customer = getCustomer(id);
em.remove(customer);
return customer;
}
@Transactional
public void deleteAllCustomers(){
em.createQuery("delete from Customer");
}
}

View File

@ -0,0 +1,115 @@
package com.example.ipLab.StoreDataBase.Service;
import com.example.ipLab.StoreDataBase.Model.Customer;
import com.example.ipLab.StoreDataBase.Model.Ordered;
import com.example.ipLab.StoreDataBase.Model.Product;
import com.example.ipLab.StoreDataBase.Model.Store;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.PersistenceContext;
import jakarta.transaction.Transactional;
import org.aspectj.weaver.ast.Or;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Service
public class OrderService {
@PersistenceContext
private EntityManager em;
private ProductService productService;
public OrderService(ProductService productService){
this.productService = productService;
}
@Transactional
public Ordered addOrder(Store store, Product product, Customer customer, int quantity){
final Ordered order = new Ordered(quantity);
product.AddOrdered(order);
customer.AddOrdered(order);
store.AddOrdered(order);
em.persist(order);
return order;
}
@Transactional()
public Ordered getOrder(Long id){
Ordered order = em.find(Ordered.class, id);
if (order == null){
throw new EntityNotFoundException(String.format("Ordered with id = %s isn't found", id));
}
return order;
}
@Transactional
public List<Ordered> getOrdersWithProduct(Long productId, int minQuantity, int maxQuantity){
return em.createQuery("SELECT o FROM Ordered o WHERE o.product.id = ?1 AND o.quantity >= ?2 AND o.quantity <= ?3",Ordered.class)
.setParameter(1, productId)
.setParameter(2, minQuantity)
.setParameter(3, maxQuantity)
.getResultList();
}
@Transactional
public List<Ordered> getAllOrders(){
return em.createQuery("SELECT o FROM Ordered o", Ordered.class).getResultList();
}
@Transactional
public Ordered updateOrder(Long id, int quantity){
final Ordered order = getOrder(id);
order.setQuantity(quantity);
return em.merge(order);
}
@Transactional
public Ordered deleteOrder(Long id){
final Ordered order = getOrder(id);
order.getStore().getOrders().remove(order);
order.getCustomer().getOrders().remove(order);
em.remove(order);
return order;
}
@Transactional
public void deleteAllOrders(){
em.createQuery("delete from Ordered").executeUpdate();
}
//product section
@Transactional()
public Product getProduct(Long productId, Long orderId){
Ordered order = em.find(Ordered.class, orderId);
if (order != null) {
return order.getProduct();
}
else throw new EntityNotFoundException(String.format("Product with id = %s isn't found", productId));
}
@Transactional
public Product updateProduct(Long orderId, Long productId, String productName){
if (!StringUtils.hasText(productName)){
throw new IllegalArgumentException("Product name is null or empty");
}
final Product product = getProduct(productId, orderId);
if (product == null){
throw new EntityNotFoundException(String.format("Product with id = %s isn't found", productId));
}
product.setName(productName);
return em.merge(product);
}
@Transactional
public Product deleteProduct(Long orderId, Long productId){
final Product product = getProduct(productId, orderId);
if (product == null){
throw new EntityNotFoundException(String.format("Product with id = %s isn't found", productId));
}
var order = product.getOrders().stream().filter(or -> or.getId() == orderId).findFirst();
if (order.isPresent()) order.get().setProduct(null);
else throw new EntityNotFoundException(String.format("Order with id = %s isn't found", orderId));
return product;
}
}

View File

@ -0,0 +1,72 @@
package com.example.ipLab.StoreDataBase.Service;
import com.example.ipLab.StoreDataBase.Model.Customer;
import com.example.ipLab.StoreDataBase.Model.Ordered;
import com.example.ipLab.StoreDataBase.Model.Product;
import com.example.ipLab.StoreDataBase.Model.Store;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.PersistenceContext;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class ProductService {
@PersistenceContext
private EntityManager em;
@Transactional
public Product addProduct(String productName){
if (!StringUtils.hasText(productName)){
throw new IllegalArgumentException("Product name is null or empty");
}
final Product product = new Product(productName);
em.persist(product);
return product;
}
@Transactional()
public Product getProduct(Long id){
Product product = em.find(Product.class, id);
if (product == null){
throw new EntityNotFoundException(String.format("Product with id = %s isn't found", id));
}
em.persist(product);
return product;
}
@Transactional
public List<Product> getAllProducts(){
return em.createQuery("SELECT p FROM Product p", Product.class).getResultList();
}
@Transactional
public Product updateProduct(Long id, String productName){
if (!StringUtils.hasText(productName)){
throw new IllegalArgumentException("Product name is null or empty");
}
final Product product = getProduct(id);
if (product == null){
throw new EntityNotFoundException(String.format("Product with id = %s isn't found", id));
}
product.setName(productName);
return em.merge(product);
}
@Transactional
public Product deleteProduct(Long id){
final Product product = getProduct(id);
if (product == null){
throw new EntityNotFoundException(String.format("Product with id = %s isn't found", id));
}
Store store = product.getStore();
if (store != null) store.getProducts().remove(product);
em.remove(product);
return product;
}
@Transactional
public void deleteAllProducts(){
em.createQuery("delete from Product");
}
}

View File

@ -0,0 +1,115 @@
package com.example.ipLab.StoreDataBase.Service;
import com.example.ipLab.StoreDataBase.Model.Product;
import com.example.ipLab.StoreDataBase.Model.Store;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.PersistenceContext;
import jakarta.transaction.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class StoreService {
@PersistenceContext
private EntityManager em;
private ProductService productService;
public StoreService(ProductService productService){
this.productService = productService;
}
@Transactional
public Store addStore(String storeName){
if (!StringUtils.hasText(storeName)){
throw new IllegalArgumentException("Store name is null or empty");
}
final Store store = new Store(storeName);
em.persist(store);
return store;
}
@Transactional()
public Store getStore(Long id){
Store store = em.find(Store.class, id);
if (store == null){
throw new EntityNotFoundException(String.format("Store with id = %s isn't found", id));
}
return store;
}
@Transactional
public List<Store> getAllStores(){
return em.createQuery("SELECT s FROM Store s", Store.class).getResultList();
}
@Transactional
public Store updateStore(Long id, String storeName){
if (!StringUtils.hasText(storeName)){
throw new IllegalArgumentException("Store name is null or empty");
}
final Store store = getStore(id);
store.setStoreName(storeName);
return em.merge(store);
}
@Transactional
public Store deleteStore(Long id){
final Store store = getStore(id);
em.remove(store);
return store;
}
@Transactional
public void deleteAllStores(){
em.createQuery("delete from Store");
}
//product section
@Transactional
public Product addProduct(Long storeId, Long productId){
Store store = getStore(storeId);
Product product = productService.getProduct(productId);
store.AddProduct(product);
em.persist(store);
return product;
}
@Transactional()
public Product getProductFromStore(Long productId, Long storeId){
Store store = getStore(storeId);
var prFind = store.getProducts().stream().filter(pr -> pr.getId().equals(productId)).findFirst();
if (prFind.isPresent()) {
return prFind.get();
}
else throw new EntityNotFoundException(String.format("Product with id = %s isn't found in store with id = %s", productId, storeId));
}
@Transactional
public List<Product> getAllProductsFromStore(Long storeId) {
Store store = getStore(storeId);
return store.getProducts();
}
@Transactional
public Product deleteProductFromStore(Long storeId, Long productId){
Store store = getStore(storeId);
Product product = getProductFromStore(productId, storeId);
store.getProducts().remove(product);
em.remove(product);
return product;
}
@Transactional
public void deleteAllProducts(Long storeId){
Store store = getStore(storeId);
List<Product> storeProducts = store.getProducts();
for (Product pr:
storeProducts) {
pr.setStore(null);
store.getProducts().remove(pr);
em.remove(pr);
}
}
}

View File

@ -0,0 +1,23 @@
package com.example.ipLab.TypesCalc.Configuration;
import com.example.ipLab.TypesCalc.domen.TypeCalcInteger;
import com.example.ipLab.TypesCalc.domen.TypeCalcString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class CalcConfiguration {
private final Logger log = LoggerFactory.getLogger(CalcConfiguration.class);
@Bean(value="int")
public TypeCalcInteger createTypeCalcInteger(){
return new TypeCalcInteger();
}
@Bean(value="string")
public TypeCalcString createTypeCalcString(){
return new TypeCalcString();
}
}

View File

@ -0,0 +1,33 @@
package com.example.ipLab.TypesCalc.Service;
import com.example.ipLab.TypesCalc.domen.TypeCalc;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
@Service
public class CalcService {
private final ApplicationContext applicationContext;
public CalcService(ApplicationContext applicationContext){this.applicationContext = applicationContext;}
public Object Sum(Object obj1, Object obj2, String type){
final TypeCalc typeCalculator = (TypeCalc) applicationContext.getBean(type);
if (type.startsWith("int")) return typeCalculator.Sum(Integer.parseInt(obj1.toString()), Integer.parseInt(obj2.toString()));
return typeCalculator.Sum(obj1, obj2);
}
public Object Dif(Object obj1, Object obj2, String type){
final TypeCalc typeCalculator = (TypeCalc) applicationContext.getBean(type);
if (type.startsWith("int")) return typeCalculator.Dif(Integer.parseInt(obj1.toString()), Integer.parseInt(obj2.toString()));
return typeCalculator.Dif(obj1, obj2);
}
public Object Multiply(Object obj1, Object obj2, String type){
final TypeCalc typeCalculator = (TypeCalc) applicationContext.getBean(type);
if (type.startsWith("int")) return typeCalculator.Multiply(Integer.parseInt(obj1.toString()), Integer.parseInt(obj2.toString()));
return typeCalculator.Multiply(obj1, obj2);
}
public Object Div(Object obj1, Object obj2, String type){
final TypeCalc typeCalculator = (TypeCalc) applicationContext.getBean(type);
if (type.startsWith("int")) return typeCalculator.Div(Integer.parseInt(obj1.toString()), Integer.parseInt(obj2.toString()));
return typeCalculator.Div(obj1, obj2);
}
}

View File

@ -0,0 +1,41 @@
package com.example.ipLab.TypesCalc.controller;
import com.example.ipLab.TypesCalc.Service.CalcService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TypeCalcController {
private final CalcService calcService;
public TypeCalcController(CalcService calcService) {this.calcService = calcService;}
@GetMapping("/CalcSum")
public Object calcSum(@RequestParam(value = "obj1", defaultValue = "null objects") Object obj1,
@RequestParam(value = "obj2", defaultValue = "provided") Object obj2,
@RequestParam(value = "type", defaultValue = "string") String type){
return calcService.Sum(obj1, obj2, type);
}
@GetMapping("/CalcDif")
public Object calcDif(@RequestParam(value = "obj1", defaultValue = "null objects") Object obj1,
@RequestParam(value = "obj2", defaultValue = "provided") Object obj2,
@RequestParam(value = "type", defaultValue = "string") String type){
return calcService.Dif(obj1, obj2, type);
}
@GetMapping("/CalcMultiply")
public Object calcMultiply(@RequestParam(value = "obj1", defaultValue = "null objects") Object obj1,
@RequestParam(value = "obj2", defaultValue = "provided") Object obj2,
@RequestParam(value = "type", defaultValue = "string") String type){
return calcService.Multiply(obj1, obj2, type);
}
@GetMapping("/CalcDiv")
public Object calcDiv(@RequestParam(value = "obj1", defaultValue = "null objects") Object obj1,
@RequestParam(value = "obj2", defaultValue = "provided") Object obj2,
@RequestParam(value = "type", defaultValue = "string") String type){
return calcService.Div(obj1, obj2, type);
}
}

View File

@ -0,0 +1,8 @@
package com.example.ipLab.TypesCalc.domen;
public interface TypeCalc<T> {
T Sum(T obj1, T obj2);
T Dif(T obj1, T obj2);
T Multiply(T obj1, T obj2);
T Div(T obj1, T obj2);
}

View File

@ -0,0 +1,30 @@
package com.example.ipLab.TypesCalc.domen;
import org.springframework.stereotype.Component;
public class TypeCalcInteger implements TypeCalc<Integer>{
@Override
public Integer Sum(Integer num1, Integer num2) {
return num1 + num2;
}
@Override
public Integer Dif(Integer num1, Integer num2) {
return num1 - num2;
}
@Override
public Integer Multiply(Integer num1, Integer num2) {
return num1 * num2;
}
@Override
public Integer Div(Integer num1, Integer num2) {
try {
return num1 / num2;
}
catch (ArithmeticException ex){
return 0;
}
}
}

View File

@ -0,0 +1,57 @@
package com.example.ipLab.TypesCalc.domen;
import org.springframework.stereotype.Component;
public class TypeCalcString implements TypeCalc<String> {
@Override
public String Sum(String s1, String s2) {
return s1 + s2;
}
@Override
public String Dif(String s1, String s2) {
String res = "";
for (char c : s1.toCharArray()){
boolean foundInOther = false;
for (int i = 0; i < s2.length(); i++){
if (c == s2.charAt(i)) {
foundInOther = true;
break;
}
}
if (!foundInOther) res += c;
}
return res;
}
@Override
public String Multiply(String s1, String s2) {
String res = "";
for (char c : s1.toCharArray()){
boolean foundInOther = false;
for (int i = 0; i < s2.length(); i++){
if (c == s2.charAt(i)) {
foundInOther = true;
break;
}
}
if (foundInOther) res += c;
}
return res;
}
@Override
public String Div(String s1, String s2) {
StringBuilder res = new StringBuilder();
int maxLength = Integer.max(s1.length(), s2.length());
for (int i = 0; i < maxLength; i++){
if (i < s1.length()){
res.append(s1.charAt(i));
}
if (i < s2.length()){
res.append(s2.charAt(i));
}
}
return res.toString();
}
}

View File

@ -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

View File

@ -1,13 +1,72 @@
package com.example.ipLab;
import com.example.ipLab.TypesCalc.Service.CalcService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class IpLabApplicationTests {
@Autowired
CalcService calcService;
@Test
void contextLoads() {
void testIntegerCalcSum() {
final Object res = calcService.Sum(2, 2, "int");
Assertions.assertEquals("4", res.toString());
}
@Test
void testIntegerCalcDif() {
final Object res = calcService.Dif(2, 2, "int");
Assertions.assertEquals("0", res.toString());
}
@Test
void testIntegerCalcMultiply() {
final Object res = calcService.Multiply(2, 3, "int");
Assertions.assertEquals("6", res.toString());
}
@Test
void testIntegerCalcDiv() {
final Object res = calcService.Div(4, 2, "int");
Assertions.assertEquals("2", res.toString());
}
@Test
void testIntegerCalcDivBy0() {
final Object res = calcService.Div(4, 0, "int");
Assertions.assertEquals("0", res.toString());
}
@Test
void testStringCalcSum(){
final Object res = calcService.Sum("2", "2", "string");
Assertions.assertEquals("22", res.toString());
}
@Test
void testStringCalcDif(){
final Object res = calcService.Dif("524", "24", "string");
Assertions.assertEquals("5", res.toString());
}
@Test
void testStringCalcMultiply(){
final Object res = calcService.Multiply("523", "215", "string");
Assertions.assertEquals("52", res.toString());
}
@Test
void testStringCalcDiv(){
final Object res = calcService.Div("135", "24", "string");
Assertions.assertEquals("12345", res.toString());
}
@Test
void testSpeakerErrorWiredInt() {
Assertions.assertThrows(NoSuchBeanDefinitionException.class, () -> calcService.Sum("1", "1", "integer"));
}
}

View File

@ -0,0 +1,158 @@
package com.example.ipLab;
import com.example.ipLab.StoreDataBase.Model.Customer;
import com.example.ipLab.StoreDataBase.Model.Ordered;
import com.example.ipLab.StoreDataBase.Model.Product;
import com.example.ipLab.StoreDataBase.Model.Store;
import com.example.ipLab.StoreDataBase.Service.CustomerService;
import com.example.ipLab.StoreDataBase.Service.OrderService;
import com.example.ipLab.StoreDataBase.Service.ProductService;
import com.example.ipLab.StoreDataBase.Service.StoreService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import java.util.List;
@SpringBootTest
public class JpaTests {
@Autowired
OrderService orderService;
@Autowired
CustomerService customerService;
@Autowired
StoreService storeService;
@Autowired
ProductService productService;
@Test
void testStore(){
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
Store store = storeService.addStore("example");
Assertions.assertEquals("example", store.getStoreName());
Assertions.assertEquals("example", storeService.getStore(store.getId()).getStoreName());
storeService.updateStore(store.getId(), "newName");
Assertions.assertEquals("newName", storeService.getStore(store.getId()).getStoreName());
Assertions.assertEquals("newName", storeService.deleteStore(store.getId()).getStoreName());
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
}
@Test
void testCustomer(){
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
Customer c = customerService.addCustomer("1", "2", "3");
Assertions.assertEquals("2", c.getFirstName());
Assertions.assertEquals("2", customerService.getCustomer(c.getId()).getFirstName());
Assertions.assertEquals("1", customerService.updateCustomer(c.getId(), c.getLastName(), "1", c.getMiddleName()).getFirstName());
Assertions.assertEquals("1", customerService.deleteCustomer(c.getId()).getFirstName());
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
}
@Test
void testProduct(){
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
Store store = storeService.addStore("example");
Assertions.assertEquals("example", store.getStoreName());
Product p = productService.addProduct("product");
Assertions.assertEquals("product", p.getName());
Assertions.assertEquals("product", storeService.addProduct(store.getId(), p.getId()).getName());
Assertions.assertEquals("product", storeService.getProductFromStore(p.getId(), store.getId()).getName());
Assertions.assertEquals("productUpd", productService.updateProduct(p.getId(), "productUpd").getName());
Assertions.assertEquals("productUpd", storeService.deleteProductFromStore(store.getId(), p.getId()).getName());
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
}
@Test
void testOrder(){
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
Store store = storeService.addStore("example");
Assertions.assertEquals("example", store.getStoreName());
Product p = productService.addProduct("product");
storeService.addProduct(store.getId(), p.getId());
Assertions.assertEquals("product", p.getName());
Customer c = customerService.addCustomer("1", "2", "3");
Assertions.assertEquals("2", c.getFirstName());
Ordered order = orderService.addOrder(store, p, c, 5);
Assertions.assertEquals("5", Integer.toString(order.getQuantity()));
Assertions.assertEquals("5", Integer.toString(orderService.getOrder(order.getId()).getQuantity()));
Assertions.assertEquals("6", Integer.toString(orderService.updateOrder(order.getId(), 6).getQuantity()));
Assertions.assertEquals("6", Integer.toString(orderService.deleteOrder(order.getId()).getQuantity()));
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
}
@Test
void FilterOrderTest(){
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
Store store = storeService.addStore("example");
Assertions.assertEquals("example", store.getStoreName());
Product p1 = productService.addProduct("product");
Product p2 = productService.addProduct("product2");
storeService.addProduct(store.getId(), p1.getId());
Assertions.assertEquals("product", p1.getName());
storeService.addProduct(store.getId(), p2.getId());
Assertions.assertEquals("product2", p2.getName());
Customer c = customerService.addCustomer("1", "2", "3");
Assertions.assertEquals("2", c.getFirstName());
Ordered order1 = orderService.addOrder(store, p1, c, 0);
Ordered order2 = orderService.addOrder(store, p2, c, 6);
Ordered order3 = orderService.addOrder(store, p1, c, 2);
Ordered order4 = orderService.addOrder(store, p2, c, 2);
Ordered order5 = orderService.addOrder(store, p1, c, 3);
List<Ordered> expectedResult = new ArrayList<>();
expectedResult.add(order3);
expectedResult.add(order5);
orderService.getAllOrders();
Assertions.assertEquals(expectedResult, orderService.getOrdersWithProduct(p1.getId(), 1, 5));
productService.deleteAllProducts();
orderService.deleteAllOrders();
customerService.deleteAllCustomers();
storeService.deleteAllStores();
}
}

View File

@ -0,0 +1,6 @@
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create-drop

View File

@ -4,7 +4,7 @@
<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>
<script src ="scripts/calc.js"></script>
<script src ="scripts/calcType.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>Calc</title>
@ -12,13 +12,18 @@
</head>
<body class="h-100">
<div class="d-flex flex-column align-content-center flex-wrap">
<div class="input-group p-3">
<input id="numberInput" type="number" class="form-control" placeholder="Введите число..." required>
<button class="btn btn-outline-secondary" onclick="calcSecond()" type="button">^2</button>
<button class="btn btn-outline-secondary" onclick="calcRoot()" type="button"></button>
<button class="btn btn-outline-secondary" onclick="calcFact()" type="button">!</button>
<button class="btn btn-outline-secondary" onclick="calcDigit()" type="button">Сумма цифр</button>
</div>
<div class="input-group p-3">
<input type="text" class="form-control" id="obj1Input" placeholder="Введите объект 1...">
<input type="text" class="form-control" id="obj2Input" placeholder="Введите объект 2...">
<select class="custom-select" id="typeSelect">
<option selected value="int">Числа</option>
<option value="string">Строки</option>
</select>
<button class="btn btn-outline-secondary" onclick="calcSum()" type="button">+</button>
<button class="btn btn-outline-secondary" onclick="calcDif()" type="button">-</button>
<button class="btn btn-outline-secondary" onclick="calcMultiply()" type="button">*</button>
<button class="btn btn-outline-secondary" onclick="calcDiv()" type="button">/</button>
</div>
<a id="responseField" class="m-3"></a>
</div>
</body>

818
frontend/package-lock.json generated Normal file
View File

@ -0,0 +1,818 @@
{
"name": "ip_lab",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ip_lab",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@fortawesome/fontawesome-free": "6.2.0",
"bootstrap": "5.2.1"
},
"devDependencies": {
"http-server": "14.1.1"
}
},
"node_modules/@fortawesome/fontawesome-free": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ==",
"hasInstallScript": true,
"engines": {
"node": ">=6"
}
},
"node_modules/@popperjs/core": {
"version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
"peer": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/async": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"dev": true,
"dependencies": {
"lodash": "^4.17.14"
}
},
"node_modules/basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
"dev": true,
"dependencies": {
"safe-buffer": "5.1.2"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/bootstrap": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.1.tgz",
"integrity": "sha512-UQi3v2NpVPEi1n35dmRRzBJFlgvWHYwyem6yHhuT6afYF+sziEt46McRbT//kVXZ7b1YUYEVGdXEH74Nx3xzGA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/twbs"
},
{
"type": "opencollective",
"url": "https://opencollective.com/bootstrap"
}
],
"peerDependencies": {
"@popperjs/core": "^2.11.6"
}
},
"node_modules/call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
"integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==",
"dev": true,
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"dev": true
},
"node_modules/follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"node_modules/get-intrinsic": {
"version": "1.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/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/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dev": true,
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/requires-port": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
"dev": true
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
},
"node_modules/secure-compare": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
"integrity": "sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==",
"dev": true
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
"dev": true,
"dependencies": {
"call-bind": "^1.0.0",
"get-intrinsic": "^1.0.2",
"object-inspect": "^1.9.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/union": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
"integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
"dev": true,
"dependencies": {
"qs": "^6.4.0"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/url-join": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
"integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==",
"dev": true
},
"node_modules/whatwg-encoding": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
"integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
"dev": true,
"dependencies": {
"iconv-lite": "0.6.3"
},
"engines": {
"node": ">=12"
}
}
},
"dependencies": {
"@fortawesome/fontawesome-free": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.0.tgz",
"integrity": "sha512-CNR7qRIfCwWHNN7FnKUniva94edPdyQzil/zCwk3v6k4R6rR2Fr8i4s3PM7n/lyfPA6Zfko9z5WDzFxG9SW1uQ=="
},
"@popperjs/core": {
"version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
"peer": true
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"async": {
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"dev": true,
"requires": {
"lodash": "^4.17.14"
}
},
"basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
"dev": true,
"requires": {
"safe-buffer": "5.1.2"
}
},
"bootstrap": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.1.tgz",
"integrity": "sha512-UQi3v2NpVPEi1n35dmRRzBJFlgvWHYwyem6yHhuT6afYF+sziEt46McRbT//kVXZ7b1YUYEVGdXEH74Nx3xzGA==",
"requires": {}
},
"call-bind": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
"integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"get-intrinsic": "^1.0.2"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"corser": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
"integrity": "sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ==",
"dev": true
},
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"dev": true
},
"follow-redirects": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
"dev": true
},
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true
},
"get-intrinsic": {
"version": "1.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
},
"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"
}
},
"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"
}
}
}
}

View File

@ -1,4 +1,4 @@
function calcSecond(){
function calcSum(){
var num = document.getElementById("numberInput").value;
fetch("http://127.0.0.1:8080/second?num=" + num)
.then(function(response) {
@ -13,7 +13,7 @@ function calcSecond(){
.catch(err => {document.getElementById("responseField").innerHTML = "Ошибка: " + err;})
}
function calcRoot(){
function calcDif(){
var num = document.getElementById("numberInput").value;
if (num < 0) {
document.getElementById("responseField").innerHTML = "Результат: введите НЕОТРИЦАТЕЛЬНОЕ число";
@ -33,7 +33,7 @@ function calcRoot(){
.catch(err => {document.getElementById("responseField").innerHTML = "Ошибка: " + err;})
}
function calcFact(){
function calcMultiply(){
var num = document.getElementById("numberInput").value;
if (num < 0) {
document.getElementById("responseField").innerHTML = "Результат: введите НЕОТРИЦАТЕЛЬНОЕ число";
@ -53,7 +53,7 @@ function calcFact(){
.catch(err => {document.getElementById("responseField").innerHTML = "Ошибка: " + err;})
}
function calcDigit(){
function calcDiv(){
var num = document.getElementById("numberInput").value;
fetch("http://127.0.0.1:8080/digit?num=" + num)
.then((response) => {

View File

@ -0,0 +1,36 @@
function calcSum(){
fetchServer("CalcSum");
}
function calcDif(){
fetchServer("CalcDif");
}
function calcMultiply(){
fetchServer("CalcMultiply");
}
function calcDiv(){
fetchServer("CalcDiv");
}
function fetchServer(adress){
var obj1 = document.getElementById("obj1Input").value;
var obj2 = document.getElementById("obj2Input").value;
var type = document.getElementById("typeSelect").value;
if (type == "int" && (isNaN(obj1) || isNaN(obj2))){
document.getElementById("responseField").innerHTML = "Ошибка: введите число для операций с числами или измените тип данных!";
return;
}
fetch("http://127.0.0.1:8080/" + adress + "?obj1=" + obj1 + "&obj2=" + obj2 + "&type=" + type)
.then(function(response) {
if (!response.ok){
return response.text().then(text => {throw new Error(text)});
}
return response.text();
})
.then((response) => {
document.getElementById("responseField").innerHTML = "Результат: " + response;
})
.catch(err => {document.getElementById("responseField").innerHTML = "Ошибка: " + err;})
}