Skip to content

Commit 6494f5d

Browse files
Merge pull request #226 from boostcamp-2020/develop
nginx μ„€μ •ν•œ 배포
2 parents 1176651 + 6cb6977 commit 6494f5d

File tree

28 files changed

+250
-157
lines changed

28 files changed

+250
-157
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 125 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,135 @@
1-
## N석봉
1+
## N석봉 - 가계뢀 μ„œλΉ„μŠ€
2+
<p align='center'>
3+
<img width='50%' src='https://i.imgur.com/c283ZvJ.png'>
4+
</p>
25

3-
> Project16-A-Account-Book
6+
<p align='center'>
7+
<img src="https://img.shields.io/badge/React-v17.0.1-blue?logo=React"/>
8+
<img src="https://img.shields.io/badge/node.js-v14.15.1-green?logo=Node.js"/>
9+
<img src="https://img.shields.io/badge/storybook-v6.0.28-ff69b4?logo=storybook"/>
10+
<img src="https://img.shields.io/badge/koa-v2.13.0-aaa?logo=Kaggle"/>
11+
<img src="https://img.shields.io/badge/mongodb-v4.0.10-critical?logo=mongodb"/>
12+
<img src="https://img.shields.io/badge/mongoose-v5.10.15-critical?logo=mongodb"/>
13+
<img src="https://img.shields.io/badge/Typescript-v4.0.5-blue?logo=typescript"/>
14+
<img src="https://img.shields.io/badge/jest-v26.6.3-orange?logo=jest"/>
15+
<img src="https://img.shields.io/badge/MobX-v6.0.4-orange?logo=Monster">
16+
<img src="https://img.shields.io/badge/prettier-^2.2.0-yellow?logo=prettier" />
17+
<img src="https://img.shields.io/badge/eslint-^7.11.0-yellow?logo=eslint">
18+
<img src="https://img.shields.io/badge/yarn-^1.22.5-yellow?logo=yarn">
19+
</p>
420

5-
<div>
6-
<img src="https://img.shields.io/badge/React-v17.0.1-blue)"/>
7-
<img src="https://img.shields.io/badge/node-v14.15.1-green"/>
8-
<img src="https://img.shields.io/badge/storybook-v6.0.28-ff69b4"/>
9-
<img src="https://img.shields.io/badge/koa-v2.13.0-aaa"/>
10-
<img src="https://img.shields.io/badge/mongoose-v5.10.15-critical"/>
11-
</div>
21+
## 🏠 [HOME PAGE](http://xn--n-b22fl8h.kro.kr)
1222

13-
## πŸ’Έ [HOME PAGE](http://xn--n-b22fl8h.kro.kr/login)
23+
λˆμ€ λ„ˆκ°€ 쓰거라 πŸ€‘, κ΄€λ¦¬λŠ” λ‚΄κ°€ ν• ν…Œλ‹ˆ 😎
1424

15-
λˆμ€ λ„ˆκ°€ 쓰거라, κ΄€λ¦¬λŠ” λ‚΄κ°€ ν• ν…Œλ‹ˆ
25+
## πŸ“Œ 가계뢀 μ„œλΉ„μŠ€ μ†Œκ°œ
26+
### πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘¦ 개인 λ˜λŠ” 곡용으둜 관리할 수 μžˆλŠ” μžμ‚°κ΄€λ¦¬ 가계뢀 μ„œλΉ„μŠ€
27+
> - 혼자만의 가계뢀λ₯Ό 관리할 수 μžˆμŠ΅λ‹ˆλ‹€.
28+
> - 친ꡬλ₯Ό μ΄ˆλŒ€ν•˜μ—¬ ν•¨κ»˜ 가계뢀λ₯Ό 관리할 수 μžˆμŠ΅λ‹ˆλ‹€.
29+
### πŸ“ˆ μ§€μΆœκ³Ό μˆ˜μž…μ— λŒ€ν•œ 톡계 제곡
30+
> - κ·Έλ™μ•ˆμ˜ μ§€μΆœλ‚΄μ—­κ³Ό μˆ˜μž…μ„ **뢄석**ν•˜μ—¬ μž…μΆœκΈˆ ν˜„ν™©μ„ νŒŒμ•…ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
31+
### βœ”οΈ λ‚΄κ°€ 보고 싢은 κ²ƒλ“€λ§Œ 필터링
32+
> - μ›ν•˜λŠ” λ‚΄μ—­λ§Œ **필터링**ν•΄μ„œ λ³Ό 수 μžˆλŠ” κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€.
33+
### πŸ“† 달λ ₯을 ν†΅ν•œ κ±°λž˜λ‚΄μ—­ 확인
34+
> - 달 λ³„λ‘œ 돈의 μ‚¬μš© 내역을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€!
35+
### πŸ“© MMSλ₯Ό μž…λ ₯ν•˜μ—¬ λ°”λ‘œ κ±°λž˜λ‚΄μ—­μ— μΆ”κ°€
36+
> - 문자둜 온 κ±°λž˜λ‚΄μ—­μ„ 치기만 ν•˜λ©΄, λ°”λ‘œ κ±°λž˜λ‚΄μ—­μ— μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
1637
17-
## πŸ“Œ μ†Œκ°œ
38+
<!-- ## πŸ“Œ 기획 λ°°κ²½
39+
- 슀마트폰 기기에 맞좘 μ›Ή μ„œλΉ„μŠ€
40+
-
41+
λ°”μœ 일상을 μ‚΄μ•„κ°€λŠ” ν˜„λŒ€μ‚¬νšŒμΈλ“€μ€ μžκΈˆμ„ 관리해쀄 μ„œλΉ„μŠ€κ°€ ν•„μš”ν•˜μ§€λ§Œ μ‹œκ°„μ„ νˆ¬μžν•˜κΈ°λŠ” 쉽지 μ•ŠμŠ΅λ‹ˆλ‹€. 가계뢀 μ„œλΉ„μŠ€μΈ N석봉은 μ΄λΆ€λΆ„μ—μ„œ ν”„λ‘œμ νŠΈ μ˜λ„λ₯Ό κΈ°νšν–ˆμŠ΅λ‹ˆλ‹€. μ–΄μ©Œκ΅¬ μ €μ©Œκ΅¬
42+
-->
43+
## πŸ“Œ [기술 및 λ…Όμ˜ 정리 - WIKI](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki)
1844

19-
πŸ’° 개인 λ˜λŠ” 곡용으둜 이용 ν•  수 μžˆλŠ” μžμ‚°κ΄€λ¦¬ μ„œλΉ„μŠ€ μž…λ‹ˆλ‹€.
45+
## πŸ“Œ μ£Όμš” κΈ°λŠ₯
2046

21-
πŸ“ˆ μž…λ ₯된 데이터λ₯Ό μ‹œμž‘ν™”ν•˜μ—¬ 뢄석 및 νŒŒμ•… ν•  수 μžˆλŠ” κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€.
47+
|[πŸ”— 둜그인](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%EB%A1%9C%EA%B7%B8%EC%9D%B8-%ED%8E%98%EC%9D%B4%EC%A7%80%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C)|[πŸ”— κ°€κ³„λΆ€λ¦¬μŠ€νŠΈ](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%EA%B3%B5%EC%9C%A0-%EA%B0%80%EA%B3%84%EB%B6%80-%ED%8E%98%EC%9D%B4%EC%A7%80)|[πŸ”— λ©”μΈνŽ˜μ΄μ§€](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%EB%A9%94%EC%9D%B8-%ED%8E%98%EC%9D%B4%EC%A7%80-%EC%86%8C%EA%B0%9C)|[πŸ”— 달λ ₯νŽ˜μ΄μ§€](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%EB%8B%AC%EB%A0%A5-%ED%8E%98%EC%9D%B4%EC%A7%80-%EC%86%8C%EA%B0%9C)|
48+
|:--:|:--:|:--:|:--:|
49+
|![](https://i.imgur.com/Vh06k4p.png)|![](https://i.imgur.com/lfBYG9C.png)|![](https://i.imgur.com/fp18GM8.png)|![](https://i.imgur.com/QqL7sad.png)|
50+
51+
|[πŸ”— ν†΅κ³„νŽ˜μ΄μ§€](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%ED%86%B5%EA%B3%84-%ED%8E%98%EC%9D%B4%EC%A7%80-%EC%86%8C%EA%B0%9C)|[πŸ”— μ±„νŒ…νŽ˜μ΄μ§€](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%EC%B1%84%ED%8C%85-%ED%8E%98%EC%9D%B4%EC%A7%80%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C)|[πŸ”— νƒœκ·ΈνŽ˜μ΄μ§€](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%ED%83%9C%EA%B7%B8-%ED%8E%98%EC%9D%B4%EC%A7%80)|[πŸ”— μ•ŒλžŒ λͺ¨λ‹¬](https://github.com/boostcamp-2020/Project16-A-Account-Book/wiki/%EC%A3%BC%EC%9A%94-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C#-%EC%95%8C%EB%9E%8C-%EB%AA%A8%EB%8B%AC)|
52+
|:--:|:--:|:--:|:--:|
53+
|![](https://i.imgur.com/RDIQb3Q.png)|![](https://i.imgur.com/rhwIsA1.png)|![](https://i.imgur.com/36NIY7b.png)|<img width='500' src='https://i.imgur.com/3N5mWKB.png'>|
54+
55+
## πŸ“Œμ„œλΉ„μŠ€ 흐름
56+
![](https://i.imgur.com/w2UftIk.png)
57+
58+
59+
## βš™οΈ ν”„λ‘œμ νŠΈ ꡬ동 방법
60+
61+
μš°μ„  Repository cloneν•œ ν›„, Project16-A-Account-Book 폴더에 λ“€μ–΄κ°„λ‹€.
62+
63+
**1. λͺ½κ³ λ””λΉ„ μ„€μΉ˜ ν›„ λ°μ΄ν„°λ² μ΄μŠ€ 생성**
64+
**2. λ°±μ—”λ“œ**
65+
- λ°±μ—”λ“œ ν™˜κ²½ λ³€μˆ˜ μ„€μ •
66+
- be 폴더 λ°”λ‘œ 밑에 .env 파일 생성
67+
- .env-template μ•ˆμ— μžˆλŠ” λ‚΄μš© μž‘μ„±
68+
- .env μ˜ˆμ‹œ
69+
- mongodb cloud의 경우 DB_PORTλŠ” μž‘μ„±ν•˜μ§€ μ•ŠκΈ°
70+
```
71+
DB_USER=[λ°μ΄ν„°λ² μ΄μŠ€ μœ μ € 이름 (ex. test)]
72+
73+
DB_PASSWORD=[λ°μ΄ν„°λ² μ΄μŠ€ password (ex. 123123)]
74+
75+
DB_HOST=[λ°μ΄ν„°λ² μ΄μŠ€ 호슀트 이름 (ex. cluster0.3v1lt.mongodb.net)]
76+
77+
DB_DATABASE=[λ°μ΄ν„°λ² μ΄μŠ€ 이름 (ex. account?retryWrites=true&w=majority)]
78+
79+
DB_PORT=[λ°μ΄ν„°λ² μ΄μŠ€ 포트 (ex. 27017)]
80+
81+
JWT_SECRET=[JWT secret key (ex. ajsdFAG430tu04qkn) ]
82+
83+
GITHUB_ID=[GitHub_OAuth_Client_Id (ex. 6df23f10bc0622c89804)]
84+
85+
GITHUB_SECRET=[GitHub_OAuth_Client_Secret]
86+
87+
HOST=[μ„œλ²„ μ£Όμ†Œ (ex. http://localhost)]
88+
89+
BE_PORT=[λ°±μ—”λ“œμ—”λ“œ μ„œλ²„ 포트 (ex. 4000)]
90+
91+
FE_PORT=[ν”„λ‘ νŠΈμ—”λ“œ μ„œλ²„ 포트 (ex. 3000)]
92+
93+
EXPIRES_IN=[JWT 토큰 만료 μ‹œκ°„ (ex. 24h)]
94+
```
95+
96+
- μ‹€ν–‰
97+
98+
```jsx
99+
cd be
100+
yarn
101+
yarn dev
102+
```
103+
or
104+
```jsx
105+
cd be
106+
npm install
107+
npm run dev
108+
```
109+
110+
**3. ν”„λ‘ νŠΈμ—”λ“œ**
111+
- ν”„λ‘ νŠΈμ—”λ“œ ν™˜κ²½ λ³€μˆ˜ μ„€μ •
112+
- fe 폴더 λ°”λ‘œ 밑에 .env.development 파일 생성
113+
- .env_sample에 μžˆλŠ” λ‚΄μš© μž‘μ„±
114+
- .env μ˜ˆμ‹œ
115+
```
116+
REACT_APP_API_URL=[μ„œλ²„ μ£Όμ†Œ (ex. http://localhost)]
117+
118+
REACT_APP_API_PORT=[ν”„λ‘ νŠΈμ—”λ“œ μ„œλ²„ 포트 (ex. 4000)]
119+
```
120+
121+
- μ‹€ν–‰
122+
```jsx
123+
cd fe
124+
yarn
125+
yarn start
126+
```
127+
or
128+
```jsx
129+
cd fe
130+
npm install
131+
npm run start
132+
```
22133
23134
## πŸ“Œ νŒ€μ›μ†Œκ°œ
24135
@@ -27,6 +138,4 @@
27138
| <img src="https://ca.slack-edge.com/T019JFET9H7-U019R14MZQA-3fc3f52ba025-512" alt="img" height="150px" width="150px" /> | <img src="https://avatars1.githubusercontent.com/u/43772082?s=400&u=7b56e9b176e2f44faa90309d6b2e2820ea679a1c&v=4" alt="img" height="150px" width="150px" /> | <img src="https://ca.slack-edge.com/T019JFET9H7-U0198M695JT-ebc94d8fd643-512" alt="img" height="150px" width="150px" /> | <img src="https://ca.slack-edge.com/T019JFET9H7-U019L3LK929-3a96d76029a8-512" alt="img" height="150px" width="150px" /> |
28139
| [dbstjrwnekd](https://github.com/dbstjrwnekd) | [yejineee](https://github.com/yejineee) | [pkiop](https://github.com/pkiop) | [rolled-potatoes](https://github.com/rolled-potatoes) |
29140
30-
## πŸ“Œ 기술 μŠ€νƒ
31141
32-
<center><img src="https://user-images.githubusercontent.com/44409642/99674728-c9ecfc80-2ab9-11eb-8039-06b9ebdc5e38.png"/></center>

β€Žbe/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"scripts": {
3-
"dev": "cd src && nodemon --exec ts-node -r tsconfig-paths/register app.ts",
3+
"dev": "cd src && NODE_ENV=development nodemon --exec ts-node -r tsconfig-paths/register app.ts",
44
"seed": "cd src && NODE_ENV=SEED ts-node -r tsconfig-paths/register seed.ts",
55
"unseed": "cd src && NODE_ENV=UNSEED ts-node -r tsconfig-paths/register seed.ts",
66
"seed-dev": "npm run seed && npm run dev",

β€Žbe/src/.env-templateβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ GITHUB_ID=
88
GITHUB_SECRET=
99
HOST=
1010
BE_PORT=
11-
FE_PORT=
1211
EXPIRES_IN=

β€Žbe/src/app.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ app.use(async (ctx, next) => {
1717
ctx.body = err;
1818
}
1919
});
20-
app.use(cors(corsOptions));
2120

21+
app.use(cors(corsOptions));
2222
app.use(bodyParser());
2323
app.use(Router.routes());
2424
app.use(Router.allowedMethods());

β€Žbe/src/config/index.tsβ€Ž

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ export const getDbUri = () => {
3434
return dbConfig.port ? localUri : srvUri;
3535
};
3636

37-
export const getHostUrl = () => {
38-
return `${hostConfig.url}:${hostConfig.backPort}`;
39-
};
40-
4137
export const getFrontUrl = () => {
42-
return `${hostConfig.url}:${hostConfig.frontPort}`;
38+
const port = process.env.NODE_ENV === 'development' ? ':3000' : '';
39+
return `${hostConfig.url}${port}`;
4340
};
4441

4542
export const corsOptions = {

β€Žbe/src/controllers/user/index.tsβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const getUserByAccessToken = async (ctx: Context) => {
1818
ctx.status = 200;
1919
ctx.body = ctx.request.body.user;
2020
};
21+
2122
export const getInvitation = async (ctx: Context) => {
2223
const { user } = ctx.request.body;
2324
const accounts = await userService.getInvitation(user);
@@ -26,8 +27,16 @@ export const getInvitation = async (ctx: Context) => {
2627
title: account.title,
2728
ownerName: account.ownerName,
2829
host: user.invitations[idx].host,
30+
imageUrl: account.imageUrl,
2931
}));
3032
ctx.body = invitations;
3133
};
3234

35+
export const deleteInvitation = async (ctx: Context) => {
36+
const { user } = ctx.request.body;
37+
const { accountObjId } = ctx.params;
38+
await userService.denyInvitation(user, accountObjId);
39+
ctx.status = 204;
40+
ctx.res.end();
41+
};
3342
export default titleByAccountId;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import Router from 'koa-router';
2-
import { getInvitation } from 'controllers/user';
2+
import { getInvitation, deleteInvitation } from 'controllers/user';
33

44
const router = new Router();
55

66
router.get('/', getInvitation);
7+
router.delete('/:accountObjId', deleteInvitation);
8+
79
export default router;

β€Žbe/src/services/user/index.tsβ€Ž

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UserModel, IUserDocument } from 'models/user';
2-
import { AccountModel, IAccountDocument } from 'models/account';
2+
import { AccountModel } from 'models/account';
33

44
export const titleByAccountId = async (accountId: String) => {
55
const account = await AccountModel.findOne(
@@ -14,14 +14,28 @@ export const getUserList = async () => {
1414
const allUserList = await UserModel.find({}).exec();
1515
return allUserList;
1616
};
17+
1718
export const getInvitation = async (user: IUserDocument) => {
1819
const account: any = user.invitations?.map((invitation) =>
1920
AccountModel.findById(invitation.accounts).select(
20-
'title _id ownerName accountProfile',
21+
'title _id ownerName imageUrl',
2122
),
2223
);
2324
const results = await Promise.all(account);
2425
return results;
2526
};
2627

28+
export const denyInvitation = async (
29+
user: IUserDocument,
30+
accountObjId: string,
31+
) => {
32+
const prevInvitaionLength = user.invitations?.length;
33+
// eslint-disable-next-line no-param-reassign
34+
user.invitations = user.invitations?.filter(
35+
(invitation) => String(invitation.accounts) !== accountObjId,
36+
);
37+
if (user.invitations?.length === prevInvitaionLength)
38+
return Promise.resolve();
39+
return user.save();
40+
};
2741
export default titleByAccountId;

β€Žfe/package.jsonβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"last 1 safari version"
6565
]
6666
},
67+
"proxy":"http://localhost:4000",
6768
"devDependencies": {
6869
"@babel/core": "^7.12.3",
6970
"@storybook/addon-actions": "^6.0.28",

β€Žfe/public/favicon.icoβ€Ž

186 KB
Binary file not shown.

0 commit comments

Comments
Β (0)