Skip to content

Commit

Permalink
feat: Change getBanner api mocking according to policy changes of ban…
Browse files Browse the repository at this point in the history
…ner (#125)
  • Loading branch information
Kwon770 authored and CChuYong committed Jan 31, 2024
1 parent 42960f9 commit 9e8027a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.oing.controller;

import com.oing.component.TokenAuthenticationHolder;
import com.oing.domain.BannerImageType;
import com.oing.domain.MemberPost;
import com.oing.domain.MemberPostDailyCalendarDTO;
import com.oing.dto.response.ArrayResponse;
Expand All @@ -16,6 +17,7 @@

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.IntStream;
Expand Down Expand Up @@ -84,7 +86,9 @@ public ArrayResponse<CalendarResponse> getMonthlyCalendar(String yearMonth, Stri
public BannerResponse getBanner(String yearMonth) {
return new BannerResponse(
new Random().nextInt(0, 101),
new Random().nextInt(0, 28)
new Random().nextInt(0, 28),
new Random().nextInt(1, 5),
BannerImageType.values()[new Random().nextInt(BannerImageType.values().length)]
);
}
}
14 changes: 14 additions & 0 deletions gateway/src/main/java/com/oing/domain/BannerImageType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.oing.domain;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public enum BannerImageType {
SKULL_FLAG("SKULL_FLAG"),
ALONE_WALING("ALONE_WALING"),
WE_ARE_FRIENDS("WE_ARE_FRIENDS"),
JEWELRY_TREASURE("JEWELRY_TREASURE"),
;

private final String imageCode;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.oing.dto.response;

import com.oing.domain.BannerImageType;
import io.swagger.v3.oas.annotations.media.Schema;

@Schema(description = "배너 응답")
Expand All @@ -8,6 +9,12 @@ public record BannerResponse(
Integer familyTopPercentage,

@Schema(description = "가족 구성원 모두가 업로드한 날의 수", example = "3")
Integer allFamilyMembersUploadedDays
Integer allFamilyMembersUploadedDays,

@Schema(description = "가족 활성도 레벨 (1 ~ 4)", example = "1")
Integer familyLevel,

@Schema(description = "배너 이미지 타입", example = "SKULL_FLAG")
BannerImageType bannerImageType
) {
}

0 comments on commit 9e8027a

Please sign in to comment.