diff --git a/src/docs/asciidoc/find-friend-votes-v2.adoc b/src/docs/asciidoc/find-friend-votes-v2.adoc new file mode 100644 index 00000000..32940e36 --- /dev/null +++ b/src/docs/asciidoc/find-friend-votes-v2.adoc @@ -0,0 +1,98 @@ +:reproducible: +== 친구 투표 전체 조회 (명세) + +=== 요청 + +[http] + +---- + +GET /v2/vote/friend?page={}&type={} HTTP/1.1 +Authorization: Bearer your-access-token +Content-Type: application-json + +---- + +*업데이트 예정* +- "type": "send" | null + +|=== +|`+type+`| 조회할 쪽지 종류 (null -> 모든쪽지, send-> 보낸쪽지) +|=== + +=== 응답 + +[http, json] +---- + +{ + "status" : 200, + "message" : "투표 조회에 성공했습니다.", + "data" : { + "totalCount" : 1, + "friendVotes" : [ { + "id" : 1, + "senderId" : 1, + "senderName" : "name1", + "senderGender" : "MALE", + "senderYelloId" : "MALE", + "senderProfileImage": "imageUrl", + "receiverId" : 2, + "receiverName" : "name2", + "receiverGender" : "MALE", + "receiverYelloId" : "MALE", + "receiverProfileImage" : "test image", + "vote" : { + "nameHead" : "나는", + "nameFoot" : "와", + "keywordHead" : "멋진", + "keyword" : "test", + "keywordFoot" : "에서 놀고싶어" + }, + "isHintUsed" : false, + "createdAt" : "0초 전" + "isUserSenderVote" : true + } ] + } +} + +---- + +*필드 타입* + +- "totalCount": Integer +- "friendVotes": *FriendVote*[] +- "isUserSenderVote" : Boolean (내가 보냈는지 여부) +- *FriendVote* +* "id": Long +* "senderId" : Long +* "senderName" : String +* "senderYelloId" : String +* "senderGender": "MALE" | "FEMALE" +* "senderProfileImage" : String +* "receiverId" : Long +* "receiverName": String +* "receiverYelloId" : String +* "receiverGender": "MALE" | "FEMALE" +* "receiverProfileImage": String +* "vote": *Vote* +* "isHintUsed": Boolean +* "createdAt": "{0}초 전" | "{0}분 전" | "{0}시간 전" | "{0}일 전" + +- *Vote* +* "nameHead": String +* "nameFoot": String +* "keywordHead": String +* "keyword": String +* "keywordFoot": String + +=== NOTE + +- 모든 종류의 쪽지를 조회할 때 `/api/v1/vote/friend?page=0` 으로 요청해주세요 +* `type=` 을 명시하지 마세요 +- 내가 보낸 쪽지를 조회할 때 `/api/v1/vote/friend?page=0&type=send` 으로 요청해주세요 +- `senderGender` 필드가 다른 API와 일관되지 못한점 미안해요 ㅠ + +=== CHANGELOG +- 2024.01.26 필드 명세 업데이트 +- 2024.01.09 `type` 명세 업데이트 \ No newline at end of file diff --git a/src/docs/asciidoc/find-friend-votes.adoc b/src/docs/asciidoc/find-friend-votes.adoc index db0e8daf..28379cfd 100644 --- a/src/docs/asciidoc/find-friend-votes.adoc +++ b/src/docs/asciidoc/find-friend-votes.adoc @@ -1,5 +1,5 @@ :reproducible: -== 친구 투표 전체 조회 (업데이트) +== 친구 투표 전체 조회 (최신버전 -> v2 확인) === 요청 @@ -9,13 +9,6 @@ include::{snippets}/api/v1/vote/findAllFriendVotes/http-request.adoc[] include::{snippets}/api/v1/vote/findAllFriendVotes/request-parameters.adoc[] -*업데이트 예정* -- "type": "send" | null - -|=== -|`+type+`|조회할 쪽지 종류 -|=== - === 응답 include::{snippets}/api/v1/vote/findAllFriendVotes/http-response.adoc[] @@ -41,11 +34,8 @@ include::{snippets}/api/v1/vote/findAllFriendVotes/http-response.adoc[] === NOTE -- 모든 종류의 쪽지를 조회할 때 `/api/v1/vote/friend?page=0` 으로 요청해주세요 -* `type=` 을 명시하지 마세요 -- 내가 보낸 쪽지를 조회할 때 `/api/v1/vote/friend?page=0&type=send` 으로 요청해주세요 -- `senderGender` 필드가 다른 API와 일관되지 못한점 미안해요 +- 최신버전 v2를 확인해주세요 === CHANGELOG -- 2024.01.09 `type` 명세 업데이트 \ No newline at end of file +- 2024.01.09 `type` 최신버전 확인 바람 \ No newline at end of file diff --git a/src/docs/asciidoc/find-notice.adoc b/src/docs/asciidoc/find-notice.adoc index 099330b5..81b6e8ca 100644 --- a/src/docs/asciidoc/find-notice.adoc +++ b/src/docs/asciidoc/find-notice.adoc @@ -1,36 +1,13 @@ :reproducible: -== 공지 조회 (명세) +== 공지 조회 === 요청 -[http] ----- -GET /api/v1/notice HTTP/1.1 -Authorization: Bearer your-access-token ----- +include::{snippets}/api/v1/notice/http-request.adoc[] === 응답 -[http,json] ----- -HTTP/1.1 200 OK -Vary: Origin -Vary: Access-Control-Request-Method -Vary: Access-Control-Request-Headers -Content-Type: application/json - -{ - "status": 200, - "message": "공지 조회에 성공하였습니다.", - "data": { - "imageUrl" : "url here", - "redirectUrl": "redirect url here", - "startDate": "2021.01.12", - "endDate": "2021.01.17", - "isAvailable": true - } -} ----- +include::{snippets}/api/v1/notice/http-response.adoc[] *필드 타입* @@ -43,14 +20,42 @@ Content-Type: application/json - "endDate": String(10) * YYYY-MM-DD (ISO-8601) - "isAvailable": Boolean +- "type" : String +* ENUM 값 -> "NOTICE" | "BANNER" + + +=== 주의 + +[http, json] + +*유효한 날짜의 공지가 존재하지 않는 경우* + +-> isAvailable은 false로 오고 날짜 제외한 나머지 값은 빈값으로 전달 + +---- +{ + "status": 200, + "message": "공지 조회에 성공하였습니다.", + "data": { + "imageUrl": "", + "redirectUrl": "", + "startDate": "2024-01-27", + "endDate": "2024-01-27", + "isAvailable": false, + "type": null, + "title": "" +} + +---- === NOTE - 공지 정보를 조회하는 API입니다. -- 유효한 1개의 공지를 반환합니다. +- isAvailable true일 때, 유효한 1개의 공지를 반환합니다. * 요구사항에 따라 여러개의 공지를 반환할 수 있도록 염두하고 있습니다. * 반환되는 공지를 무조건 View에 띄워주시면 되겠습니다. === CHANGELOG +- 2024.01.26 API 릴리즈 - 2024.01.09 명세 작성 \ No newline at end of file diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index be2036de..9c88fe53 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -53,7 +53,9 @@ * link:find-votes.html[내 투표 전체 조회하기] -* ⬆️ link:find-friend-votes.html[친구 투표 전체 조회하기, 2024-01-09] +* link:find-friend-votes.html[친구 투표 전체 조회하기, 2024-01-09] + +* ⬆️ link:find-friend-votes-v2.html[친구 투표 전체 조회하기 v2 (명세), 2024-01-26] * link:get-unread-vote.html[읽지 않은 쪽지 개수 조회하기] @@ -102,4 +104,4 @@ === Notice API -* 🆕 link:find-notice.html[공지 조회 (명세), 2024-01-09] \ No newline at end of file +* 🆕 link:find-notice.html[공지 조회, 2024-01-26] \ No newline at end of file diff --git a/src/main/java/com/yello/server/domain/notice/controller/NoticeController.java b/src/main/java/com/yello/server/domain/notice/controller/NoticeController.java new file mode 100644 index 00000000..b632102b --- /dev/null +++ b/src/main/java/com/yello/server/domain/notice/controller/NoticeController.java @@ -0,0 +1,29 @@ +package com.yello.server.domain.notice.controller; + + +import com.yello.server.domain.notice.dto.NoticeDataResponse; +import com.yello.server.domain.notice.service.NoticeService; +import com.yello.server.domain.user.entity.User; +import com.yello.server.global.common.annotation.AccessTokenUser; +import com.yello.server.global.common.dto.BaseResponse; +import lombok.RequiredArgsConstructor; +import lombok.val; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import static com.yello.server.global.common.SuccessCode.READ_NOTICE_SUCCESS; + +@RestController +@RequiredArgsConstructor +@RequestMapping("api/v1") +public class NoticeController { + + private final NoticeService noticeService; + + @GetMapping("/notice") + public BaseResponse findNotice(@AccessTokenUser User user) { + val data = noticeService.findNotice(user.getId()); + return BaseResponse.success(READ_NOTICE_SUCCESS, data); + } +} diff --git a/src/main/java/com/yello/server/domain/notice/dto/NoticeDataResponse.java b/src/main/java/com/yello/server/domain/notice/dto/NoticeDataResponse.java new file mode 100644 index 00000000..41e61948 --- /dev/null +++ b/src/main/java/com/yello/server/domain/notice/dto/NoticeDataResponse.java @@ -0,0 +1,31 @@ +package com.yello.server.domain.notice.dto; + +import static com.yello.server.global.common.factory.TimeFactory.toYearAndMonthFormattedString; + +import com.yello.server.domain.notice.entity.Notice; +import lombok.Builder; + +@Builder +public record NoticeDataResponse( + String imageUrl, + String redirectUrl, + String startDate, + String endDate, + boolean isAvailable, + String type, + String title +) { + + public static NoticeDataResponse of(Notice notice, Boolean isAvailable) { + return NoticeDataResponse.builder() + .imageUrl(notice.getImageUrl()) + .redirectUrl(notice.getRedirectUrl()) + .startDate(toYearAndMonthFormattedString(notice.getStartDate().toLocalDateTime())) + .endDate(toYearAndMonthFormattedString(notice.getEndDate().toLocalDateTime())) + .isAvailable(isAvailable) + .type(notice.getType()) + .title(notice.getTitle()) + .build(); + } + +} diff --git a/src/main/java/com/yello/server/domain/notice/entity/Notice.java b/src/main/java/com/yello/server/domain/notice/entity/Notice.java index 0e03a710..2a019c2f 100644 --- a/src/main/java/com/yello/server/domain/notice/entity/Notice.java +++ b/src/main/java/com/yello/server/domain/notice/entity/Notice.java @@ -3,6 +3,7 @@ import com.yello.server.global.common.dto.AuditingTimeEntity; import java.time.ZonedDateTime; import javax.persistence.Column; +import javax.persistence.Convert; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -38,4 +39,11 @@ public class Notice extends AuditingTimeEntity { @Column(nullable = false) private Boolean isAvailable; + + @Column(nullable = false) + @Convert(converter = TypeConverter.class) + private String type; + + @Column(nullable = false) + private String title; } \ No newline at end of file diff --git a/src/main/java/com/yello/server/domain/notice/entity/Type.java b/src/main/java/com/yello/server/domain/notice/entity/Type.java new file mode 100644 index 00000000..6d8c21cd --- /dev/null +++ b/src/main/java/com/yello/server/domain/notice/entity/Type.java @@ -0,0 +1,28 @@ +package com.yello.server.domain.notice.entity; + +import java.text.MessageFormat; +import java.util.Arrays; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum Type { + NOTICE("NOTICE"), + BANNER("BANNER"); + + private final String intial; + + public static Type fromCode(String dbData) { + return Arrays.stream(Type.values()) + .filter(v -> v.getIntial().equals(dbData)) + .findAny() + .orElseThrow(() -> new IllegalArgumentException( + MessageFormat.format("존재하지 않는 소셜입니다. {0}", dbData))); + } + + public String intial() { + return intial; + } + +} diff --git a/src/main/java/com/yello/server/domain/notice/entity/TypeConverter.java b/src/main/java/com/yello/server/domain/notice/entity/TypeConverter.java new file mode 100644 index 00000000..5619bf7a --- /dev/null +++ b/src/main/java/com/yello/server/domain/notice/entity/TypeConverter.java @@ -0,0 +1,32 @@ +package com.yello.server.domain.notice.entity; + +import com.yello.server.domain.user.entity.Social; +import javax.persistence.AttributeConverter; +import javax.persistence.Converter; +import lombok.extern.log4j.Log4j2; + +@Converter +@Log4j2 +public class TypeConverter implements AttributeConverter { + + @Override + public String convertToDatabaseColumn(Type type) { + if (type == null) { + return null; + } + return type.getIntial(); + } + + @Override + public Type convertToEntityAttribute(String dbData) { + if (dbData == null) { + return null; + } + try { + return Type.fromCode(dbData); + } catch (IllegalArgumentException exception) { + log.error("failure to convert cause unexpected code" + dbData + exception); + throw exception; + } + } +} diff --git a/src/main/java/com/yello/server/domain/notice/exception/NoticeNotFoundException.java b/src/main/java/com/yello/server/domain/notice/exception/NoticeNotFoundException.java new file mode 100644 index 00000000..e53268ac --- /dev/null +++ b/src/main/java/com/yello/server/domain/notice/exception/NoticeNotFoundException.java @@ -0,0 +1,13 @@ +package com.yello.server.domain.notice.exception; + +import com.yello.server.global.common.ErrorCode; +import com.yello.server.global.exception.CustomException; +import lombok.Getter; + +@Getter +public class NoticeNotFoundException extends CustomException { + + public NoticeNotFoundException(ErrorCode error) { + super(error, "[NoticeNotFoundException] " + error.getMessage()); + } +} diff --git a/src/main/java/com/yello/server/domain/notice/repository/NoticeRepository.java b/src/main/java/com/yello/server/domain/notice/repository/NoticeRepository.java index c993de02..6fc64acd 100644 --- a/src/main/java/com/yello/server/domain/notice/repository/NoticeRepository.java +++ b/src/main/java/com/yello/server/domain/notice/repository/NoticeRepository.java @@ -1,5 +1,12 @@ package com.yello.server.domain.notice.repository; +import com.yello.server.domain.notice.entity.Notice; + +import java.util.Optional; + public interface NoticeRepository { + Optional findTopNotice(); + Notice save(Notice notice); + } diff --git a/src/main/java/com/yello/server/domain/notice/repository/NoticeRepositoryImpl.java b/src/main/java/com/yello/server/domain/notice/repository/NoticeRepositoryImpl.java index 8b3bc062..7d3dae64 100644 --- a/src/main/java/com/yello/server/domain/notice/repository/NoticeRepositoryImpl.java +++ b/src/main/java/com/yello/server/domain/notice/repository/NoticeRepositoryImpl.java @@ -1,9 +1,14 @@ package com.yello.server.domain.notice.repository; +import static com.yello.server.domain.notice.entity.QNotice.notice; + import com.querydsl.jpa.impl.JPAQueryFactory; import com.yello.server.domain.notice.entity.Notice; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.Optional; import lombok.RequiredArgsConstructor; +import org.aspectj.weaver.ast.Not; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; @@ -15,5 +20,22 @@ public class NoticeRepositoryImpl implements NoticeRepository { private final NoticeJpaRepository noticeJpaRepository; private final JPAQueryFactory jpaQueryFactory; - + @Override + public Optional findTopNotice() { + ZoneId zoneId = ZoneId.of("Asia/Seoul"); + ZonedDateTime zonedDateTime = ZonedDateTime.now(zoneId); + return Optional.ofNullable(jpaQueryFactory + .selectFrom(notice) + .where(notice.isAvailable.eq(true) + .and(notice.startDate.loe(zonedDateTime)) + .and(notice.endDate.goe(zonedDateTime))) + .orderBy(notice.endDate.desc()) + .fetchFirst()); + } + + @Override + public Notice save(Notice notice) { + return noticeJpaRepository.save(notice); + } + } diff --git a/src/main/java/com/yello/server/domain/notice/service/NoticeService.java b/src/main/java/com/yello/server/domain/notice/service/NoticeService.java new file mode 100644 index 00000000..9790a1a8 --- /dev/null +++ b/src/main/java/com/yello/server/domain/notice/service/NoticeService.java @@ -0,0 +1,38 @@ +package com.yello.server.domain.notice.service; + +import static com.yello.server.global.common.factory.TimeFactory.compareNowAndEndData; + +import com.yello.server.domain.notice.dto.NoticeDataResponse; +import com.yello.server.domain.notice.entity.Notice; +import com.yello.server.domain.notice.repository.NoticeRepository; +import com.yello.server.domain.user.repository.UserRepository; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import lombok.Builder; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Builder +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class NoticeService { + + private final NoticeRepository noticeRepository; + private final UserRepository userRepository; + + public NoticeDataResponse findNotice(Long userId) { + ZoneId zoneId = ZoneId.of("Asia/Seoul"); + ZonedDateTime now = ZonedDateTime.now(zoneId); + userRepository.findById(userId); + Notice noticeData = + noticeRepository.findTopNotice().orElseGet( + () -> Notice.builder().imageUrl("").redirectUrl("").title("").type("").endDate(now) + .startDate(now).isAvailable(false).build()); + return NoticeDataResponse.of(noticeData, + compareNowAndEndData(noticeData.getEndDate()) && noticeData.getIsAvailable()); + } + + +} diff --git a/src/main/java/com/yello/server/domain/user/dto/response/UserSubscribeDetailResponse.java b/src/main/java/com/yello/server/domain/user/dto/response/UserSubscribeDetailResponse.java index 30616613..03dbf109 100644 --- a/src/main/java/com/yello/server/domain/user/dto/response/UserSubscribeDetailResponse.java +++ b/src/main/java/com/yello/server/domain/user/dto/response/UserSubscribeDetailResponse.java @@ -1,6 +1,7 @@ package com.yello.server.domain.user.dto.response; import static com.yello.server.global.common.factory.TimeFactory.toYearAndMonthFormattedString; +import static com.yello.server.global.common.util.ConstantUtil.SUBSCRIBE_DAYS; import com.yello.server.domain.purchase.entity.Purchase; import lombok.Builder; @@ -16,7 +17,8 @@ public static UserSubscribeDetailResponse of(Purchase purchase) { return UserSubscribeDetailResponse.builder() .id(purchase.getUser().getId()) .subscribe(purchase.getUser().getSubscribe().getIntial()) - .expiredDate(toYearAndMonthFormattedString(purchase.getUpdatedAt())) + .expiredDate( + toYearAndMonthFormattedString(purchase.getUpdatedAt().plusDays(SUBSCRIBE_DAYS))) .build(); } } diff --git a/src/main/java/com/yello/server/global/common/ErrorCode.java b/src/main/java/com/yello/server/global/common/ErrorCode.java index 985be011..b6d00ca8 100644 --- a/src/main/java/com/yello/server/global/common/ErrorCode.java +++ b/src/main/java/com/yello/server/global/common/ErrorCode.java @@ -90,6 +90,7 @@ public enum ErrorCode { NOT_EQUAL_TRANSACTION_EXCEPTION(NOT_FOUND, "동일하지 않은 거래입니다."), NOT_FOUND_NOTIFICATION_TYPE_EXCEPTION(NOT_FOUND, "존재하지 않는 알림 타입 입니다"), NOT_FOUND_USER_SUBSCRIBE_EXCEPTION(NOT_FOUND, "유저의 구독정보가 존재하지 않습니다."), + NOT_FOUND_NOTICE_EXCEPTION(NOT_FOUND, "공지가 존재하지 않습니다."), /** * 409 CONFLICT diff --git a/src/main/java/com/yello/server/global/common/SuccessCode.java b/src/main/java/com/yello/server/global/common/SuccessCode.java index f7eb5d07..72c127d6 100644 --- a/src/main/java/com/yello/server/global/common/SuccessCode.java +++ b/src/main/java/com/yello/server/global/common/SuccessCode.java @@ -48,6 +48,7 @@ public enum SuccessCode { DELETE_QUESTION_ADMIN_SUCCESS(OK, "어드민 권환으로 질문지 삭제에 성공하였습니다."), CLASS_NAME_SEARCH_BY_SCHOOL_NAME_SCHOOL_SUCCESS(OK, "학반 검색에 성공했습니다."), READ_USER_SUBSCRIBE_SUCCESS(OK, "구독 정보 조회에 성공하였습니다."), + READ_NOTICE_SUCCESS(OK, "공지 조회에 성공하였습니다."), /** * 201 CREATED diff --git a/src/main/java/com/yello/server/global/common/factory/TimeFactory.java b/src/main/java/com/yello/server/global/common/factory/TimeFactory.java index 8086c42f..a860a13e 100644 --- a/src/main/java/com/yello/server/global/common/factory/TimeFactory.java +++ b/src/main/java/com/yello/server/global/common/factory/TimeFactory.java @@ -2,6 +2,8 @@ import java.time.Duration; import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; public class TimeFactory { @@ -56,10 +58,16 @@ public static String toYearAndMonthFormattedString(LocalDateTime localDateTime) if (localDateTime == null) { return ""; } - LocalDateTime dateTimePlusSevenDays = localDateTime.plusDays(7); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - return dateTimePlusSevenDays.format(dateTimeFormatter); + return localDateTime.format(dateTimeFormatter); } + public static Boolean compareNowAndEndData(ZonedDateTime zonedDateTime) { + ZoneId zoneId = ZoneId.of("Asia/Seoul"); + ZonedDateTime now = ZonedDateTime.now(zoneId); + + System.out.println(now + " sfsdfsd"); + return now.isBefore(zonedDateTime); + } } diff --git a/src/main/java/com/yello/server/global/common/util/ConstantUtil.java b/src/main/java/com/yello/server/global/common/util/ConstantUtil.java index 44213c44..c10af4d5 100644 --- a/src/main/java/com/yello/server/global/common/util/ConstantUtil.java +++ b/src/main/java/com/yello/server/global/common/util/ConstantUtil.java @@ -65,6 +65,8 @@ public class ConstantUtil { public static final int REFUND_TWO_TICKET = 2; public static final int REFUND_FIVE_TICKET = 5; public static final int NO_FRIEND_COUNT = 0; + public static final int SUBSCRIBE_DAYS = 7; + public static final int PLUS_BASIC_TIME = 0; private ConstantUtil() { diff --git a/src/main/java/com/yello/server/global/exception/ControllerExceptionAdvice.java b/src/main/java/com/yello/server/global/exception/ControllerExceptionAdvice.java index 4524a428..033d32b4 100644 --- a/src/main/java/com/yello/server/global/exception/ControllerExceptionAdvice.java +++ b/src/main/java/com/yello/server/global/exception/ControllerExceptionAdvice.java @@ -23,6 +23,7 @@ import com.yello.server.domain.friend.exception.FriendException; import com.yello.server.domain.friend.exception.FriendNotFoundException; import com.yello.server.domain.group.exception.GroupNotFoundException; +import com.yello.server.domain.notice.exception.NoticeNotFoundException; import com.yello.server.domain.purchase.exception.AppleBadRequestException; import com.yello.server.domain.purchase.exception.AppleTokenServerErrorException; import com.yello.server.domain.purchase.exception.GoogleBadRequestException; @@ -189,7 +190,8 @@ public ResponseEntity ForbiddenException(CustomException exception RedisNotFoundException.class, PurchaseNotFoundException.class, GoogleTokenNotFoundException.class, - UserAdminNotFoundException.class + UserAdminNotFoundException.class, + NoticeNotFoundException.class }) public ResponseEntity NotFoundException(CustomException exception) { return ResponseEntity.status(NOT_FOUND) diff --git a/src/main/resources/static/docs/check-vote-available.html b/src/main/resources/static/docs/check-vote-available.html index 25e39451..0656394b 100644 --- a/src/main/resources/static/docs/check-vote-available.html +++ b/src/main/resources/static/docs/check-vote-available.html @@ -468,7 +468,7 @@

응답

"data" : { "isPossible" : false, "point" : 200, - "createdAt" : "2024-01-25 03:40:17", + "createdAt" : "2024-01-27 15:32:41", "friendStatus" : 1 } } diff --git a/src/main/resources/static/docs/find-friend-votes-v2.html b/src/main/resources/static/docs/find-friend-votes-v2.html new file mode 100644 index 00000000..a9aba8e9 --- /dev/null +++ b/src/main/resources/static/docs/find-friend-votes-v2.html @@ -0,0 +1,641 @@ + + + + + + + +친구 투표 전체 조회 (명세) + + + + + +
+
+

친구 투표 전체 조회 (명세)

+
+
+

요청

+
+
+
GET /v2/vote/friend?page={}&type={} HTTP/1.1
+Authorization: Bearer your-access-token
+Content-Type: application-json
+
+
+
+

업데이트 예정 +- "type": "send" | null

+
+ ++++ + + + + + + +

type

조회할 쪽지 종류 (null → 모든쪽지, send→ 보낸쪽지)

+
+
+

응답

+
+
+
{
+  "status" : 200,
+  "message" : "투표 조회에 성공했습니다.",
+  "data" : {
+    "totalCount" : 1,
+    "friendVotes" : [ {
+            "id" : 1,
+			"senderId" : 1,
+			"senderName" : "name1",
+			"senderGender" : "MALE",
+			"senderYelloId" : "MALE",
+            "senderProfileImage": "imageUrl",
+			"receiverId" : 2,
+            "receiverName" : "name2",
+			"receiverGender" : "MALE",
+			"receiverYelloId" : "MALE",
+			"receiverProfileImage" : "test image",
+            "vote" : {
+                "nameHead" : "나는",
+                "nameFoot" : "와",
+                "keywordHead" : "멋진",
+                "keyword" : "test",
+                "keywordFoot" : "에서 놀고싶어"
+            },
+            "isHintUsed" : false,
+            "createdAt" : "0초 전"
+            "isUserSenderVote" : true
+    } ]
+  }
+}
+
+
+
+

필드 타입

+
+
+
    +
  • +

    "totalCount": Integer

    +
  • +
  • +

    "friendVotes": FriendVote[]

    +
  • +
  • +

    "isUserSenderVote" : Boolean (내가 보냈는지 여부)

    +
  • +
  • +

    FriendVote

    +
    +
      +
    • +

      "id": Long

      +
    • +
    • +

      "senderId" : Long

      +
    • +
    • +

      "senderName" : String

      +
    • +
    • +

      "senderYelloId" : String

      +
    • +
    • +

      "senderGender": "MALE" | "FEMALE"

      +
    • +
    • +

      "senderProfileImage" : String

      +
    • +
    • +

      "receiverId" : Long

      +
    • +
    • +

      "receiverName": String

      +
    • +
    • +

      "receiverYelloId" : String

      +
    • +
    • +

      "receiverGender": "MALE" | "FEMALE"

      +
    • +
    • +

      "receiverProfileImage": String

      +
    • +
    • +

      "vote": Vote

      +
    • +
    • +

      "isHintUsed": Boolean

      +
    • +
    • +

      "createdAt": "{0}초 전" | "{0}분 전" | "{0}시간 전" | "{0}일 전"

      +
    • +
    +
    +
  • +
  • +

    Vote

    +
    +
      +
    • +

      "nameHead": String

      +
    • +
    • +

      "nameFoot": String

      +
    • +
    • +

      "keywordHead": String

      +
    • +
    • +

      "keyword": String

      +
    • +
    • +

      "keywordFoot": String

      +
    • +
    +
    +
  • +
+
+
+
+

NOTE

+
+
    +
  • +

    모든 종류의 쪽지를 조회할 때 /api/v1/vote/friend?page=0 으로 요청해주세요

    +
    +
      +
    • +

      type= 을 명시하지 마세요

      +
    • +
    +
    +
  • +
  • +

    내가 보낸 쪽지를 조회할 때 /api/v1/vote/friend?page=0&type=send 으로 요청해주세요

    +
  • +
  • +

    senderGender 필드가 다른 API와 일관되지 못한점 미안해요 ㅠ

    +
  • +
+
+
+
+

CHANGELOG

+
+
    +
  • +

    2024.01.26 필드 명세 업데이트

    +
  • +
  • +

    2024.01.09 type 명세 업데이트

    +
  • +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/static/docs/find-friend-votes.html b/src/main/resources/static/docs/find-friend-votes.html index 4387f3c3..3ed670df 100644 --- a/src/main/resources/static/docs/find-friend-votes.html +++ b/src/main/resources/static/docs/find-friend-votes.html @@ -5,7 +5,7 @@ -친구 투표 전체 조회 (업데이트) +친구 투표 전체 조회 (최신버전 → v2 확인)