Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Valeria Chernodolya
GigaChatWoot
Commits
df78b3cf
Unverified
Commit
df78b3cf
authored
3 years ago
by
Alexandre Touret
Browse files
Options
Downloads
Patches
Plain Diff
[skip ci] WIP: Saving current work
parent
bf0b21f4
Branches
Branches containing commit
2 merge requests
!3
Forking spring-petclinic-rest attempt #2
,
!2
Forked spring-petclinic-rest
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pom.xml
+7
-1
pom.xml
src/main/java/org/springframework/samples/petclinic/rest/controller/PetTypeRestController.java
+5
-4
...ples/petclinic/rest/controller/PetTypeRestController.java
src/main/resources/openapi.yml
+3
-3
src/main/resources/openapi.yml
with
15 additions
and
8 deletions
pom.xml
+
7
−
1
View file @
df78b3cf
...
...
@@ -33,6 +33,8 @@
<!-- Docker -->
<docker.jib-maven-plugin.version>
1.3.0
</docker.jib-maven-plugin.version>
<docker.image.prefix>
springcommunity
</docker.image.prefix>
<maven-compiler-plugin.version>
3.8.1
</maven-compiler-plugin.version>
<spring-boot-maven-plugin.version>
2.6.2
</spring-boot-maven-plugin.version>
</properties>
<dependencies>
...
...
@@ -164,6 +166,7 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
${spring-boot-maven-plugin.version}
</version>
<executions>
<execution>
<!-- Spring Boot Actuator displays build-related information
...
...
@@ -221,7 +224,7 @@
<minimum>
0.66
</minimum>
</limit>
</limits>
</rule>
</rule>
</rules>
</configuration>
</execution>
...
...
@@ -272,8 +275,10 @@
<apiPackage>
org.springframework.samples.petclinic.rest.api
</apiPackage>
<generateModels>
true
</generateModels>
<modelPackage>
org.springframework.samples.petclinic.rest.dto
</modelPackage>
<!--
<generateSupportingFiles>true</generateSupportingFiles>
<supportingFilesToGenerate>ApiUtil.java</supportingFilesToGenerate>
-->
<generateApis>
true
</generateApis>
<configOptions>
<!-- RestController implementation is provided by Petclinic developers -->
...
...
@@ -312,6 +317,7 @@
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
${maven-compiler-plugin.version}
</version>
<configuration>
<annotationProcessorPaths>
<path>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/org/springframework/samples/petclinic/rest/controller/PetTypeRestController.java
+
5
−
4
View file @
df78b3cf
...
...
@@ -16,6 +16,7 @@
package
org.springframework.samples.petclinic.rest.controller
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -32,6 +33,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import
javax.transaction.Transactional
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -61,8 +63,8 @@ public class PetTypeRestController implements PettypesApi {
}
@PreAuthorize
(
"hasAnyRole(@roles.OWNER_ADMIN, @roles.VET_ADMIN)"
)
@
RequestMapping
(
value
=
"/pettypes/{petTypeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
"application/json"
)
public
ResponseEntity
<
PetTypeDto
>
getPetType
(
@PathVariable
(
"petTypeId"
)
i
nt
petTypeId
)
{
@
Override
public
ResponseEntity
<
PetTypeDto
>
getPetType
(
@Min
(
0
)
@ApiParam
(
value
=
"The ID of the pet type."
,
required
=
true
)
@PathVariable
(
"petTypeId"
)
I
nt
eger
petTypeId
){
PetType
petType
=
this
.
clinicService
.
findPetTypeById
(
petTypeId
);
if
(
petType
==
null
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
NOT_FOUND
);
...
...
@@ -71,7 +73,7 @@ public class PetTypeRestController implements PettypesApi {
}
@PreAuthorize
(
"hasRole(@roles.VET_ADMIN)"
)
@
RequestMapping
(
value
=
"/pettypes"
,
method
=
RequestMethod
.
POST
,
produces
=
"application/json"
)
@
Override
public
ResponseEntity
<
PetTypeDto
>
addPetType
(
@RequestBody
@Valid
PetTypeFieldsDto
petTypeFields
,
BindingResult
bindingResult
,
UriComponentsBuilder
ucBuilder
)
{
BindingErrorsResponse
errors
=
new
BindingErrorsResponse
();
HttpHeaders
headers
=
new
HttpHeaders
();
...
...
@@ -87,7 +89,6 @@ public class PetTypeRestController implements PettypesApi {
}
@PreAuthorize
(
"hasRole(@roles.VET_ADMIN)"
)
@RequestMapping
(
value
=
"/pettypes/{petTypeId}"
,
method
=
RequestMethod
.
PUT
,
produces
=
"application/json"
)
public
ResponseEntity
<
PetTypeDto
>
updatePetType
(
@PathVariable
(
"petTypeId"
)
int
petTypeId
,
@RequestBody
@Valid
PetTypeDto
petType
,
BindingResult
bindingResult
)
{
BindingErrorsResponse
errors
=
new
BindingErrorsResponse
();
HttpHeaders
headers
=
new
HttpHeaders
();
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/openapi.yml
+
3
−
3
View file @
df78b3cf
...
...
@@ -543,7 +543,7 @@ paths:
summary
:
Get a pet type by ID
description
:
Returns the pet type or a 404 error.
parameters
:
-
name
:
petType
-
name
:
petType
Id
in
:
path
description
:
The ID of the pet type.
required
:
true
...
...
@@ -596,7 +596,7 @@ paths:
summary
:
Update a pet type by ID
description
:
Returns the pet type or a 404 error.
parameters
:
-
name
:
petType
-
name
:
petType
Id
in
:
path
description
:
The ID of the pet type.
required
:
true
...
...
@@ -656,7 +656,7 @@ paths:
summary
:
Delete a pet type by ID
description
:
Returns the pet type or a 404 error.
parameters
:
-
name
:
petType
-
name
:
petType
Id
in
:
path
description
:
The ID of the pet type.
required
:
true
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets