Skip to content

Commit

Permalink
chore: 0.5.0 버전을 배포한다.
Browse files Browse the repository at this point in the history
chore: 0.5.0 버전을 배포한다.

Co-authored-by: seungpang <[email protected]>
Co-authored-by: yxxnghwan <[email protected]>
Co-authored-by: kth990303 <[email protected]>
Co-authored-by: asebn1 <[email protected]>
Co-authored-by: prefer2 <[email protected]>
Co-authored-by: soyi47 <[email protected]>
  • Loading branch information
7 people authored Oct 13, 2022
2 parents cba53c6 + bf4d412 commit 4fbd193
Show file tree
Hide file tree
Showing 199 changed files with 4,777 additions and 1,504 deletions.
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,41 @@
# 2022-nae-pyeon
### 내 마음을 편지로
<p align="middle" >
<img width="200px;" src="https://user-images.githubusercontent.com/57438644/192427863-7a67acc7-722c-4618-892a-86c6431bba04.png"/>
</p>
<h1 align="middle">내편</h1>
<p align="middle">내 마음을 편지로, 내편</p>

### 프로젝트 소개 💌
내편은 롤링페이퍼 서비스입니다. 원하는 사람들과 모임을 만들어 롤링페이퍼를 작성할 수 있습니다.
내편 서비스를 통해 `내 편`에게 마음을 전달해보아요!

|FRONTEND|FRONTEND|BACKEND|BACKEND|BACKEND|BACKEND

### 팀원 👩‍👦‍👦

|프론트엔드|프론트엔드|백엔드|백엔드|백엔드|백엔드|
|:-:|:-:|:-:|:-:|:-:|:-:|
|![](https://github.com/prefer2.png?size=100)|![](https://github.com/soyi47.png?size=100)|![](https://github.com/kth990303.png?size=100)|![](https://github.com/seungpang.png?size=100)|![](https://github.com/yxxnghwan.png?size=100)|![](https://github.com/asebn1.png?size=100)
|[도리](https://github.com/prefer2)|[소피아](https://github.com/soyi47)|[케이](https://github.com/kth990303)|[승팡](https://github.com/seungpang)|[알렉스](https://github.com/yxxnghwan)|[제로](https://github.com/asebn1)
|![도리](https://user-images.githubusercontent.com/57438644/194012074-b174c57c-73a1-4987-ba7f-c43e9275bbe2.png?size=100)|![소피아](https://user-images.githubusercontent.com/57438644/194012003-85309c16-a8b9-4cb8-9f29-ea6c41b5dac8.png?size=100)|![케이](https://user-images.githubusercontent.com/57438644/194011499-0d1445fc-6ad8-473b-aec1-55b47ad3bf57.png?size=100)|![승팡](https://user-images.githubusercontent.com/57438644/194011899-3c2ad161-d79e-4d30-b480-b7855ebeeb2c.png?size=100)|![알렉스](https://user-images.githubusercontent.com/57438644/194011294-6a49501a-3cac-4973-8b12-22edb6c3619f.png?size=100)|![제로](https://user-images.githubusercontent.com/57438644/194011739-accc3a55-4d93-435f-aa4c-94db4933ca2f.png?size=100)|
|[도리](https://github.com/prefer2)|[소피아](https://github.com/soyi47)|[케이](https://github.com/kth990303)|[승팡](https://github.com/seungpang)|[알렉스](https://github.com/yxxnghwan)|[제로](https://github.com/asebn1)|


## 프로젝트 기술스택 🏰

### 백엔드 🏫

![백엔드기술스택](https://user-images.githubusercontent.com/57438644/194008987-08fe38f0-7ab6-423a-83d0-dc575c9aaa4f.JPG)

### 프론트엔드 🏡


## 프로젝트 아키텍처 📚

### 백엔드 프로젝트 아키텍처 📙
![백엔드_프로젝트_아키텍처](https://user-images.githubusercontent.com/57438644/194009329-48f0d8a1-66e3-4624-98be-b6ff44ae04f9.JPG)

### 프론트엔드 프로젝트 아키텍처 📘

### CI/CD
![슬라이드5](https://user-images.githubusercontent.com/57438644/194009306-18b6b7be-9ed1-439f-8109-45f94eef9888.JPG)


## 팀 문화
![팀문화](https://user-images.githubusercontent.com/57438644/194008156-205b797c-8592-41d2-924c-c6472f549dde.JPG)
8 changes: 7 additions & 1 deletion backend/src/docs/asciidoc/auth.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
operation::auth-controller-test/kakao-login[snippets='http-request,http-response']

=== 구글 Oauth
operation::auth-controller-test/google-login[snippets='http-request,http-response']
operation::auth-controller-test/google-login[snippets='http-request,http-response']

=== Access Token 재요청
operation::auth-controller-test/renewal-token[snippets='http-request,http-response']

=== 리프레시 토큰 무효화
operation::auth-controller-test/logout[snippets='http-request,http-response']
10 changes: 10 additions & 0 deletions backend/src/docs/asciidoc/errorCodes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
| 모임에게 작성하는 메시지는 비밀로 작성할 수 없습니다. rollingpaperId = {%d}
| 모임에게 작성하는 메시지는 비밀로 작성할 수 없습니다.
| `400 Bad Request`

| `2005`
| 이미 좋아요를 눌렀습니다. memberId={%d} messageId={%d}
| 이미 좋아요를 눌렀습니다.
| `400 Bad Request`

| `2006`
| 이미 좋아요 취소를 눌렀습니다. memberId={%d} messageId={%d}
| 이미 좋아요 취소를 눌렀습니다.
| `400 Bad Request`
|===

=== 유저 에러
Expand Down
6 changes: 6 additions & 0 deletions backend/src/docs/asciidoc/messages.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ operation::message-controller-test/update-message[snippets='http-request,http-re

=== 메시지 삭제
operation::message-controller-test/delete-message[snippets='http-request,http-response']

=== 메시지 좋아요
operation::message-controller-test/like-message[snippets='http-request,http-response']

=== 메시지 좋아요 취소
operation::message-controller-test/cancel-like-message[snippets='http-request,http-response']
14 changes: 13 additions & 1 deletion backend/src/docs/asciidoc/rollingpapers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ operation::rollingpaper-controller-test/create-team-rollingpaper[snippets='http-
=== 롤링페이퍼 단건 조회
operation::rollingpaper-controller-test/find-rollingpaper-by-id[snippets='http-request,http-response']

=== 모임 내 롤링페이퍼 목록 조회
=== 모임 내 전체 롤링페이퍼 목록 조회
operation::rollingpaper-controller-test/find-rollingpapers-by-team-id[snippets='http-request,http-response']

=== 모임 내 팀 롤링페이퍼 목록 조회
operation::rollingpaper-controller-test/find-team-rollingpapers-by-team-id[snippets='http-request,http-response']

=== 모임 내 멤버 롤링페이퍼 목록 조회
operation::rollingpaper-controller-test/find-member-rollingpapers-by-team-id[snippets='http-request,http-response']

=== 모임 내 롤링페이퍼 목록 최신 순 조회
operation::rollingpaper-controller-test/find-rollingpapers-by-team-id-and-latest-order[snippets='http-request,http-response']

=== 모임 내 롤링페이퍼 목록 오래된 순 조회
operation::rollingpaper-controller-test/find-rollingpapers-by-team-id-and-oldest-order[snippets='http-request,http-response']

=== 모임에서 받은 내 롤링페이퍼들 조회
operation::rollingpaper-controller-test/find-rollingpaper-by-id[snippets='http-request,http-response']

Expand Down
4 changes: 2 additions & 2 deletions backend/src/docs/asciidoc/teams.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ operation::team-controller-test/get-my-info-in-team[snippets='http-request,http-
operation::team-controller-test/update-my-info[snippets='http-request,http-response']

=== 모임의 초대 코드 생성
operation::team-controller-test/create-invite-token[snippets='http-request,http-response']
operation::team-controller-test/create-invite-code[snippets='http-request,http-response']

=== 초대 코드로 어떤 팀의 초대 코드인지 조회
operation::team-controller-test/get-team-id-by-invite-token[snippets='http-request,http-response']
operation::team-controller-test/get-team-id-by-invite-code[snippets='http-request,http-response']

=== 초대 코드로 팀 가입
operation::team-controller-test/invite-join[snippets='http-request,http-response']
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public void addInterceptors(final InterceptorRegistry registry) {
registry.addInterceptor(new LoginInterceptor(jwtTokenProvider))
.addPathPatterns("/api/v1/**")
.excludePathPatterns("/api/v1/oauth/**")
.excludePathPatterns("/api/v1/members");
.excludePathPatterns("/api/v1/members")
.excludePathPatterns("/api/v1/renewal-token")
.excludePathPatterns("/api/v1/logout");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.woowacourse.naepyeon.config.batch;

import com.woowacourse.naepyeon.service.AuthService;
import com.woowacourse.naepyeon.service.TeamService;
import java.util.concurrent.TimeUnit;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@EnableScheduling
@Configuration
@RequiredArgsConstructor
public class BatchTaskConfig {

private final TeamService teamService;
private final AuthService authService;

@Scheduled(timeUnit = TimeUnit.HOURS, initialDelay = 0, fixedDelay = 12)
public void scheduleDeleteExpiredInviteCode() {
teamService.deleteExpiredInviteCodes();
}

@Scheduled(timeUnit = TimeUnit.HOURS, initialDelay = 0, fixedDelay = 12)
public void scheduleDeleteExpiredRefreshToken() {
authService.deleteExpiredRefreshTokens();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public boolean preHandle(final HttpServletRequest request, final HttpServletResp
throws Exception {
final CustomCachingRequestWrapper cachingRequest;
try {
cachingRequest = (CustomCachingRequestWrapper) request;
cachingRequest = (CustomCachingRequestWrapper) request;
} catch (final ClassCastException e) {
log.info("로깅 필터가 동작했는지 확인해주세요.");
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.woowacourse.naepyeon.controller.dto.MessageRequest;
import com.woowacourse.naepyeon.controller.dto.MessageUpdateRequest;
import com.woowacourse.naepyeon.service.MessageService;
import com.woowacourse.naepyeon.service.dto.MessageLikeResponseDto;
import com.woowacourse.naepyeon.service.dto.MessageResponseDto;
import java.net.URI;
import javax.validation.Valid;
Expand Down Expand Up @@ -71,4 +72,24 @@ public ResponseEntity<Void> deleteMessage(@AuthenticationPrincipal final LoginMe
messageService.deleteMessage(messageId, loginMemberRequest.getId());
return ResponseEntity.noContent().build();
}

@PostMapping("/{messageId}/likes")
public ResponseEntity<MessageLikeResponseDto> likeMessage(
@AuthenticationPrincipal final LoginMemberRequest loginMemberRequest,
@PathVariable final Long rollingpaperId,
@PathVariable final Long messageId) {
final MessageLikeResponseDto messageLikeResponse =
messageService.likeMessage(loginMemberRequest.getId(), rollingpaperId, messageId);
return ResponseEntity.ok(messageLikeResponse);
}

@DeleteMapping("/{messageId}/likes")
public ResponseEntity<MessageLikeResponseDto> cancelLikeMessage(
@AuthenticationPrincipal final LoginMemberRequest loginMemberRequest,
@PathVariable final Long rollingpaperId,
@PathVariable final Long messageId) {
final MessageLikeResponseDto messageLikeResponse =
messageService.cancelLikeMessage(loginMemberRequest.getId(), messageId);
return ResponseEntity.ok(messageLikeResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
Expand Down Expand Up @@ -65,9 +66,11 @@ public ResponseEntity<RollingpaperResponseDto> findRollingpaperById(
@GetMapping("/rollingpapers")
public ResponseEntity<RollingpapersResponseDto> findRollingpapersByTeamId(
@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@RequestParam(value = "order", required = false, defaultValue = "latest") final String order,
@RequestParam(value = "filter", required = false) final String filter,
@PathVariable final Long teamId) {
final RollingpapersResponseDto rollingpapersResponseDto = rollingpaperService.findByTeamId(teamId,
loginMemberRequest.getId());
final RollingpapersResponseDto rollingpapersResponseDto =
rollingpaperService.findByTeamId(teamId, loginMemberRequest.getId(), order, filter);
return ResponseEntity.ok(rollingpapersResponseDto);
}

Expand All @@ -76,7 +79,7 @@ public ResponseEntity<Void> updateRollingpaper(
@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@PathVariable final Long teamId,
@PathVariable final Long rollingpaperId,
@RequestBody final RollingpaperUpdateRequest updateRequest) {
@RequestBody @Valid final RollingpaperUpdateRequest updateRequest) {
rollingpaperService.updateTitle(rollingpaperId, updateRequest.getTitle(), teamId, loginMemberRequest.getId());
return ResponseEntity.noContent().build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.woowacourse.naepyeon.controller.auth.AuthenticationPrincipal;
import com.woowacourse.naepyeon.controller.dto.CreateResponse;
import com.woowacourse.naepyeon.controller.dto.InviteCodeResponse;
import com.woowacourse.naepyeon.controller.dto.InviteJoinRequest;
import com.woowacourse.naepyeon.controller.dto.InviteTokenResponse;
import com.woowacourse.naepyeon.controller.dto.JoinTeamMemberRequest;
import com.woowacourse.naepyeon.controller.dto.LoginMemberRequest;
import com.woowacourse.naepyeon.controller.dto.TeamRequest;
Expand Down Expand Up @@ -104,7 +104,7 @@ public ResponseEntity<Void> deleteTeam(@AuthenticationPrincipal @Valid final Log
@PostMapping("/{teamId}")
public ResponseEntity<Void> joinMember(@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@PathVariable final Long teamId,
@RequestBody final JoinTeamMemberRequest joinTeamMemberRequest) {
@RequestBody @Valid final JoinTeamMemberRequest joinTeamMemberRequest) {
teamService.joinMember(teamId, loginMemberRequest.getId(), joinTeamMemberRequest.getNickname());
return ResponseEntity.noContent().build();
}
Expand All @@ -121,37 +121,36 @@ public ResponseEntity<TeamMemberResponseDto> getMyInfoInTeam(
public ResponseEntity<Void> updateMyInfo(
@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@PathVariable final Long teamId,
@RequestBody final UpdateTeamParticipantRequest updateTeamParticipantRequest) {
@RequestBody @Valid final UpdateTeamParticipantRequest updateTeamParticipantRequest) {
teamService.updateMyInfo(teamId, loginMemberRequest.getId(), updateTeamParticipantRequest.getNickname());
return ResponseEntity.noContent().build();
}

@PostMapping("/{teamId}/invite")
public ResponseEntity<InviteTokenResponse> createInviteToken(
public ResponseEntity<InviteCodeResponse> createInviteCode(
@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@PathVariable final Long teamId) {
if (!teamService.isJoinedMember(loginMemberRequest.getId(), teamId)) {
throw new UncertificationTeamMemberException(teamId, loginMemberRequest.getId());
}
final String inviteToken = teamService.createInviteToken(teamId);
return ResponseEntity.ok(new InviteTokenResponse(inviteToken));
final String inviteCode = teamService.createInviteCode(teamId);
return ResponseEntity.ok(new InviteCodeResponse(inviteCode));
}

@GetMapping("/invite")
public ResponseEntity<TeamResponseDto> findTeamByInviteToken(
public ResponseEntity<TeamResponseDto> findTeamByInviteCode(
@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@RequestParam("inviteToken") final String inviteToken) {

final TeamResponseDto teamResponseDto = teamService.findTeamByInviteToken(inviteToken,
loginMemberRequest.getId());
@RequestParam("inviteCode") final String inviteCode) {
final TeamResponseDto teamResponseDto =
teamService.findTeamByInviteCode(inviteCode, loginMemberRequest.getId());
return ResponseEntity.ok(teamResponseDto);
}

@PostMapping("/invite/join")
public ResponseEntity<Void> inviteJoin(@AuthenticationPrincipal @Valid final LoginMemberRequest loginMemberRequest,
@RequestBody final InviteJoinRequest inviteJoinRequest) {
@RequestBody @Valid final InviteJoinRequest inviteJoinRequest) {
teamService.inviteJoin(
inviteJoinRequest.getInviteToken(),
inviteJoinRequest.getInviteCode(),
loginMemberRequest.getId(),
inviteJoinRequest.getNickname()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.woowacourse.naepyeon.controller.dto.TokenRequest;
import com.woowacourse.naepyeon.service.AuthService;
import com.woowacourse.naepyeon.service.dto.AccessTokenDto;
import com.woowacourse.naepyeon.service.dto.RefreshTokenDto;
import com.woowacourse.naepyeon.service.dto.TokenResponseDto;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
Expand All @@ -13,22 +15,34 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/oauth")
@RequestMapping("/api/v1")
public class AuthController {

private final AuthService authService;

@PostMapping("/kakao")
@PostMapping("/oauth/kakao")
public ResponseEntity<TokenResponseDto> kakaoLogin(@RequestBody @Valid final TokenRequest tokenRequest) {
final TokenResponseDto tokenResponseDto =
authService.createTokenWithKakaoOauth(tokenRequest.toServiceRequest());
return ResponseEntity.ok(tokenResponseDto);
}

@PostMapping("/google")
@PostMapping("/oauth/google")
public ResponseEntity<TokenResponseDto> googleLogin(@RequestBody @Valid final TokenRequest tokenRequest) {
final TokenResponseDto tokenResponseDto =
authService.createTokenWithGoogleOauth(tokenRequest.toServiceRequest());
return ResponseEntity.ok(tokenResponseDto);
}

@PostMapping("/renewal-token")
public ResponseEntity<AccessTokenDto> renewalToken(@RequestBody @Valid final RefreshTokenDto renewalRequest) {
final AccessTokenDto accessTokenDto = authService.renewalToken(renewalRequest.getRefreshToken());
return ResponseEntity.ok(accessTokenDto);
}

@PostMapping("/logout")
public ResponseEntity<Void> logout(@RequestBody @Valid final RefreshTokenDto refreshTokenDto) {
authService.logout(refreshTokenDto.getRefreshToken());
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Getter
public class InviteTokenResponse {
public class InviteCodeResponse {

private String inviteToken;
private String inviteCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
@Getter
public class InviteJoinRequest {

@NotBlank(message = "4015:올바르지 않은 토큰입니다.")
private String inviteToken;
@NotBlank(message = "4015:올바르지 않은 코드입니다.")
private String inviteCode;

@NotBlank(message = "4009:닉네임은 공백일 수 없습니다.")
private String nickname;
Expand Down
Loading

0 comments on commit 4fbd193

Please sign in to comment.