Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into Feature/#86-시연을_위한_시간_모킹
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/unithon/uniletter/event/service/EventService.java
  • Loading branch information
hong-sile committed Apr 7, 2024
2 parents da0ac08 + 7bbdbe2 commit 850501e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 52 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
![UNI-10](https://github.com/Unithon11th-Team5/uniletter-be/assets/66549638/000fe888-0e8d-4a76-8032-198e01186110)
<h3> 💌 특별한 날 특별한 사람에게 보낼 수 있는
예약 문자 서비스, UNILETTER 💌 </h3>

다가오는 나의 특별한 이벤트를 저장할 수 있어요 📝 </br>
나의 특별한 날을 응원할 수 있어요 📣 </br>
친구의 특별한 날에 응원 메시지를 받을 수 있도록 예약 문자를 보낼 수 있어요 💌 </br>

다가오는 나의 특별한 이벤트를 저장할 수 있어요 📝

나의 특별한 날을 응원할 수 있어요 📣

친구의 특별한 날에 응원 메시지를 받을 수 있도록 예약 문자를 보낼 수 있어요 💌


## 🔗 Link
- iOS 배포 예정
Expand All @@ -11,7 +16,8 @@


## 🛠️ Tech Stack
<img width="795" alt="스크린샷 2024-04-06 오후 5 35 46" src="https://github.com/Unithon11th-Team5/backend/assets/66549638/4077d577-24b2-4252-8614-6a97a67e96c0">

<p align="center"><img width="800" alt="스크린샷 2024-04-07 오전 6 44 04" src="https://github.com/Unithon11th-Team5/uniletter-be/assets/66549638/b7d7dc79-f7c7-4c84-a779-707ef9ab979b"></p>


## 💻 Backend Developer
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/unithon/uniletter/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -12,13 +13,22 @@ public class SwaggerConfig {

@Bean
public OpenAPI openAPI() {

return new OpenAPI()
.components(new Components())
.addServersItem(new Server().url("/"))
.info(getPayoutServerInfo());
.info(getUniletterServerInfo())
.components(
new Components().addSecuritySchemes(
"oauth2 token",
new SecurityScheme()
.scheme("bearer")
.type(SecurityScheme.Type.HTTP)
.bearerFormat("jwt")
.name("oauth2")
));
}

private Info getPayoutServerInfo() {
private Info getUniletterServerInfo() {
return new Info().title("Uniletter Server API")
.description("Uniletter Server API 명세서입니다.")
.version("1.0.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ ResponseEntity<Void> addEvent(@RequestBody @Valid final EventAddRequest eventAdd
@ApiResponse(responseCode = "200", description = "SUCCESS"),
@ApiResponse(responseCode = "400", description = "BAD REQUEST",
content = {@Content(schema = @Schema(implementation = ErrorResponse.class))}),
@ApiResponse(responseCode = "404", description = "NOT FOUND",
content = {@Content(schema = @Schema(implementation = ErrorResponse.class))}),
})
@Operation(summary = "이벤트 조회")
ResponseEntity<EventListResponse> readAllEvent(
Expand Down Expand Up @@ -77,6 +79,5 @@ ResponseEntity<EventListResponse> readAllEvent(
ResponseEntity<MessageListResponse> getMessages(
@Parameter(description = "event id", example = "ete-dfdfd-fdfder", required = true)
@RequestParam UUID eventId,
@Parameter(hidden = true)
final Member member);
@Parameter(hidden = true) final Member member);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import unithon.uniletter.common.error.ForbiddenException;
import unithon.uniletter.common.error.NotFoundException;
import unithon.uniletter.event.Event;
import unithon.uniletter.event.EventType;
import unithon.uniletter.event.repository.EventRepository;
import unithon.uniletter.member.Member;
import unithon.uniletter.member.repository.MemberRepository;
import unithon.uniletter.message.dto.MessageResponse;
import unithon.uniletter.message.repository.MessageRepository;
import unithon.uniletter.time.service.TimeGenerator;
Expand All @@ -24,6 +26,7 @@ public class EventService {
private final EventRepository eventRepository;
private final MessageRepository messageRepository;
private final TimeGenerator timeGenerator;
private final MemberRepository memberRepository;

@Transactional
public String addEvent(final Member member, final LocalDate plannedAt, final String content, final EventType type) {
Expand All @@ -39,6 +42,9 @@ public String addEvent(final Member member, final LocalDate plannedAt, final Str

@Transactional(readOnly = true)
public List<Event> findMemberEventAfterToday(final String nickName) {
if (!memberRepository.existsByNickname(nickName)) {
throw new NotFoundException("닉네임에 해당하는 멤버를 찾을 수 없습니다.");
}
return eventRepository.findEventsAfterToday(nickName, timeGenerator.generate());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ ResponseEntity<Void> sendMessage(@Valid @RequestBody final MessageRequest reques
@ApiResponse(responseCode = "500", description = "SERVER ERROR",
content = {@Content(schema = @Schema(implementation = ErrorResponse.class))})
})
@Operation(summary = "읽지 않은 메시지 리스트 조회",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
required = true,
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = UnreadMessageResponse.class))))
@Operation(summary = "읽지 않은 메시지 리스트 조회")
ResponseEntity<UnreadMessageResponse> getUnreadMessages(
@Parameter(hidden = true) final Member member);

Expand All @@ -69,44 +65,7 @@ ResponseEntity<UnreadMessageResponse> getUnreadMessages(
@ApiResponse(responseCode = "500", description = "SERVER ERROR",
content = {@Content(schema = @Schema(implementation = ErrorResponse.class))})
})
@Operation(summary = "받은 전체 메시지 조회",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
required = true,
content = @Content(mediaType = "application/json",
schema = @Schema(implementation = MessageListResponse.class),
examples = {
@ExampleObject(name = "MessageRequestExample", value = """
{
\t"messages": [
\t\t{
\t\t\t"id": "메시지 고유 UUID",
\t\t\t"senderName": "보낸 사람이 설정한 닉네임",
\t\t\t"event": {
\t\t\t\t"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
\t\t\t\t"type": "CHEER_UP",
\t\t\t\t"content": "string",
\t\t\t\t"plannedAt": "2024-04-06"
\t\t\t},
\t\t\t"content": "메시지 내용",
\t\t\t"sentAt": "2024-04-06",
\t\t\t"type": "메시지 타입"
\t\t},
\t\t{
\t\t\t"id": "메시지 고유 UUID",
\t\t\t"senderName": "보낸 사람이 설정한 닉네임",
\t\t\t"event": {
\t\t\t\t"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
\t\t\t\t"type": "CHEER_UP",
\t\t\t\t"content": "string",
\t\t\t\t"plannedAt": "2024-04-06"
\t\t\t},
\t\t\t"content": "메시지 내용",
\t\t\t"sentAt": "2024-04-06",
\t\t\t"type": "메시지 타입"
\t\t}
\t]
}""")
})))
@Operation(summary = "받은 전체 메시지 조회")
ResponseEntity<MessageListResponse> getAllMessages(@Parameter(hidden = true) final Member member);

@ApiResponses(value = {
Expand Down

0 comments on commit 850501e

Please sign in to comment.