Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#169 Api Success Response 설정 #170

Merged
merged 69 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
305f9e7
chore: Bookmark -> Bookmarks
realhsb Jun 18, 2024
8a92c41
feat: Bookmark API
realhsb Jun 18, 2024
7141ef7
feat: Bookmarks Service
realhsb Jun 18, 2024
e9b2248
chore: Macro 적용 후 @StateObject 제거
realhsb Jun 18, 2024
b5a7f59
chore: NewsList 뷰 spacing 삭제
realhsb Jun 18, 2024
67e45ef
feat: 북마크뷰 수정
realhsb Jun 18, 2024
82c53db
chore: News 폴더 수정
realhsb Jun 18, 2024
ec8031e
Merge pull request #152 from tukcomCD2024/Dev-backend
yeonjy Jun 18, 2024
93999e1
feat: AuthAPI -> LoginService 이름 수정
realhsb Jun 18, 2024
f0fc24f
feat: baseURL 수정
realhsb Jun 18, 2024
1c20dff
feat: Auth (서버 토큰 response) 모델 생성
realhsb Jun 18, 2024
34027cd
feat: login API 추가
realhsb Jun 18, 2024
b078e14
chore: AuthVM 수정
realhsb Jun 18, 2024
3b45212
chore: 로그인 버튼 로직 수정
realhsb Jun 18, 2024
2ee803c
chore: auth 모델 변수명 수정
realhsb Jun 18, 2024
fbca176
feat: auth request 모델 추가
realhsb Jun 18, 2024
6f74dce
chore: auth request 모델 적용
realhsb Jun 18, 2024
2e2914d
chore: auth VM 수정
realhsb Jun 18, 2024
2290a33
Merge pull request #153 from tukcomCD2024/feat/#149-ios-bookmarks-api
realhsb Jun 18, 2024
ad8fc2d
fix & feat : 토론방 생성 API 연동 완료
yeahzxnn Jun 19, 2024
8bec2de
fix & feat : ChatGPT와유저간의 토론 API 구현 완료
yeahzxnn Jun 19, 2024
fb88f32
feat : 최근 본 뉴스 API 연동하기
yeahzxnn Jun 19, 2024
0c05871
Merge pull request #155 from tukcomCD2024/Feat/#154_ios_fixdebatepush…
yeahzxnn Jun 19, 2024
330776f
feat : 최근 읽은 뉴스 조회 API 연동 완료
yeahzxnn Jun 19, 2024
f69c2b5
fix : ChatGPT가 채팅 시작하는 로직으로 변경
yeahzxnn Jun 19, 2024
fbfb1eb
feat: 토론 종료 API 연결 및 토론 요약 화면 넘어가기 구현
yeahzxnn Jun 19, 2024
8b3e2a9
fix : 토론 종료 후 다시 이전화면으로 돌아오는 것으로 로직 수정
yeahzxnn Jun 19, 2024
e168c18
feat: 통계 API
realhsb Jun 19, 2024
2b41196
chore: Daily Report (일별 조회수 조회) Model 수정
realhsb Jun 19, 2024
c2a16b1
chore: Daily Report (일별 조회수 조회) View & ViewModel 수정
realhsb Jun 19, 2024
e2b1c8b
feat: Statistics Service
realhsb Jun 19, 2024
ee8349b
feat: Type Report Model (카테고리별 조회수)
realhsb Jun 19, 2024
ae15c2f
feat: Type Report View & ViewModel (카테고리별 조회수)
realhsb Jun 19, 2024
7abdbc6
chore: NewsType enum 수정
realhsb Jun 19, 2024
73b1ee0
chore: Statistics Service 수정
realhsb Jun 19, 2024
93509c5
chore: Bookmark api Token 수정
realhsb Jun 19, 2024
7ecaf76
chore: 주석 제거
realhsb Jun 19, 2024
003da6c
chore: Bookmark Service의 task 수정
realhsb Jun 19, 2024
d009b63
feat: NewsListView에 BookmarksListViewModel 연결
realhsb Jun 20, 2024
6449801
chore: 주석 제거
realhsb Jun 20, 2024
85f03cd
feat: 북마크 여부 확인 함수 및 주석 제거
realhsb Jun 20, 2024
3ec8334
chore: 주석 제거
realhsb Jun 20, 2024
3b01916
feat: 북마크 저장
realhsb Jun 20, 2024
4667af8
chore: BookmarksViewModel 연결
realhsb Jun 20, 2024
0c5d600
feat: 북마크 삭제
realhsb Jun 20, 2024
1110c4a
chore: 주석 제거
realhsb Jun 20, 2024
4acbcab
Merge pull request #158 from tukcomCD2024/feat/#157-ios-statistics
realhsb Jun 20, 2024
0f82def
feat: 채팅방 조회API 연동 완료
yeahzxnn Jun 20, 2024
7681269
Merge pull request #159 from tukcomCD2024/Feat/#156_ios_modifydebatel…
yeahzxnn Jun 20, 2024
00b86b4
fix : 최근 본 뉴스 조회하기 API 연결
yeahzxnn Jun 20, 2024
4b68972
fix : ChatGPT가 먼저 토론 시작하는 로직으로 수정
yeahzxnn Jun 20, 2024
d984017
fix : 토론 종료 API 연동 및 토론 종료 후 토론 탭 메인 화면으로 돌아오는 것으로 로직 수정 완료
yeahzxnn Jun 20, 2024
12865a8
fix : 채팅방 목록 불러오기 API 연동 완료
yeahzxnn Jun 20, 2024
b2f412c
Merge pull request #162 from tukcomCD2024/Feat/#161_ios_branchmergeissue
yeahzxnn Jun 20, 2024
032455c
Merge branch 'DeviOS' into Dev
realhsb Jun 20, 2024
0417379
Merge remote-tracking branch 'origin/Dev-backend' into feat/#169-back…
yeonjy Jun 29, 2024
2a702cb
feat: success response
yeonjy Jun 30, 2024
3308737
refactor: directory config -> common
yeonjy Jun 30, 2024
7f57204
feat: BookmarkApi에 success response 적용
yeonjy Jun 30, 2024
b43489d
refactor: BaseTimeEntity directory 이동 적용
yeonjy Jun 30, 2024
dc2bca4
feat: Debate API 에 Success Response 적용
yeonjy Jun 30, 2024
cebd6bf
feat: Member API에 Success Response 적용
yeonjy Jun 30, 2024
107726b
feat: News API에 Success Response 적용
yeonjy Jun 30, 2024
d94fb91
feat: ReadNews API에 Success Response 적용
yeonjy Jun 30, 2024
e33a25e
feat: Statistics API에 Success Response 적용
yeonjy Jun 30, 2024
7c4567d
feat: Auth API에 Success Response 적용
yeonjy Jun 30, 2024
86c8b0a
feat: success message 수정
yeonjy Jun 30, 2024
79686b8
refactor: swagger tags -> @Tag
yeonjy Jun 30, 2024
43f0208
refactor: 필요없는 log 삭제
yeonjy Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,42 @@

import com.rollthedice.backend.domain.bookmark.dto.response.BookmarkResponse;
import com.rollthedice.backend.domain.news.dto.response.NewsResponse;
import com.rollthedice.backend.global.common.response.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.Pageable;

import java.util.List;

@Tag(name = "Bookmark")
public interface BookmarkApi {
@Operation(
summary = "북마크 전체 조회",
description = "회원이 북마크한 뉴스를 페이지로 나누어 조회합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"북마크"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "200",
description = "OK"
description = "북마크 전체 조회를 성공했습니다."
)
List<NewsResponse> getAllBookmarkedNews(
SuccessResponse<List<NewsResponse>> getAllBookmarkedNews(
Pageable pageable
);

@Operation(
summary = "뉴스 북마크 여부 조회",
description = "로그인한 회원이 해당 뉴스를 북마크 했는지 여부를 조회합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"북마크"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "200",
description = "OK"
description = "뉴스가 북마크 여부 조회를 성공했습니다."
)
BookmarkResponse getIsBookmarked(
SuccessResponse<BookmarkResponse> getIsBookmarked(
@Parameter(in = ParameterIn.PATH, description = "뉴스 ID", required = true)
Long newsId
);
Expand All @@ -45,29 +46,27 @@ BookmarkResponse getIsBookmarked(
@Operation(
summary = "북마크 저장",
description = "뉴스에 대하여 북마크로 저장합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"북마크"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "201",
description = "Created"
description = "북마크 저장에 성공했습니다."
)
void saveBookmark(
SuccessResponse<String> saveBookmark(
@Parameter(in = ParameterIn.PATH, description = "뉴스 ID", required = true)
Long newsId
);

@Operation(
summary = "북마크 삭제",
description = "저장된 북마크를 해제합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"북마크"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "204",
description = "No Content"
description = "북마크 삭제에 성공했습니다."
)
void deleteBookmark(
SuccessResponse<String> deleteBookmark(
@Parameter(in = ParameterIn.PATH, description = "뉴스 ID", required = true)
Long newsId
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import com.rollthedice.backend.domain.bookmark.dto.response.BookmarkResponse;
import com.rollthedice.backend.domain.bookmark.service.BookmarkService;
import com.rollthedice.backend.domain.news.dto.response.NewsResponse;
import com.rollthedice.backend.global.common.response.SuccessResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.rollthedice.backend.global.common.response.SuccessCode.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("bookmarks")
Expand All @@ -19,28 +22,32 @@ public class BookmarkController implements BookmarkApi {
@ResponseStatus(HttpStatus.OK)
@GetMapping("")
@Override
public List<NewsResponse> getAllBookmarkedNews(final Pageable pageable) {
return bookmarkService.getAllBookmarkedNews(pageable);
public SuccessResponse<List<NewsResponse>> getAllBookmarkedNews(final Pageable pageable) {
List<NewsResponse> response = bookmarkService.getAllBookmarkedNews(pageable);
return SuccessResponse.of(GET_ALL_BOOKMARK_SUCCESS, response);
}

@ResponseStatus(HttpStatus.OK)
@GetMapping("/{newsId}")
@Override
public BookmarkResponse getIsBookmarked(@PathVariable final Long newsId) {
return bookmarkService.getIsBookmarked(newsId);
public SuccessResponse<BookmarkResponse> getIsBookmarked(@PathVariable final Long newsId) {
BookmarkResponse response = bookmarkService.getIsBookmarked(newsId);
return SuccessResponse.of(GET_IS_BOOKMARKED_SUCCESS, response);
}

@ResponseStatus(HttpStatus.CREATED)
@PostMapping("/{newsId}")
@Override
public void saveBookmark(@PathVariable final Long newsId) {
public SuccessResponse<String> saveBookmark(@PathVariable final Long newsId) {
bookmarkService.saveBookmark(newsId);
return SuccessResponse.of(CREATE_BOOKMARK_SUCCESS);
}

@ResponseStatus(HttpStatus.NO_CONTENT)
@DeleteMapping("/{newsId}")
@Override
public void deleteBookmark(@PathVariable final Long newsId) {
public SuccessResponse<String> deleteBookmark(@PathVariable final Long newsId) {
bookmarkService.deleteBookmark(newsId);
return SuccessResponse.of(DELETE_BOOKMARK_SUCCESS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.rollthedice.backend.domain.member.entity.Member;
import com.rollthedice.backend.domain.news.entity.News;
import com.rollthedice.backend.global.config.BaseTimeEntity;
import com.rollthedice.backend.global.common.BaseTimeEntity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,69 +6,67 @@
import com.rollthedice.backend.domain.debate.dto.response.DebateRoomResponse;
import com.rollthedice.backend.domain.debate.dto.response.DebateRoomSaveResponse;
import com.rollthedice.backend.domain.debate.dto.response.DebateSummaryResponse;
import com.rollthedice.backend.global.common.response.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;


@Tag(name = "Debate")
public interface DebateApi {

@Operation(
summary = "토론방 생성",
description = "주제가 선택된 토론방을 생성합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론방"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "201",
description = "Created"
description = "토론방 생성에 성공했습니다."
)
DebateRoomSaveResponse saveDebateRoom(@RequestBody DebateRoomRequest request);
SuccessResponse<DebateRoomSaveResponse> saveDebateRoom(@RequestBody DebateRoomRequest request);

@Operation(
summary = "토론방 전체 조회",
description = "회원의 토론방을 페이지로 나누어 조회합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론방"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "200",
description = "요청에 성공하였습니다."
description = "토론방 전체 조회에 성공했습니다"
)
List<DebateRoomResponse> getDebateRooms(Pageable pageable);
SuccessResponse<List<DebateRoomResponse>> getDebateRooms(Pageable pageable);

@Operation(
summary = "토론방 삭제",
description = "토론방을 삭제합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론방"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "204",
description = "토론방 삭제에 성공하였으며, 응답값은 없습니다."
description = "토론방 삭제에 성공했습니다."
)
void deleteDebateRoom(@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
SuccessResponse<String> deleteDebateRoom(@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId
);

@Operation(
summary = "[인간] 토론 메세지 저장",
description = "사용자가 보낸 토론 메세지를 저장합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론 메세지"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "201",
description = "Created"
description = "사용자가 보낸 토론 메세지 저장에 성공했습니다."
)
void saveHumanDebateMessage(
SuccessResponse<String> saveHumanDebateMessage(
@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId,

Expand All @@ -78,14 +76,13 @@ void saveHumanDebateMessage(
@Operation(
summary = "[AI] 토론 메세지 저장",
description = "ChatGPT OPENAI가 보낸 토론 메세지를 저장합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론 메세지"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "201",
description = "Created"
description = "AI가 보낸 토론 메세지 저장에 성공했습니다."
)
void saveAIDebateMessage(
SuccessResponse<String> saveAIDebateMessage(
@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId,

Expand All @@ -95,79 +92,74 @@ void saveAIDebateMessage(
@Operation(
summary = "토론 종료",
description = "토론을 종료합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론방"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "204",
description = "요청에 성공하였으며 응답값은 없습니다."
description = "토론 종료에 성공했습니다."
),
@ApiResponse(
responseCode = "404",
description = "토론방을 찾지 못했습니다."
)
})
void finishDebate(
SuccessResponse<String> finishDebate(
@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId
);

@Operation(
summary = "토론 메세지 조회",
description = "토론방의 토론 메세지 이력을 조회합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론 메세지"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponse(
responseCode = "200",
description = "요청에 성공하였습니다."
description = "토론 메세지 조회에 성공했습니다."
)
List<DebateMessageResponse> getDebateMessages(
SuccessResponse<List<DebateMessageResponse>> getDebateMessages(
@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId
);

@Operation(
summary = "토론 요약",
description = "토론방의 토론 메세지들을 요약합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론방"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "201",
description = "토론 요약이 성공하였습니다."
description = "토론 요약에 성공했습니다."
),
@ApiResponse(
responseCode = "404",
description = "토론방을 찾지 못했습니다."
)
})
DebateSummaryResponse summarizeDebate(
SuccessResponse<DebateSummaryResponse> summarizeDebate(
@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId
);

@Operation(
summary = "토론 요약 조회",
description = "토론 요약 내용을 조회합니다.",
security = {@SecurityRequirement(name = "access_token")},
tags = {"토론방"}
security = {@SecurityRequirement(name = "access_token")}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "200",
description = "요청에 성공하였습니다."
description = "토론 요약 조회에 성공했습니다."
),
@ApiResponse(
responseCode = "404",
description = "토론방을 찾지 못했습니다."
)
})
DebateSummaryResponse getSummarizedDebate(
SuccessResponse<DebateSummaryResponse> getSummarizedDebate(
@Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true)
Long roomId
);

}
Loading
Loading