Revize 217cf731
Přidáno uživatelem Jakub Šmíd před téměř 3 roky(ů)
backend/src/main/java/cz/zcu/kiv/backendapi/bibliography/Bibliography.java | ||
---|---|---|
25 | 25 |
@Id |
26 | 26 |
private String source; |
27 | 27 |
|
28 |
/** |
|
29 |
* Catalog item |
|
30 |
*/ |
|
28 | 31 |
@ManyToOne(fetch = FetchType.LAZY) |
29 | 32 |
@Id |
30 | 33 |
@JoinColumn(name = "catalog_item_id") |
backend/src/main/java/cz/zcu/kiv/backendapi/catalog/CatalogItem.java | ||
---|---|---|
63 | 63 |
private String description = ""; |
64 | 64 |
|
65 | 65 |
/** |
66 |
* Bibliography
|
|
66 |
* Set of bibliography
|
|
67 | 67 |
*/ |
68 | 68 |
@OneToMany(mappedBy = "catalogItem", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) |
69 | 69 |
@LazyCollection(LazyCollectionOption.FALSE) |
... | ... | |
72 | 72 |
private Set<Bibliography> bibliography = new LinkedHashSet<>(0); |
73 | 73 |
|
74 | 74 |
/** |
75 |
* Countries
|
|
75 |
* Set of countries
|
|
76 | 76 |
*/ |
77 | 77 |
@OneToMany(mappedBy = "catalogItem", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) |
78 | 78 |
@LazyCollection(LazyCollectionOption.FALSE) |
... | ... | |
81 | 81 |
private Set<Country> countries = new LinkedHashSet<>(0); |
82 | 82 |
|
83 | 83 |
/** |
84 |
* Written forms
|
|
84 |
* Set of written forms
|
|
85 | 85 |
*/ |
86 | 86 |
@OneToMany(mappedBy = "catalogItem", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) |
87 | 87 |
@LazyCollection(LazyCollectionOption.FALSE) |
... | ... | |
90 | 90 |
private Set<WrittenForm> writtenForms = new LinkedHashSet<>(0); |
91 | 91 |
|
92 | 92 |
/** |
93 |
* All names
|
|
93 |
* Set of all names
|
|
94 | 94 |
*/ |
95 | 95 |
@OneToMany(mappedBy = "catalogItem", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) |
96 | 96 |
@LazyCollection(LazyCollectionOption.FALSE) |
... | ... | |
99 | 99 |
private Set<CatalogItemName> allNames = new LinkedHashSet<>(0); |
100 | 100 |
|
101 | 101 |
/** |
102 |
* Set of user roles - many-to-many relationship
|
|
102 |
* Set of types - many-to-many relationship
|
|
103 | 103 |
*/ |
104 | 104 |
@ManyToMany(fetch = FetchType.EAGER) |
105 | 105 |
@Fetch(FetchMode.SUBSELECT) |
backend/src/main/java/cz/zcu/kiv/backendapi/config/CorsConfig.java | ||
---|---|---|
17 | 17 |
public void addCorsMappings(CorsRegistry registry) { |
18 | 18 |
registry.addMapping("/**") |
19 | 19 |
.allowedOrigins("*") |
20 |
.allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name(), HttpMethod.PUT.name(), HttpMethod.PATCH.name()); |
|
20 |
.allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.DELETE.name(), |
|
21 |
HttpMethod.PUT.name(), HttpMethod.PATCH.name()); |
|
21 | 22 |
} |
22 | 23 |
} |
backend/src/main/java/cz/zcu/kiv/backendapi/country/Country.java | ||
---|---|---|
25 | 25 |
@Id |
26 | 26 |
private String name; |
27 | 27 |
|
28 |
/** |
|
29 |
* Catalog item |
|
30 |
*/ |
|
28 | 31 |
@ManyToOne(fetch = FetchType.LAZY) |
29 | 32 |
@Id |
30 | 33 |
@JoinColumn(name = "catalog_item_id") |
backend/src/main/java/cz/zcu/kiv/backendapi/exception/ApiExceptionHandler.java | ||
---|---|---|
8 | 8 |
import org.springframework.web.bind.annotation.ControllerAdvice; |
9 | 9 |
import org.springframework.web.bind.annotation.ExceptionHandler; |
10 | 10 |
|
11 |
/** |
|
12 |
* Exception handler |
|
13 |
*/ |
|
11 | 14 |
@ControllerAdvice |
12 | 15 |
public class ApiExceptionHandler { |
13 | 16 |
|
backend/src/main/java/cz/zcu/kiv/backendapi/exception/ApiRequestException.java | ||
---|---|---|
3 | 3 |
import lombok.Getter; |
4 | 4 |
import org.springframework.http.HttpStatus; |
5 | 5 |
|
6 |
/** |
|
7 |
* Class representing custom API request exception |
|
8 |
*/ |
|
6 | 9 |
@Getter |
7 | 10 |
public class ApiRequestException extends RuntimeException { |
11 |
/** |
|
12 |
* HTTP status |
|
13 |
*/ |
|
8 | 14 |
private final HttpStatus httpStatus; |
9 | 15 |
|
16 |
/** |
|
17 |
* Creates new API request exception with given message and HTTP status |
|
18 |
* |
|
19 |
* @param message message |
|
20 |
* @param httpStatus HTTP status |
|
21 |
*/ |
|
10 | 22 |
public ApiRequestException(String message, HttpStatus httpStatus) { |
11 | 23 |
super(message); |
12 | 24 |
this.httpStatus = httpStatus; |
backend/src/main/java/cz/zcu/kiv/backendapi/external/ExternalCatalogController.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
private final IExternalCatalogItemService externalCatalogService; |
24 | 24 |
|
25 |
/** |
|
26 |
* Updates external catalog |
|
27 |
* |
|
28 |
* @param file file - should contain CIGS catalog |
|
29 |
*/ |
|
25 | 30 |
@PostMapping("") |
26 | 31 |
@Operation(summary = "updates external catalog") |
27 | 32 |
public void updateCatalog(@RequestParam("file") MultipartFile file) { |
backend/src/main/java/cz/zcu/kiv/backendapi/path/PathController.java | ||
---|---|---|
3 | 3 |
import cz.zcu.kiv.backendapi.catalog.ICatalogItemService; |
4 | 4 |
import io.swagger.v3.oas.annotations.Operation; |
5 | 5 |
import lombok.RequiredArgsConstructor; |
6 |
import org.springframework.web.bind.annotation.GetMapping; |
|
7 | 6 |
import org.springframework.web.bind.annotation.PostMapping; |
8 | 7 |
import org.springframework.web.bind.annotation.RequestBody; |
9 | 8 |
import org.springframework.web.bind.annotation.RequestMapping; |
backend/src/main/java/cz/zcu/kiv/backendapi/validation/EmailValidator.java | ||
---|---|---|
12 | 12 |
/** |
13 | 13 |
* Email string pattern |
14 | 14 |
*/ |
15 |
private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-+]+(.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9]+)*(.[A-Za-z]{2,})$";
|
|
15 |
private static final String EMAIL_PATTERN = "^[_A-Za-z\\d-+]+(.[_A-Za-z\\d-]+)*@[A-Za-z\\d-]+(.[A-Za-z\\d]+)*(.[A-Za-z]{2,})$";
|
|
16 | 16 |
|
17 | 17 |
/** |
18 | 18 |
* Email patter |
backend/src/main/java/cz/zcu/kiv/backendapi/writtenform/WrittenForm.java | ||
---|---|---|
25 | 25 |
@Id |
26 | 26 |
private String form; |
27 | 27 |
|
28 |
/** |
|
29 |
* Catalog item |
|
30 |
*/ |
|
28 | 31 |
@ManyToOne(fetch = FetchType.LAZY) |
29 | 32 |
@Id |
30 | 33 |
@JoinColumn(name = "catalog_item_id") |
backend/src/test/java/cz/zcu/kiv/backendapi/user/UserServiceImplTest.java | ||
---|---|---|
23 | 23 |
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; |
24 | 24 |
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; |
25 | 25 |
import static org.junit.jupiter.api.Assertions.assertTrue; |
26 |
import static org.mockito.ArgumentMatchers.anyString; |
|
27 | 26 |
import static org.mockito.BDDMockito.given; |
28 | 27 |
import static org.mockito.Mockito.*; |
29 | 28 |
|
Také k dispozici: Unified diff
Added missing comments, code refactoring
re #9743