-
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.
- Loading branch information
Showing
21 changed files
with
433 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
### Post | ||
POST {{host_api}}/community/v1/post | ||
### Post 추가 | ||
POST {{host_api}}/community/v1/post?accountId=USER222 | ||
X-Community-Api-Key: {{api_key}} | ||
Content-Type: application/json | ||
|
||
{ | ||
"postGroup": "BOSS_NEWS", | ||
"postGroup": "NEWS_POST", | ||
"title": "오늘은 휴일입니다", | ||
"content": "정기적인 휴일입니다.", | ||
"accountId": "USER222", | ||
"postSectionRequests": [ | ||
"targetId": "3", | ||
"workspaceId": "threedollar-dev", | ||
"sections": [ | ||
{ | ||
"postType": "IMAGE", | ||
"sectionType": "IMAGE", | ||
"priority": "2", | ||
"url": "image.jpg", | ||
"width": "300", | ||
"height": "400" | ||
"ratio": 23.333, | ||
"url": "www.naver.com" | ||
} | ||
] | ||
} | ||
|
||
|
||
|
||
### Post 조회 | ||
GET {{host_api}}/community/v1/posts?cursor=8&size=3&workspaceId=threedollar-dev&targetId=3&postGroup=NEWS_POST | ||
X-Community-Api-Key: {{api_key}} | ||
Content-Type: application/json | ||
|
||
|
24 changes: 24 additions & 0 deletions
24
...ar-application/src/main/java/com/threedollar/config/advice/ExceptionControllerAdvice.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.threedollar.config.advice; | ||
|
||
import com.threedollar.common.dto.response.ApiResponse; | ||
import com.threedollar.common.exception.NotFoundException; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@Slf4j | ||
@RestControllerAdvice | ||
public class ExceptionControllerAdvice { | ||
|
||
@ExceptionHandler(NotFoundException.class) | ||
@ResponseStatus(HttpStatus.NOT_FOUND) | ||
public ApiResponse<Object> handleNotFoundException(NotFoundException e) { | ||
log.error(e.getErrorCode().getMessage(), e); | ||
return ApiResponse.error(e.getErrorCode(), e.getMessage()); | ||
} | ||
|
||
|
||
|
||
} |
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
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
26 changes: 26 additions & 0 deletions
26
...edollar-application/src/main/java/com/threedollar/service/post/request/CursorRequest.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.threedollar.service.post.request; | ||
|
||
|
||
import jakarta.annotation.Nullable; | ||
import jakarta.validation.constraints.Max; | ||
import jakarta.validation.constraints.Min; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
@Getter | ||
public class CursorRequest { | ||
|
||
@Nullable | ||
private Long cursor; | ||
|
||
@Min(0) | ||
@Max(30) | ||
private int size; | ||
|
||
public CursorRequest(Long cursor, int size) { | ||
this.cursor = cursor; | ||
this.size = size; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...dollar-application/src/main/java/com/threedollar/service/post/request/GetPostRequest.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.threedollar.service.post.request; | ||
|
||
import com.threedollar.domain.post.PostGroup; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
@Getter | ||
public class GetPostRequest { | ||
|
||
@NotBlank | ||
private String accountId; | ||
|
||
@NotBlank | ||
private String workspaceId; | ||
|
||
private PostGroup postGroup; | ||
|
||
private String targetId; | ||
|
||
public GetPostRequest(String accountId, String workspaceId, PostGroup postGroup, String targetId) { | ||
this.accountId = accountId; | ||
this.workspaceId = workspaceId; | ||
this.postGroup = postGroup; | ||
this.targetId = targetId; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...-application/src/main/java/com/threedollar/service/post/request/PostAndCursorRequest.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.threedollar.service.post.request; | ||
|
||
import jakarta.annotation.Nullable; | ||
import jakarta.validation.constraints.Max; | ||
import jakarta.validation.constraints.Min; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
@Getter | ||
public class PostAndCursorRequest { | ||
|
||
@Nullable | ||
private Long cursor; | ||
|
||
@Min(0) | ||
@Max(30) | ||
private int size; | ||
|
||
@NotBlank | ||
private String workspaceId; | ||
|
||
@NotBlank | ||
private String targetId; | ||
|
||
public PostAndCursorRequest(Long cursor, int size, String workspaceId, String targetId) { | ||
this.cursor = cursor; | ||
this.size = size; | ||
this.workspaceId = workspaceId; | ||
this.targetId = targetId; | ||
} | ||
} |
Oops, something went wrong.