-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from boostcampwm-2022/dev
[CLIENT & Server] Week3 마무리
- Loading branch information
Showing
117 changed files
with
2,460 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: Server Jest | ||
|
||
on: | ||
push: | ||
branches: [ "main", "dev","dev-be" ] | ||
paths: 'server/**' | ||
pull_request: | ||
branches: [ "main", "dev","dev-be" ] | ||
paths: 'server/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# 해당 저장소의 코드를 가져옵니다. | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
# Node 18 버전을 사용합니다. | ||
- name: Install node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
# yarn을 설치합니다. | ||
- name: Install Yarn | ||
run: npm install yarn | ||
|
||
# 설치된 yarn을 통해 패키지를 설치합니다. | ||
- name: Install dependencies | ||
run: yarn install | ||
|
||
# 테스트 수행과 그 테스트 결과를 xml파일로 생성합니다. | ||
- name: Run tests | ||
run: yarn server-test | tee ./coverage.txt | ||
|
||
# 테스트 결과를 담은 xml 파일을 레포트로 변환합니다. | ||
- name: Test Report | ||
uses: dorny/test-reporter@v1 | ||
if: success() || failure() # run this step even if previous step failed | ||
with: | ||
name: test-results | ||
path: server/junit.xml | ||
fail-on-error: 'false' | ||
reporter: jest-junit # Format of test results | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Jest Coverage Comment | ||
uses: MishaKav/jest-coverage-comment@main | ||
with: | ||
coverage-path: ./coverage.txt | ||
coverage-summary-path: ./server/coverage/coverage-final.json | ||
junitxml-path: ./server/junit.xml | ||
- name: build 실패 시 Slack 알림 | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
author_name: 백엔드 빌드 실패 알림 | ||
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_FAIL_WEBHOOK_URL }} | ||
if: failure() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
env/* | ||
build/* | ||
dist/* | ||
.idea/ | ||
.idea/ | ||
*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'webpack-dev-server'; | ||
|
||
import type { Configuration } from 'webpack'; | ||
|
||
import path from 'path'; | ||
|
||
import { merge } from 'webpack-merge'; | ||
|
||
import common from './webpack.common'; | ||
|
||
const config: Configuration = { | ||
devtool: 'inline-source-map', | ||
mode: 'development', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ['style-loader', 'css-loader', 'postcss-loader'], | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
devServer: { | ||
https: { | ||
key: path.resolve(__dirname, '..', 'localhost+2-key.pem'), | ||
cert: path.resolve(__dirname, '..', 'localhost+2.pem'), | ||
}, | ||
hot: true, | ||
open: true, | ||
historyApiFallback: true, | ||
}, | ||
}; | ||
|
||
export default merge(common, config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import type { SuccessResponse } from '@@types/apis/response'; | ||
|
||
import { API_URL } from '@constants/url'; | ||
import axios from 'axios'; | ||
|
||
export interface SignUpRequest { | ||
id: string; | ||
nickname: string; | ||
password: string; | ||
} | ||
|
||
export interface SignUpResult { | ||
message: string; | ||
} | ||
|
||
export type SignUp = ( | ||
fields: SignUpRequest, | ||
) => Promise<SuccessResponse<SignUpResult>>; | ||
|
||
export const signUp: SignUp = ({ id, nickname, password }) => { | ||
const endPoint = `${API_URL}/api/user/auth/signup`; | ||
|
||
return axios | ||
.post(endPoint, { id, nickname, password }) | ||
.then((response) => response.data); | ||
}; | ||
|
||
export interface SignInRequest { | ||
id: string; | ||
password: string; | ||
} | ||
|
||
export interface SignInResult { | ||
_id: string; | ||
accessToken: string; | ||
} | ||
|
||
export type SignIn = ( | ||
fields: SignInRequest, | ||
) => Promise<SuccessResponse<SignInResult>>; | ||
|
||
export const signIn: SignIn = ({ id, password }) => { | ||
const endPoint = `${API_URL}/api/user/auth/signin`; | ||
|
||
return axios | ||
.post(endPoint, { id, password }, { withCredentials: true }) | ||
.then((response) => response.data); | ||
}; | ||
// 액세스 토큰으로 다시 유저 정보 요청해야함 | ||
// _id, id(이메일), nickname, status, profileUrl, description | ||
|
||
export interface ReissueTokenResult { | ||
accessToken: string; | ||
} | ||
|
||
export type ReissueToken = () => Promise<SuccessResponse<ReissueTokenResult>>; | ||
|
||
export const reissueToken: ReissueToken = () => { | ||
const endPoint = `${API_URL}/api/user/auth/refresh`; | ||
|
||
return axios | ||
.post(endPoint, {}, { withCredentials: true }) | ||
.then((response) => { | ||
return response.data; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { User } from '@apis/user'; | ||
|
||
import { API_URL } from '@constants/url'; | ||
import axios from 'axios'; | ||
|
||
export interface DirectMessage { | ||
_id: string; | ||
user: User; | ||
} | ||
|
||
export type GetDirectMessagesResult = DirectMessage[]; | ||
|
||
export type GetDirectMessages = () => Promise<GetDirectMessagesResult>; | ||
|
||
export const getDirectMessages: GetDirectMessages = () => | ||
axios.get(`${API_URL}/api/user/dms`).then((res) => res.data.result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import type { SuccessResponse } from '@@types/apis/response'; | ||
|
||
import { API_URL } from '@constants/url'; | ||
import axios from 'axios'; | ||
|
||
export type UserStatus = 'online' | 'offline' | 'afk'; | ||
|
||
export interface User { | ||
_id: string; | ||
id: string; | ||
nickname: string; | ||
status: UserStatus; | ||
profileUrl: string; | ||
description: string; | ||
} | ||
|
||
export type MyInfoResult = User; | ||
|
||
type GetMyInfo = () => Promise<MyInfoResult>; | ||
|
||
export const getMyInfo: GetMyInfo = () => { | ||
return axios | ||
.get(`${API_URL}/api/user/auth/me`) | ||
.then((response) => response.data.result); | ||
}; | ||
|
||
export interface GetFollowingsResult { | ||
followings: User[]; | ||
} | ||
export type GetFollowingsResponse = SuccessResponse<GetFollowingsResult>; | ||
|
||
export const getFollowings = (): Promise<GetFollowingsResponse> => | ||
axios.get(`${API_URL}/api/user/followings`).then((res) => res.data); | ||
|
||
export interface UpdateFollowingResult { | ||
message?: string; | ||
} | ||
export type UpdateFollowingResponse = SuccessResponse<UpdateFollowingResult>; | ||
|
||
export const updateFollowing = ( | ||
userId: string, | ||
): Promise<UpdateFollowingResponse> => | ||
axios.post(`${API_URL}/api/user/following/${userId}`).then((res) => res.data); | ||
|
||
export interface GetFollowersResult { | ||
followers: User[]; | ||
} | ||
|
||
export type GetFollowersResponse = SuccessResponse<GetFollowersResult>; | ||
|
||
export const getFollowers = (): Promise<GetFollowersResponse> => | ||
axios.get(`${API_URL}/api/user/followers`).then((res) => res.data); | ||
export interface GetUsersParams { | ||
search: string; | ||
} | ||
export interface GetUsersResult { | ||
users: User[]; | ||
} | ||
|
||
export type GetUsersResponse = SuccessResponse<GetUsersResult>; | ||
|
||
export const GetUsers = (params: GetUsersParams): Promise<GetUsersResponse> => | ||
axios.get(`${API_URL}/api/users`, { params }).then((res) => res.data); |
Oops, something went wrong.
8325801
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8325801
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.