Skip to content

Commit

Permalink
fix: #24 response 필요없는 id 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
sominyun committed Mar 6, 2024
1 parent 2fe61bb commit a95512e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 80 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.backend.soullive_a.dto.response;

import com.backend.soullive_a.constant.AgeType;
import com.backend.soullive_a.constant.GenderType;
import com.backend.soullive_a.entity.*;
import lombok.Builder;

Expand All @@ -12,13 +14,13 @@ public record ProductResponse(
Long productId,
String company,
String brand,
List<BrandImageResponse> brandImages,
List<String> brandImages,
String product,
String characteristic,
List<ProductImageResponse> productImages,
List<GenderResponse> genders,
List<AgeResponse> ages,
List<RangeResponse> ranges
List<String> productImages,
List<GenderType> genders,
List<AgeType> ages,
List<String> ranges
) {
public static ProductResponse fromProduct(
Product product,
Expand All @@ -27,24 +29,24 @@ public static ProductResponse fromProduct(
List<Gender> genderType,
List<Age> ageType,
List<Range> rangeType) {
List<BrandImageResponse> brandImages = brandImage.stream()
.map(image -> new BrandImageResponse(image.getId(), image.getBrandImage()))
List<String> brandImages = brandImage.stream()
.map(BrandImage::getBrandImage)
.collect(Collectors.toList());

List<ProductImageResponse> productImages = productImage.stream()
.map(image -> new ProductImageResponse(image.getId(), image.getProductImage()))
List<String> productImages = productImage.stream()
.map(ProductImage::getProductImage)
.collect(Collectors.toList());

List<GenderResponse> genders = genderType.stream()
.map(gender -> new GenderResponse(gender.getId(), gender.getGender()))
List<GenderType> genders = genderType.stream()
.map(Gender::getGender)
.collect(Collectors.toList());

List<AgeResponse> ages = ageType.stream()
.map(age -> new AgeResponse(age.getId(), age.getAge()))
List<AgeType> ages = ageType.stream()
.map(Age::getAge)
.collect(Collectors.toList());

List<RangeResponse> ranges = rangeType.stream()
.map(range -> new RangeResponse(range.getId(), range.getRange()))
List<String> ranges = rangeType.stream()
.map(Range::getRange)
.collect(Collectors.toList());

return ProductResponse.builder()
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.backend.soullive_a.dto.response.model.popularity;

import com.backend.soullive_a.constant.AgeType;
import com.backend.soullive_a.constant.GenderType;
import com.backend.soullive_a.entity.model.popularity.ModelPopularAge;
import com.backend.soullive_a.entity.model.popularity.ModelPopularGender;
import com.backend.soullive_a.entity.model.popularity.ModelPopularity;
Expand All @@ -15,8 +17,8 @@ public record ModelPopularityResponse(
Long modelId,
String scoreUrl,
String aiComment,
List<ModelPopularGenderResponse> genders,
List<ModelPopularAgeResponse> ages,
List<GenderType> genders,
List<AgeType> ages,
String snsUrl,
String searchUrl,
String brandScoreUrl,
Expand All @@ -28,17 +30,16 @@ public static ModelPopularityResponse fromModel(
List<ModelPopularAge> modelPopularAge,
List<ModelScheduledWork> modelScheduledWork
) {
List<ModelPopularGenderResponse> modelPopularGenders = modelPopularGender.stream()
.map(gender -> new ModelPopularGenderResponse(gender.getId(), gender.getGender()))
List<GenderType> modelPopularGenders = modelPopularGender.stream()
.map(ModelPopularGender::getGender)
.collect(Collectors.toList());

List<ModelPopularAgeResponse> modelPopularAges = modelPopularAge.stream()
.map(age -> new ModelPopularAgeResponse(age.getId(), age.getAge()))
List<AgeType> modelPopularAges = modelPopularAge.stream()
.map(ModelPopularAge::getAge)
.collect(Collectors.toList());

List<ModelScheduledWorkResponse> modelScheduledWorks = modelScheduledWork.stream()
.map(work -> new ModelScheduledWorkResponse(
work.getId(),
work.getImageUrl(),
work.getYear(),
work.getCategory(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.backend.soullive_a.dto.response.model.popularity;

public record ModelScheduledWorkResponse(
Long modelScheduledWorkId,
String imageUrl,
Integer year,
String category,
Expand Down

0 comments on commit a95512e

Please sign in to comment.