Commit d5475156 authored by Marek Skácelík's avatar Marek Skácelík 🫠
Browse files

Merge branch 'openApi-properties-fixes' into 'milestone-3'

Open api and properties fixes

See merge request !78
parents 4d821830 14e72d83
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@ WORKDIR /app
COPY ./.. /app
COPY ./.. /app
RUN mvn clean install
RUN mvn clean install


WORKDIR ./core
WORKDIR ./OAuth


EXPOSE 8082
EXPOSE 8082
CMD ["mvn", "spring-boot:run"]
CMD ["mvn", "spring-boot:run"]
 No newline at end of file
+1 −1
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ public class MyWebApp {
        httpSecurity
        httpSecurity
                .authorizeHttpRequests(x -> x
                .authorizeHttpRequests(x -> x
                        // allow anonymous access to listed URLs
                        // allow anonymous access to listed URLs
                        .requestMatchers("/", "/error", "/robots.txt", "/style.css", "/favicon.ico", "/webjars/**").permitAll()
                        .requestMatchers("/", "/error", "/robots.txt", "/style.css", "/favicon.ico", "/webjars/**", "/actuator/**", "/swagger-ui/**").permitAll()
                        // all other requests must be authenticated
                        // all other requests must be authenticated
                        .anyRequest().authenticated()
                        .anyRequest().authenticated()
                )
                )
+1 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@ WORKDIR /app
COPY ./.. /app
COPY ./.. /app
RUN mvn clean install
RUN mvn clean install


WORKDIR ./OAuth
WORKDIR ./core


EXPOSE 8080
EXPOSE 8080
CMD ["mvn", "spring-boot:run"]
CMD ["mvn", "spring-boot:run"]
 No newline at end of file

core/coreopenapi.yaml

deleted100644 → 0
+0 −1267

File deleted.

Preview size limit exceeded, changes collapsed.

+22 −13
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.persistence.EntityNotFoundException;
import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.Valid;
import jakarta.validation.Valid;
@@ -36,11 +37,14 @@ public class CompanyController {
		this.companyFacade = companyFacade;
		this.companyFacade = companyFacade;
	}
	}


	@Operation(summary = "Find all companies with pagination or without", responses = {
	@Operation(summary = "Find all companies with pagination or without")
	@ApiResponses(
			value = {
					@ApiResponse(responseCode = "200", description = "List of companies", content = {
					@ApiResponse(responseCode = "200", description = "List of companies", content = {
							@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = Result.class))
							@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = Result.class))
					})
					})
	})
			}
	)
	@GetMapping("/all")
	@GetMapping("/all")
	public Result<CompanyDto> findAll(@Parameter(description = "Page number of results to retrieve") @RequestParam(defaultValue = "0", required = false) @PositiveOrZero int page,
	public Result<CompanyDto> findAll(@Parameter(description = "Page number of results to retrieve") @RequestParam(defaultValue = "0", required = false) @PositiveOrZero int page,
									  @Parameter(description = "Page size of results to retrieve") @RequestParam(defaultValue = "-1", required = false) int pageSize) {
									  @Parameter(description = "Page size of results to retrieve") @RequestParam(defaultValue = "-1", required = false) int pageSize) {
@@ -51,12 +55,15 @@ public class CompanyController {
		return companyFacade.findAllPageable(pageWithElements);
		return companyFacade.findAllPageable(pageWithElements);
	}
	}


	@Operation(summary = "Find company by id", responses = {
	@Operation(summary = "Find company by id")
	@ApiResponses(
			value = {
					@ApiResponse(responseCode = "200", description = "Company found", content = {
					@ApiResponse(responseCode = "200", description = "Company found", content = {
							@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = CompanyDto.class))
							@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = CompanyDto.class))
					}),
					}),
					@ApiResponse(responseCode = "404", description = "Company not found", content = @Content)
					@ApiResponse(responseCode = "404", description = "Company not found", content = @Content)
	})
			}
	)
	@GetMapping("/{id}")
	@GetMapping("/{id}")
	public CompanyDto findById(@PathVariable @Parameter(description = "The id of the company.") String id) {
	public CompanyDto findById(@PathVariable @Parameter(description = "The id of the company.") String id) {
		try {
		try {
@@ -71,7 +78,6 @@ public class CompanyController {
	@ApiResponse(responseCode = "201", description = "The newly created company",
	@ApiResponse(responseCode = "201", description = "The newly created company",
			content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
			content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
					schema = @Schema(implementation = CompanyDto.class)))
					schema = @Schema(implementation = CompanyDto.class)))
	@ApiResponse(responseCode = "400", description = "Invalid input", content = @Content)
	@ApiResponse(responseCode = "409", description = "Company with the same name already exists", content = @Content)
	@ApiResponse(responseCode = "409", description = "Company with the same name already exists", content = @Content)
	public ResponseEntity<CompanyDto> create(@RequestBody @Valid CompanyCreateDto companyCreateDto) {
	public ResponseEntity<CompanyDto> create(@RequestBody @Valid CompanyCreateDto companyCreateDto) {
		try {
		try {
@@ -87,6 +93,7 @@ public class CompanyController {
			content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
			content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
					schema = @Schema(implementation = CompanyDto.class)))
					schema = @Schema(implementation = CompanyDto.class)))
	@ApiResponse(responseCode = "409", description = "Company with the same name already exists", content = @Content)
	@ApiResponse(responseCode = "409", description = "Company with the same name already exists", content = @Content)
	@ApiResponse(responseCode = "404", description = "Company not found", content = @Content)
	public CompanyDto updateById(@PathVariable @Parameter(description = "The id of the company.") String id,
	public CompanyDto updateById(@PathVariable @Parameter(description = "The id of the company.") String id,
								 @RequestBody @Valid CompanyUpdateDto companyUpdateDto) {
								 @RequestBody @Valid CompanyUpdateDto companyUpdateDto) {
		try {
		try {
@@ -102,6 +109,8 @@ public class CompanyController {
			content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
			content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
					schema = @Schema(implementation = CompanyDto.class)))
					schema = @Schema(implementation = CompanyDto.class)))
	@ApiResponse(responseCode = "404", description = "Company not found", content = @Content)
	@ApiResponse(responseCode = "404", description = "Company not found", content = @Content)
	@ApiResponse(responseCode = "422", description = "Company could not be deleted", content = @Content)
	@ApiResponse(responseCode = "505", description = "Error occurred", content = @Content)
	public ResponseEntity<?> deleteById(@PathVariable @Parameter(description = "The id of the company.") String id) {
	public ResponseEntity<?> deleteById(@PathVariable @Parameter(description = "The id of the company.") String id) {
		try {
		try {
			return ResponseEntity.status(HttpStatus.OK).body(companyFacade.deleteById(id));
			return ResponseEntity.status(HttpStatus.OK).body(companyFacade.deleteById(id));
@@ -113,7 +122,7 @@ public class CompanyController {
					.body(ex.getMessage());
					.body(ex.getMessage());
		} catch (Exception e) {
		} catch (Exception e) {
			return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
			return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
					.body("Error occured");
					.body("Error occurred");
		}
		}
	}
	}
}
}
Loading