Skip to content

Commit 49f4965

Browse files
authored
Merge pull request #1 from Linkshegelianer/dev
Dev
2 parents f532186 + 8fd1cb9 commit 49f4965

27 files changed

+248
-235
lines changed

.github/workflows/java-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v3
1212
- uses: actions/setup-java@v2
1313
with:
14-
java-version: '17'
14+
java-version: '20'
1515
distribution: 'temurin'
1616
- run: chmod +x gradlew
1717

@@ -22,7 +22,7 @@ jobs:
2222
uses: gradle/gradle-build-action@v2
2323
with:
2424
arguments: build
25-
gradle-version: 7.6.1
25+
gradle-version: 8.2
2626

2727
- run: chmod +x gradlew
2828
- run: make build

build.gradle

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
plugins {
22
id 'application'
33
id 'checkstyle'
4-
id 'jacoco'
4+
id 'org.springframework.boot' version '3.0.6'
5+
id 'io.spring.dependency-management' version '1.1.0'
6+
id 'org.liquibase.gradle' version '2.2.0'
7+
id 'com.github.johnrengelman.processes' version '0.5.0'
8+
id 'org.springdoc.openapi-gradle-plugin' version '1.6.0'
59
id 'org.siouan.frontend-jdk11' version '6.0.0'
6-
id 'org.liquibase.gradle' version '2.0.4'
7-
id 'org.springframework.boot' version '2.7.10'
8-
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
10+
id 'jacoco'
911
}
1012

1113
group = 'hexlet.code'
12-
version = '1.0-SNAPSHOT'
13-
14-
compileJava {
15-
options.release = 17
16-
options.encoding = 'UTF-8'
17-
}
14+
version = '0.0.1-SNAPSHOT'
15+
sourceCompatibility = 20
1816

1917
application {
2018
mainClass = 'hexlet.code.AppApplication'
21-
applicationDefaultJvmArgs = ['-Dfile.encoding=UTF-8']
2219
}
2320

24-
jacocoTestReport {
25-
reports {
26-
xml.required = true
21+
configurations {
22+
compileOnly {
23+
extendsFrom annotationProcessor
2724
}
2825
}
2926

@@ -32,72 +29,83 @@ repositories {
3229
}
3330

3431
dependencies {
35-
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
36-
implementation 'org.springframework.boot:spring-boot-starter-web'
37-
implementation 'org.springframework.boot:spring-boot-starter-validation'
38-
implementation 'org.springframework.boot:spring-boot-starter-security'
39-
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
40-
implementation 'org.liquibase:liquibase-core'
41-
implementation 'com.querydsl:querydsl-core:5.0.0'
42-
implementation 'com.querydsl:querydsl-jpa:5.0.0'
43-
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
44-
implementation 'com.rollbar:rollbar-spring-boot-webmvc:1.10.0'
45-
46-
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
47-
runtimeOnly'io.jsonwebtoken:jjwt-jackson:0.11.5'
48-
runtimeOnly 'com.h2database:h2:2.1.214'
49-
runtimeOnly 'org.postgresql:postgresql:42.5.4'
50-
51-
liquibaseRuntime 'org.liquibase:liquibase-core:4.16.1'
52-
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:3.0.2'
53-
liquibaseRuntime 'info.picocli:picocli:4.6.1'
54-
liquibaseRuntime 'com.h2database:h2:2.1.214'
55-
liquibaseRuntime 'org.postgresql:postgresql:42.5.4'
56-
liquibaseRuntime 'org.liquibase.ext:liquibase-hibernate5:4.16.1'
57-
liquibaseRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
58-
liquibaseRuntime("ch.qos.logback:logback-core:1.4.6")
59-
liquibaseRuntime("ch.qos.logback:logback-classic:1.4.6")
60-
liquibaseRuntime sourceSets.main.output
61-
62-
annotationProcessor 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final'
63-
annotationProcessor 'javax.annotation:javax.annotation-api:1.3.2'
64-
annotationProcessor 'com.querydsl:querydsl-apt:5.0.0:jpa'
65-
annotationProcessor 'org.projectlombok:lombok'
32+
developmentOnly 'org.springframework.boot:spring-boot-devtools'
33+
34+
implementation(
35+
'org.springframework.boot:spring-boot-starter-data-jpa',
36+
'org.springframework.boot:spring-boot-starter-web',
37+
'org.springframework.boot:spring-boot-starter-validation',
38+
'org.springframework.boot:spring-boot-starter-security',
39+
'org.liquibase:liquibase-core',
40+
'org.springdoc:springdoc-openapi-ui:1.7.0',
41+
'io.jsonwebtoken:jjwt:0.9.1',
42+
'org.springdoc:springdoc-openapi-ui:1.7.0',
43+
'com.rollbar:rollbar-spring-boot3-webmvc:1.10.0',
44+
'com.querydsl:querydsl-jpa:5.0.0:jakarta',
45+
'io.jsonwebtoken:jjwt-api:0.11.5',
46+
'org.springframework.boot:spring-boot-starter-test'
47+
)
6648

6749
compileOnly 'org.projectlombok:lombok'
6850

69-
testImplementation 'org.springframework.boot:spring-boot-starter-test'
51+
runtimeOnly (
52+
'com.h2database:h2',
53+
'org.postgresql:postgresql:42.6.0',
54+
'io.jsonwebtoken:jjwt-impl:0.11.5',
55+
'io.jsonwebtoken:jjwt-jackson:0.11.5'
56+
)
57+
58+
liquibaseRuntime(
59+
sourceSets.main.output,
60+
'org.liquibase:liquibase-core',
61+
'info.picocli:picocli:4.7.1',
62+
'org.liquibase.ext:liquibase-hibernate6:4.21.1',
63+
'org.springframework.boot:spring-boot-starter-data-jpa',
64+
'com.h2database:h2',
65+
'org.postgresql:postgresql:42.5.4',
66+
'org.liquibase:liquibase-groovy-dsl:3.0.2',
67+
'org.liquibase.ext:liquibase-hibernate5:4.16.1',
68+
"ch.qos.logback:logback-core:1.4.6",
69+
"ch.qos.logback:logback-classic:1.4.6"
70+
)
71+
72+
annotationProcessor(
73+
'org.projectlombok:lombok',
74+
'com.querydsl:querydsl-apt:5.0.0:jakarta',
75+
'jakarta.persistence:jakarta.persistence-api:3.1.0',
76+
'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final',
77+
'javax.annotation:javax.annotation-api:1.3.2'
78+
)
79+
}
80+
81+
tasks.named('test') {
82+
useJUnitPlatform()
7083
}
7184

72-
ext {
73-
set('snakeyaml.version','1.32')
85+
compileJava {
86+
options.release = 20
87+
options.encoding = 'UTF-8'
7488
}
7589

76-
diffChangeLog {
90+
diffChangelog {
7791
dependsOn compileJava
7892
}
7993

8094
liquibase {
8195
activities {
8296
main {
83-
changeLogFile 'src/main/resources/db/changelog/db.changelog-master.yaml'
97+
changelogFile 'src/main/resources/db/changelog/db.changelog-master.yaml'
8498
url 'jdbc:h2:./database73'
85-
username 'sa'
86-
password 'sa'
87-
referenceUrl 'hibernate:spring:hexlet.code.domain.model' +
88-
'?dialect=org.hibernate.dialect.H2Dialect' +
89-
'&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy'
90-
// '&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
9199
}
92100
}
93101
}
94102

95-
tasks.named('test') {
96-
useJUnitPlatform()
103+
jacocoTestReport {
104+
reports {
105+
xml.required = true
106+
}
97107
}
98108

99-
// Frontend (static) build. Runs if no diffs.
100-
// *****************************************************************************
101109
frontend {
102110
nodeVersion = '16.13.1'
103111
installScript = 'install'
@@ -126,7 +134,3 @@ installFrontend {
126134
}
127135

128136
processResources.dependsOn assembleFrontend
129-
// *****************************************************************************
130-
131-
task stage(dependsOn: ['clean', 'installDist'])
132-
installDist.mustRunAfter clean

src/main/java/hexlet/code/config/WebSecurityConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import lombok.AllArgsConstructor;
55
import org.springframework.context.annotation.Bean;
66
import org.springframework.context.annotation.Configuration;
7-
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
87
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
98
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
109
import org.springframework.security.config.http.SessionCreationPolicy;
@@ -22,7 +21,6 @@
2221

2322
@Configuration
2423
@EnableWebSecurity
25-
@EnableGlobalMethodSecurity(prePostEnabled = true)
2624
@AllArgsConstructor
2725
public class WebSecurityConfig {
2826

@@ -48,7 +46,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
4846
.logout().disable()
4947
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
5048

51-
http.authorizeRequests()
49+
http.authorizeHttpRequests()
5250
.requestMatchers(publicPaths).permitAll()
5351
.anyRequest().authenticated();
5452

src/main/java/hexlet/code/controller/LabelController.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import hexlet.code.utils.DataMapper;
66
import hexlet.code.service.LabelService;
77
import io.swagger.v3.oas.annotations.Operation;
8-
import io.swagger.v3.oas.annotations.media.Content;
9-
import io.swagger.v3.oas.annotations.media.Schema;
10-
import io.swagger.v3.oas.annotations.responses.ApiResponse;
11-
import io.swagger.v3.oas.annotations.responses.ApiResponses;
8+
//import io.swagger.v3.oas.annotations.media.Content;
9+
//import io.swagger.v3.oas.annotations.media.Schema;
10+
//import io.swagger.v3.oas.annotations.responses.ApiResponse;
11+
//import io.swagger.v3.oas.annotations.responses.ApiResponses;
1212
import lombok.AllArgsConstructor;
1313
import org.springframework.http.HttpStatus;
1414
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -21,7 +21,7 @@
2121
import org.springframework.web.bind.annotation.ResponseStatus;
2222
import org.springframework.web.bind.annotation.RestController;
2323

24-
import javax.validation.Valid;
24+
import jakarta.validation.Valid;
2525
import java.util.List;
2626
import java.util.stream.Collectors;
2727

@@ -34,10 +34,10 @@ public class LabelController {
3434
private final DataMapper dataMapper;
3535

3636
@Operation(summary = "Create new label")
37-
@ApiResponses(value = {
38-
@ApiResponse(responseCode = "201", description = "The label has been successfully created",
39-
content = {@Content(mediaType = "application/json",
40-
schema = @Schema(implementation = Label.class))})})
37+
// @ApiResponses(value = {
38+
// @ApiResponse(responseCode = "201", description = "The label has been successfully created",
39+
// content = {@Content(mediaType = "application/json",
40+
// schema = @Schema(implementation = Label.class))})})
4141
@PostMapping
4242
@ResponseStatus(HttpStatus.CREATED)
4343
public LabelDTO createLabel(@RequestBody @Valid LabelDTO dto) {
@@ -46,8 +46,8 @@ public LabelDTO createLabel(@RequestBody @Valid LabelDTO dto) {
4646
}
4747

4848
@Operation(summary = "Get all labels")
49-
@ApiResponse(responseCode = "200", description = "All labels are found",
50-
content = @Content(schema = @Schema(implementation = Label.class)))
49+
// @ApiResponse(responseCode = "200", description = "All labels are found",
50+
// content = @Content(schema = @Schema(implementation = Label.class)))
5151
@GetMapping
5252
public List<LabelDTO> findAllLabels() {
5353
List<Label> existedLabels = labelService.getAllLabels();
@@ -58,23 +58,23 @@ public List<LabelDTO> findAllLabels() {
5858
}
5959

6060
@Operation(summary = "Get label by id")
61-
@ApiResponses(value = {
62-
@ApiResponse(responseCode = "200", description = "The label is found",
63-
content = {@Content(mediaType = "application/jsom",
64-
schema = @Schema(implementation = Label.class))}),
65-
@ApiResponse(responseCode = "404", description = "No such label found", content = @Content)})
61+
// @ApiResponses(value = {
62+
// @ApiResponse(responseCode = "200", description = "The label is found",
63+
// content = {@Content(mediaType = "application/jsom",
64+
// schema = @Schema(implementation = Label.class))}),
65+
// @ApiResponse(responseCode = "404", description = "No such label found", content = @Content)})
6666
@GetMapping(path = "/{id}")
6767
public LabelDTO findLabelById(@PathVariable(name = "id") long id) {
6868
Label existedLabel = labelService.getLabelById(id);
6969
return dataMapper.toLabelDTO(existedLabel);
7070
}
7171

7272
@Operation(summary = "Update the label by id")
73-
@ApiResponses(value = {
74-
@ApiResponse(responseCode = "200", description = "The label is updated",
75-
content = {@Content(mediaType = "application/json",
76-
schema = @Schema(implementation = Label.class))}),
77-
@ApiResponse(responseCode = "422", description = "Invalid request", content = @Content)})
73+
// @ApiResponses(value = {
74+
// @ApiResponse(responseCode = "200", description = "The label is updated",
75+
// content = {@Content(mediaType = "application/json",
76+
// schema = @Schema(implementation = Label.class))}),
77+
// @ApiResponse(responseCode = "422", description = "Invalid request", content = @Content)})
7878
@PutMapping(path = "/{id}")
7979
public LabelDTO updateLabel(@RequestBody @Valid LabelDTO dto,
8080
@PathVariable(name = "id") long id) {
@@ -83,9 +83,9 @@ public LabelDTO updateLabel(@RequestBody @Valid LabelDTO dto,
8383
}
8484

8585
@Operation(summary = "Delete the label by id")
86-
@ApiResponses(value = {
87-
@ApiResponse(responseCode = "200", description = "Label has been successfully deleted"),
88-
@ApiResponse(responseCode = "404", description = "No such label found")})
86+
// @ApiResponses(value = {
87+
// @ApiResponse(responseCode = "200", description = "Label has been successfully deleted"),
88+
// @ApiResponse(responseCode = "404", description = "No such label found")})
8989
@DeleteMapping(path = "/{id}")
9090
public void deleteLabel(@PathVariable(name = "id") long id) {
9191
labelService.deleteLabel(id);

0 commit comments

Comments
 (0)