Skip to content

Commit

Permalink
Merge pull request #716 from woowacourse-teams/develop
Browse files Browse the repository at this point in the history
release: 1.8.0
  • Loading branch information
InKyoJeong authored Oct 20, 2022
2 parents 24f9d48 + 8d1e2f7 commit 5a52f81
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 14 deletions.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 티타임☕️
우리는 면담을 통해서 위로를 받고 힘을 얻습니다. 하지만 면담을 신청하기가 어렵게 느껴질 때도 있습니다. 이러한 문제를 해결하고 면담을 활성화시키는 것이 저희 서비스의 목표입니다.
티타임을 이용해서 면담을 티타임처럼 즐겨주세요!
<br>

# Let's Teatime! 👀
[![티타임 소개영상](http://img.youtube.com/vi/R8y-4GqqSg0/0.jpg)](https://youtu.be/R8y-4GqqSg0)<br>
⬆️ 티타임 소개 영상 보러가기<br><br>

|스케줄 등록|예약하기|
|---|---|
|![aRHRNGbqVSnKssVF2PnVSVCDzMmoHRoHTYl3PBmNlXSJ8rh9TIAM3m06lbcFEtHlF1bAxyFe2gkgZDQs6mc4mVYbqYyRsUYkh9vmy8HJ5w](https://user-images.githubusercontent.com/60432062/196632784-5c153630-6676-445e-8e5a-4e506845ed5c.gif)|![S2rlanEzVoBhhNWdQ2D-e9mhnCnrwQl7GvQvckVZKm4UVWuE3sq-pfJFvcDZB0IDTmI1_pqMyXI9vVHZ_bTGsvOJn8jKUo93KgHteST1ig](https://user-images.githubusercontent.com/60432062/196633002-204e05b1-ef89-4259-a82d-480a42731f00.gif)|

|질문지 작성|일정 관리|
|---|---|
|![sK5Gy2E9y0BjmpTG-RKwfLTrSPqZ-aaxGesEmfr7yy9F7n4EvFzrzx4rGnNvf1iHjtHLPrGfnJKf1SYP9mZWMS5PVCdeta7MBcKUpvQU5A](https://user-images.githubusercontent.com/60432062/196633305-d4b72c43-eabe-4333-be00-40a952e9571b.gif)|![imCmlf3extrTxRytSDEj0pKyYE-YEiFx_VN8oGn7XeDb4QsAVD-DEjWCdUKyx_keJiltim5Hr3VuhoInXqILmKmE9SKr39Exi-Dd9XGKgA](https://user-images.githubusercontent.com/60432062/196633487-6faabe26-343d-4211-8723-720fc422287a.gif)|
<br>

# 기술 스택 🛠
![image](https://user-images.githubusercontent.com/60432062/196638119-228df2b7-7f3a-463f-b38a-9e02fd50781a.png)
![image](https://user-images.githubusercontent.com/60432062/196638461-45916b20-7900-4733-9db7-9b900899fa9f.png)
<br>

# 인프라 구조 🎢
|Product|CI/CD|
|---|---|
|![image](https://user-images.githubusercontent.com/60432062/196639115-095e362d-e27b-4dd7-aa37-5333af326da1.png)|![image-2](https://user-images.githubusercontent.com/60432062/196639106-2735aec4-f53b-4e3c-bc6b-fa11086db7c0.png)|
<br>

# 팀원들 👩‍💻🧑‍💻
## Frontend
|[](https://github.com/jin7969)|[코이](https://github.com/InKyoJeong)|
| :---------------------------------------------------: | :---------------------------------------------------: |
|<img width="100" alt="image" src="https://user-images.githubusercontent.com/60432062/196651650-e62ae3f3-ddcb-4abc-a458-83d355e7c492.png">|<img width="100" alt="image" src="https://user-images.githubusercontent.com/60432062/196651821-7b031513-4cdd-444b-b60b-8a5b8d3b7108.png">|
## Backend
|[마루](https://github.com/chawani)|[아키](https://github.com/yeongunheo)|[야호](https://github.com/pup-paw)|[](https://github.com/Yboyu0u)|
| :---------------------------------------------------: | :---------------------------------------------------: | :---------------------------------------------------: | :---------------------------------------------------: |
|<img width="100" alt="image" src="https://user-images.githubusercontent.com/60432062/196649143-ab615142-c547-4d70-8d69-d4c47d12d21f.png">|<img width="100" alt="image" src="https://user-images.githubusercontent.com/60432062/196650065-8ad8834c-73fb-4e28-abe9-a805be7979d2.png">|<img width="100" alt="image" src="https://user-images.githubusercontent.com/60432062/196652736-a0157ba6-ffcd-4da4-9435-fc44fa896ee6.png">|<img width="100" alt="image" src="https://user-images.githubusercontent.com/60432062/196652589-0dc92bf8-4608-4c01-9bff-8b88710823af.png">|
<br>

# 팀 문화 💌
## 🌟데일리 문화
1. 데일리는 두 번
2. 컨디션 관리도 실력이다! 개인 컨디션이 팀 컨디션을 좌우한다!
3. 매주 금요일에 팀 문화 회고하기
4. 지각 체크는 신뢰 기반‼️

## 👥 프로젝트 문화
1. 주마다 회의 팀장, 서기 한 명 씩
2. 주제에서 벗어난 이야기가 나오면 / 집중 시키고 싶을때 종치기 🔔
3. 회의 생성시(안건별로) 시작 시간과 마감 시간을 정해두기
4. 이슈는 마주한 사람이 바로바로 공유된 곳에 정리해 놓기 (노션 활용 잘 하기)
5. 평일 10시부터 18시까지는 프로젝트에 집중하기
6. 50분하고 10분 쉬기 - 회의 시작할때 알람⏰ 설정해두기!

## 💬 소통 문화

1. 예쁜말 쓰기 🌈
2. 매주 친목 도모하는 컨텐츠 하기 💖
3. 의견, 질문은 최대한 많이 하고 최대한 잘 받아 주기 (리액션 필수!)
<br>
2 changes: 1 addition & 1 deletion back/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = 'com.woowacourse'
version = '1.6.0-SNAPSHOT-' + new Date().format("yyyyMMddHHmmss")
version = '1.7.0-SNAPSHOT-' + new Date().format("yyyyMMddHHmmss")
sourceCompatibility = '11'

ext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -57,4 +59,13 @@ public ResponseEntity<RefreshAccessTokenResponse> generateToken(
cookieTokenProvider.set(response, generateTokenDto.getRefreshToken());
return ResponseEntity.ok(new RefreshAccessTokenResponse(generateTokenDto.getAccessToken()));
}

@DeleteMapping("/logout")
public ResponseEntity<Void> logout(
@CookieValue(value = "refreshToken", required = false) Cookie cookie,
HttpServletResponse response) {
userAuthService.deleteToken(cookie);
cookieTokenProvider.delete(response, userAuthService.getRefreshToken(cookie));
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,15 @@ public void set(HttpServletResponse response, String refreshToken) {
.build();
response.addHeader(HttpHeaders.SET_COOKIE, cookie.toString());
}

public void delete(HttpServletResponse response, String refreshToken) {
ResponseCookie cookie = ResponseCookie.from("refreshToken", refreshToken)
.maxAge(0)
.path("/")
.secure(true)
.sameSite(SameSite.NONE.name())
.httpOnly(true)
.build();
response.addHeader(HttpHeaders.SET_COOKIE, cookie.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public GenerateTokenDto generateToken(Cookie cookie, String accessToken) {
return new GenerateTokenDto(newAccessToken, newRefreshToken);
}

private String getRefreshToken(Cookie cookie) {
public String getRefreshToken(Cookie cookie) {
if (cookie == null) {
throw new WrongTokenException();
}
Expand All @@ -63,4 +63,9 @@ private String generateAccessToken(UserAuthInfo userAuthInfo) {
Map.of("id", userAuthInfo.getUserId(), "role", Role.valueOf(userAuthInfo.getRole()));
return jwtTokenProvider.createToken(claims);
}

public void deleteToken(Cookie cookie) {
String refreshToken = getRefreshToken(cookie);
userAuthInfoRepository.deleteById(refreshToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doNothing;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.woowacourse.teatime.auth.controller.dto.GenerateTokenDto;
import com.woowacourse.teatime.teatime.controller.ControllerTestSupporter;
import javax.servlet.http.Cookie;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.test.web.servlet.ResultActions;
Expand All @@ -16,7 +18,7 @@ class AuthControllerTest extends ControllerTestSupporter {

@DisplayName("토큰 재발급에 성공한다.")
@Test
void generateToken() throws Exception {
void refreshToken() throws Exception {
//given
String token = "나 크루다.";
크루의_토큰을_검증한다(token);
Expand All @@ -26,10 +28,30 @@ void generateToken() throws Exception {

//when
ResultActions perform = mockMvc.perform(get("/api/auth/refresh-token")
.header("Authorization", "Bearer " + token))
.header("Authorization", "Bearer " + token)
.cookie(new Cookie("refreshToken", "refreshToken")))
.andDo(print());

//then
perform.andExpect(status().isOk());
}

@DisplayName("로그아웃 시 토큰을 삭제한다.")
@Test
void logout() throws Exception {
//given
String token = "나 크루다.";
크루의_토큰을_검증한다(token);

doNothing().when(userAuthService).deleteToken(any());

//when
ResultActions perform = mockMvc.perform(delete("/api/auth/logout")
.header("Authorization", "Bearer " + token)
.cookie(new Cookie("refreshToken", "refreshToken")))
.andDo(print());

//then
perform.andExpect(status().isNoContent());
}
}
4 changes: 3 additions & 1 deletion front/src/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ const login = (code: string) => api.post('/api/auth/login/v2', { code });

const getAccessToken = () => api.get<AccessToken>('/api/auth/refresh-token');

export { login, getAccessToken };
const logout = () => api.delete('/api/auth/logout');

export { login, getAccessToken, logout };
3 changes: 2 additions & 1 deletion front/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from 'axios';

import { clearStorage, getStorage, setStorage } from '@utils/localStorage';
import { ERROR_MESSAGE, LOCAL_DB } from '@constants/index';
import { getAccessToken } from './auth';
import { getAccessToken, logout } from './auth';

const BASE_URL = process.env.BACK_URL;

Expand Down Expand Up @@ -64,6 +64,7 @@ api.interceptors.response.use(
) {
clearStorage(LOCAL_DB.USER);
location.href = `${process.env.REDIRECT_URL}`;
await logout();
return;
}
}
Expand Down
4 changes: 3 additions & 1 deletion front/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import useOutsideClick from '@hooks/useOutsideClick';
import useBoolean from '@hooks/useBoolean';
import { UserStateContext, UserDispatchContext } from '@context/UserProvider';
import { SnackbarContext } from '@context/SnackbarProvider';
import { logout } from '@api/auth';
import { ROUTES, MAX_LENGTH } from '@constants/index';
import { editCrewNickName } from '@api/crew';
import * as S from './styles';
Expand All @@ -25,9 +26,10 @@ const Header = () => {
const { value: isOpenModal, setTrue: openModal, setFalse: closeModal } = useBoolean();
const [nickName, setNickName] = useState('');

const handleLogout = () => {
const handleLogout = async () => {
dispatch({ type: 'DELETE_USER' });
navigate(ROUTES.HOME);
await logout();
};

const toggleDropdown = () => {
Expand Down
11 changes: 8 additions & 3 deletions front/src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ const Home = () => {
const navigate = useNavigate();
const { userData } = useContext(UserStateContext);

const handleLogin = () => {
const handleLoginButton = () => {
location.href = `https://slack.com/openid/connect/authorize?scope=openid,email,profile&response_type=code&redirect_uri=${process.env.REDIRECT_URL}/certification&client_id=3853132979991.3908459157459`;
};

const handleExperienceButton = () => {
location.href = 'http://demo.teatime.pe.kr/';
};

useEffect(() => {
if (userData) {
navigate(`/${userData.role.toLowerCase()}`);
Expand All @@ -36,10 +40,11 @@ const Home = () => {
<p>슬랙로그인으로 시작해보세요!</p>
</S.Description>
<S.ButtonContainer>
<S.SlackButton onClick={handleLogin}>
<S.SlackButton onClick={handleLoginButton}>
<img src={SlackIcon} alt="슬랙 아이콘" />
<span>Slack으로 로그인</span>
<span>Slack 로그인</span>
</S.SlackButton>
<S.ExperienceButton onClick={handleExperienceButton}>체험하기</S.ExperienceButton>
</S.ButtonContainer>
</S.MainSection>
</S.Container>
Expand Down
9 changes: 5 additions & 4 deletions front/src/pages/Home/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Container = styled.div`
`;

const MainSection = styled.section`
padding-top: 100px;
padding-top: 80px;
width: 100vw;
&::before {
Expand Down Expand Up @@ -130,7 +130,7 @@ const ButtonContainer = styled.div`
align-items: center;
justify-content: center;
z-index: 1;
width: 50%;
width: 40%;
height: 70px;
border: none;
border-radius: 12px;
Expand All @@ -156,6 +156,7 @@ const ButtonContainer = styled.div`
button {
width: 100%;
height: 50px;
font-size: 16px;
}
Expand All @@ -177,7 +178,7 @@ const SlackButton = styled.button`
}
`;

const TeamIntroButton = styled.button`
const ExperienceButton = styled.button`
color: ${({ theme }) => theme.colors.BLACK};
background-color: ${({ theme }) => theme.colors.ORANGE_200};
Expand All @@ -194,5 +195,5 @@ export {
OverlapContent,
ButtonContainer,
SlackButton,
TeamIntroButton,
ExperienceButton,
};

0 comments on commit 5a52f81

Please sign in to comment.