Skip to content

Commit

Permalink
Merge pull request #17 from AWS-CV-Project-3355/feat/#16-object-list
Browse files Browse the repository at this point in the history
[Feat] Object List
  • Loading branch information
melitina915 authored Nov 27, 2024
2 parents 9cff343 + ffb8b7d commit 68a8da2
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import aws.teamthreefive.diecast.converter.DiecastConverter;
import aws.teamthreefive.diecast.dto.request.DiecastRequestDTO;
import aws.teamthreefive.diecast.dto.response.DiecastResponseDTO;
import aws.teamthreefive.diecast.entity.Diecast;
import aws.teamthreefive.diecast.service.DiecastCommandService;
import aws.teamthreefive.diecast.service.DiecastQueryService;
import aws.teamthreefive.photo.entity.Photo;
Expand Down Expand Up @@ -33,6 +34,7 @@ public DiecastResponseDTO.SavePhotoResultDTO savePhoto(
Photo photo = diecastCommandService.savePhoto(diecastUuid, request);

return DiecastConverter.toSavePhotoResultDTO(photo);

}

@GetMapping(value = "/{diecastUuid}/photo/list")
Expand All @@ -45,6 +47,15 @@ public DiecastResponseDTO.PhotoListDTO getPhotoList(@PathVariable(name = "diecas

}

@GetMapping(value = "/list")
@Operation(summary = "객체(오브젝트) 리스트 API", description = "좌측 객체 오브젝트 리스트 조회")
public DiecastResponseDTO.DiecastListDTO getDiecastList() {

List<Diecast> diecastList = diecastQueryService.getDiecastList();

return DiecastConverter.diecastListDTO(diecastList);

}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import aws.teamthreefive.diecast.dto.request.DiecastRequestDTO;
import aws.teamthreefive.diecast.dto.response.DiecastResponseDTO;
import aws.teamthreefive.diecast.entity.Diecast;
import aws.teamthreefive.photo.entity.Photo;

import java.time.LocalDateTime;
Expand Down Expand Up @@ -58,4 +59,24 @@ public static DiecastResponseDTO.PhotoListDTO photoListDTO(List<Photo> photoList

}



public static DiecastResponseDTO.DiecastDTO diecastDTO(Diecast diecast) {
return DiecastResponseDTO.DiecastDTO.builder()
.diecastUuid(diecast.getDiecastUuid())
.diecastOkng(diecast.getDiecastOkng())
.createdAt(diecast.getCreatedAt())
.diecastvideoUuid(diecast.getDiecastUuid())
.build();
}

public static DiecastResponseDTO.DiecastListDTO diecastListDTO(List<Diecast> diecastList) {
List<DiecastResponseDTO.DiecastDTO> diecastDTOList = diecastList.stream()
.map(DiecastConverter::diecastDTO).collect(Collectors.toList());

return DiecastResponseDTO.DiecastListDTO.builder()
.diecastList(diecastDTOList)
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,25 @@ public static class PhotoDTO {
LocalDateTime createdAt;
}



@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class DiecastListDTO {
List<DiecastDTO> diecastList;
}

@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class DiecastDTO {
Long diecastUuid;
int diecastOkng;
LocalDateTime createdAt;
Long diecastvideoUuid;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ public List<Photo> getPhotoList(Long diecastUuid) {

}

public List<Diecast> getDiecastList() {

List<Diecast> diecastList = diecastRepository.findAll();

return diecastList;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
@RequiredArgsConstructor
@RequestMapping("/photo")
public class PhotoController {



}

0 comments on commit 68a8da2

Please sign in to comment.