-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created openapi.yml and added plugin (#48)
- Created openapi.yml and added maven plugin
- Loading branch information
1 parent
f41d458
commit 2e30df7
Showing
36 changed files
with
597 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 7 additions & 9 deletions
16
src/main/java/com/lauro/correia/reactive/api/controller/PostController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
package com.lauro.correia.reactive.api.controller; | ||
|
||
|
||
import com.lauro.correia.reactive.api.PostApiDelegate; | ||
import com.lauro.correia.reactive.api.service.post.PostService; | ||
import com.lauro.correia.reactive.api.vo.CommentsVO; | ||
import com.lauro.correia.reactive.model.CommentDto; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.server.ServerWebExchange; | ||
import reactor.core.publisher.Flux; | ||
|
||
|
||
@Slf4j | ||
@RestController | ||
@RequestMapping("/post") | ||
public class PostController { | ||
public class PostController implements PostApiDelegate { | ||
|
||
private final PostService postService; | ||
|
||
public PostController(PostService postService) { | ||
this.postService = postService; | ||
} | ||
|
||
@GetMapping(value = "/{userId}", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Flux<CommentsVO> getPostsCommentsByUser(@PathVariable("userId") final String userId) { | ||
log.info("[UserInfoController] getUsers"); | ||
@Override | ||
public Flux<CommentDto> getPostsCommentsByUser(String userId, ServerWebExchange exchange) { | ||
log.info("[UserInfoController] Get posts comments by user {}", userId); | ||
return this.postService.getPostCommentsByUser(userId); | ||
} | ||
} |
21 changes: 10 additions & 11 deletions
21
src/main/java/com/lauro/correia/reactive/api/controller/UserInfoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
package com.lauro.correia.reactive.api.controller; | ||
|
||
|
||
import com.lauro.correia.reactive.api.UserApiDelegate; | ||
import com.lauro.correia.reactive.api.service.user.UserService; | ||
import com.lauro.correia.reactive.api.vo.UserInfoVO; | ||
import com.lauro.correia.reactive.api.vo.UserVO; | ||
import com.lauro.correia.reactive.model.UserDto; | ||
import com.lauro.correia.reactive.model.UserInfoDto; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.server.ServerWebExchange; | ||
import reactor.core.publisher.Flux; | ||
|
||
@RestController | ||
@RequestMapping("/user") | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class UserInfoController { | ||
public class UserInfoController implements UserApiDelegate { | ||
|
||
private final UserService userService; | ||
|
||
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Flux<UserInfoVO> getUserInfo(@PathVariable("id") String id) { | ||
@Override | ||
public Flux<UserInfoDto> getUserInfo(String id, ServerWebExchange exchange) { | ||
log.info("[UserInfoController] getUserInfo for Id: [{}]", id); | ||
return this.userService.getUserInfoComplete(id); | ||
} | ||
|
||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) | ||
public Flux<UserVO> getUsers() { | ||
@Override | ||
public Flux<UserDto> getUsers(ServerWebExchange exchange) { | ||
log.info("[UserInfoController] getUsers"); | ||
return this.userService.getUsers(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/main/java/com/lauro/correia/reactive/api/exception/ServerErrorException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
src/main/java/com/lauro/correia/reactive/api/exception/user/UserNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
src/main/java/com/lauro/correia/reactive/api/mapper/AlbumMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package com.lauro.correia.reactive.api.mapper; | ||
|
||
import com.lauro.correia.reactive.api.model.Album; | ||
import com.lauro.correia.reactive.api.vo.AlbumVO; | ||
import com.lauro.correia.reactive.model.AlbumDto; | ||
import org.mapstruct.InjectionStrategy; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
import java.util.List; | ||
|
||
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR) | ||
@Mapper(componentModel = "spring") | ||
public interface AlbumMapper { | ||
|
||
List<AlbumVO> mapToAlbumVO(List<Album> album); | ||
List<AlbumDto> mapToAlbumDto(List<Album> album); | ||
} |
7 changes: 3 additions & 4 deletions
7
src/main/java/com/lauro/correia/reactive/api/mapper/CompanyMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
package com.lauro.correia.reactive.api.mapper; | ||
|
||
import com.lauro.correia.reactive.api.model.Company; | ||
import com.lauro.correia.reactive.api.vo.CompanyVO; | ||
import org.mapstruct.InjectionStrategy; | ||
import com.lauro.correia.reactive.model.CompanyDto; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR) | ||
@Mapper(componentModel = "spring") | ||
public interface CompanyMapper { | ||
CompanyVO maptoCompanyVO(Company company); | ||
CompanyDto maptoCompanyDto(Company company); | ||
} |
4 changes: 2 additions & 2 deletions
4
src/main/java/com/lauro/correia/reactive/api/mapper/PostCommentsMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package com.lauro.correia.reactive.api.mapper; | ||
|
||
import com.lauro.correia.reactive.api.model.Comments; | ||
import com.lauro.correia.reactive.api.vo.CommentsVO; | ||
import com.lauro.correia.reactive.model.CommentDto; | ||
import org.mapstruct.InjectionStrategy; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR) | ||
public interface PostCommentsMapper { | ||
CommentsVO mapToCommentVO(Comments response); | ||
CommentDto mapToCommentDto(Comments response); | ||
|
||
} |
7 changes: 3 additions & 4 deletions
7
src/main/java/com/lauro/correia/reactive/api/mapper/PostMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package com.lauro.correia.reactive.api.mapper; | ||
|
||
import com.lauro.correia.reactive.api.model.Post; | ||
import com.lauro.correia.reactive.api.vo.PostVO; | ||
import com.lauro.correia.reactive.model.PostDto; | ||
import org.mapstruct.InjectionStrategy; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
import java.util.List; | ||
|
||
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR) | ||
@Mapper(componentModel = "spring") | ||
public interface PostMapper { | ||
|
||
List<PostVO> maptToVo(List<Post> post); | ||
List<PostDto> mapToPostDto(List<Post> post); | ||
} |
Oops, something went wrong.