-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from studio-recoding/dev
[🚀feat] 5차 배포
- Loading branch information
Showing
15 changed files
with
136 additions
and
13 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/Ness/Backend/domain/category/CategoryController.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,29 @@ | ||
package Ness.Backend.domain.category; | ||
|
||
import Ness.Backend.domain.category.dto.reponse.GetCategoryListDto; | ||
import Ness.Backend.domain.member.entity.Member; | ||
import Ness.Backend.domain.schedule.dto.response.GetScheduleListDto; | ||
import Ness.Backend.global.auth.AuthUser; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatusCode; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Tag(name = "카테고리 API", description = "사용자의 카테고리 관련 API") | ||
@RequestMapping("/category") | ||
public class CategoryController { | ||
private final CategoryService categoryService; | ||
@GetMapping("") | ||
@Operation(summary = "특정 사용자의 모든 카테고리", description = "모든 카테고리가 리스트로 반환됩니다.") | ||
public ResponseEntity<GetCategoryListDto> getUserSchedule(@AuthUser Member member){ | ||
GetCategoryListDto getCategoryListDto = categoryService.getOneUserCategory(member.getId()); | ||
return new ResponseEntity<>(getCategoryListDto, HttpStatusCode.valueOf(200)); | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
src/main/java/Ness/Backend/domain/category/CategoryService.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,32 @@ | ||
package Ness.Backend.domain.category; | ||
|
||
import Ness.Backend.domain.category.dto.reponse.GetCategoryDto; | ||
import Ness.Backend.domain.category.dto.reponse.GetCategoryListDto; | ||
import Ness.Backend.domain.category.entity.Category; | ||
import Ness.Backend.domain.chat.dto.response.GetChatDto; | ||
import Ness.Backend.domain.chat.dto.response.GetChatListDto; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class CategoryService { | ||
private final CategoryRepository categoryRepository; | ||
/* 특정 유저의 카테고리 전부 가져오기 */ | ||
public GetCategoryListDto getOneUserCategory(Long memberId) { | ||
List<Category> categoryList = categoryRepository.findCategoryByMember_id(memberId); | ||
|
||
List<GetCategoryDto> getCategoryDtos = categoryList.stream() | ||
.map(category -> GetCategoryDto.builder() | ||
.id(category.getId()) | ||
.name(category.getName()) | ||
.color(category.getColor()) | ||
.build()) | ||
.toList(); | ||
return new GetCategoryListDto(getCategoryDtos); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/Ness/Backend/domain/category/dto/reponse/GetCategoryDto.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,27 @@ | ||
package Ness.Backend.domain.category.dto.reponse; | ||
|
||
import Ness.Backend.domain.category.entity.Category; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class GetCategoryDto { | ||
@JsonProperty("categoryNum") | ||
private Long id; | ||
|
||
@JsonProperty("category") | ||
private String name; | ||
|
||
@JsonProperty("categoryColor") | ||
private String color; | ||
|
||
@Builder | ||
public GetCategoryDto(Long id, String name, String color){ | ||
this.id = id; | ||
this.name = name; | ||
this.color = color; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/Ness/Backend/domain/category/dto/reponse/GetCategoryListDto.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,17 @@ | ||
package Ness.Backend.domain.category.dto.reponse; | ||
|
||
import Ness.Backend.domain.chat.dto.response.GetChatDto; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class GetCategoryListDto { | ||
private List<GetCategoryDto> categoryList; | ||
} |
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
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
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,6 +1,5 @@ | ||
package Ness.Backend.infra.s3.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.*; | ||
|
||
|
||
|