Showing
21 changed files
with
300 additions
and
45 deletions
LICENCE
0 → 100644
1 | + | ||
2 | +MIT License | ||
3 | + | ||
4 | +Copyright (c) 2020 Yong-Woo Song | ||
5 | + | ||
6 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | +of this software and associated documentation files (the "Software"), to deal | ||
8 | +in the Software without restriction, including without limitation the rights | ||
9 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
10 | +copies of the Software, and to permit persons to whom the Software is | ||
11 | +furnished to do so, subject to the following conditions: | ||
12 | + | ||
13 | +The above copyright notice and this permission notice shall be included in all | ||
14 | +copies or substantial portions of the Software. | ||
15 | + | ||
16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
22 | +SOFTWARE. | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
No preview for this file type
1 | +# Jaksimsamil | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | +## Project Overview | ||
9 | + | ||
10 | +> **Jaksaimsamil Algorithm Study Helper Service** | ||
11 | +> | ||
12 | +> 작심삼일 알고리즘 문제풀이 도우미 서비스<br/> | ||
13 | +> | ||
14 | +> > 알고리즘 문제 풀이 스터디를 꾸준히 할 수 있게 돕는 웹 서비스입니다. | ||
15 | +> > <br> [링크](http://facerain.dcom.club)에서 직접 사용해 보세요! | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | +## Features (ver.1.0.0) | ||
22 | + | ||
23 | +- 회원가입/로그인 제공 | ||
24 | +- Online Judge 연동 가능 (Baekjoon) | ||
25 | +- 나의 학습 현황 한눈에 보기 | ||
26 | +- 추천 문제 제공 | ||
27 | +- Slack 알리미 | ||
28 | + | ||
29 | +## Upcoming Features | ||
30 | + | ||
31 | +- 친구 추가 | ||
32 | +- 친구와의 경쟁 | ||
33 | +- 그룹 추가 | ||
34 | +- 그룹 추천 | ||
35 | +- 개선된 문제 추천 (사용자 실력 맞춤형) | ||
36 | + | ||
37 | +## Usages | ||
38 | + | ||
39 | +#### 회원 | ||
40 | + | ||
41 | +1. 로그인하여 서비스에 접속 할 수 있습니다. | ||
42 | +2. 서비스가 처음이라면, 회원가입을 하세요. | ||
43 | + <br> | ||
44 | + | ||
45 | +#### 설정 | ||
46 | + | ||
47 | +1. 백준 아이디를 등록하고 동기화하세요. [상세]() | ||
48 | +2. 슬랙 HOOK URL을 등록하세요. [상세]() | ||
49 | +3. 일일 목표량을 등록하세요. | ||
50 | + | ||
51 | +## Getting Started | ||
52 | + | ||
53 | +1. Clone | ||
54 | + | ||
55 | +``` | ||
56 | +git clone https://github.com/FacerAin/OSS-Jaksimsamil.git | ||
57 | +``` | ||
58 | + | ||
59 | +2. Install MongoDB(Ubuntu) | ||
60 | + | ||
61 | +``` | ||
62 | +sudo apt-get update | ||
63 | +sudo apt-get install -y mongodb-org | ||
64 | +sudo service mongod start | ||
65 | +``` | ||
66 | + | ||
67 | +3. Set Serverfile | ||
68 | + | ||
69 | +``` | ||
70 | +cd Jaksimsamil-server | ||
71 | +touch .env | ||
72 | +---TYPE THIS IN FILE---- | ||
73 | +SERVER_PORT= ### | ||
74 | +MONGO_URL= ### | ||
75 | +JWT_SECRET= ### | ||
76 | +``` | ||
77 | + | ||
78 | +4. Start Node Server | ||
79 | + | ||
80 | +``` | ||
81 | +cd Jaksimsamil-server | ||
82 | +sudo npm install | ||
83 | +npm start | ||
84 | +``` | ||
85 | + | ||
86 | +[링크](/jaksimsamil-server/README.md)에서 API 제공 목록을 볼 수 있습니다. | ||
87 | +<br> | ||
88 | + | ||
89 | +5. Set Front-end page | ||
90 | + | ||
91 | +``` | ||
92 | +cd Jaksimsamil-server | ||
93 | +sudo npm install | ||
94 | +npm start #Start React | ||
95 | +``` | ||
96 | + | ||
97 | +## Contributing | ||
98 | + | ||
99 | +컨트리뷰션은 언제나 환영입니다. 다음 절차를 지켜주세요! | ||
100 | + | ||
101 | +1. Fork the Project | ||
102 | +2. Create your Feature Branch | ||
103 | +3. Commit our changes | ||
104 | +4. Push to Branch | ||
105 | +5. Open a Pull Request | ||
106 | + | ||
107 | +## License | ||
108 | + | ||
109 | +- MIT LICENCE | ... | ... |
jaksimsamil-server/API.md
deleted
100644 → 0
1 | -# Jaksimsamil API Documentation | ||
2 | - | ||
3 | -## Overview | ||
4 | - | ||
5 | -- TBA | ||
6 | - | ||
7 | -## URL | ||
8 | - | ||
9 | -- TBA | ||
10 | - | ||
11 | -## Usage | ||
12 | - | ||
13 | -- TBA | ||
14 | - | ||
15 | -## Example | ||
16 | - | ||
17 | -- TBA | ||
18 | - | ||
19 | -## API Table | ||
20 | - | ||
21 | -| group | description | method | URL | Detail | Auth | | ||
22 | -| ------- | --------------------------------- | ------ | ----------------------- | -------- | --------- | | ||
23 | -| user | 유저 등록 | POST | api/user | 바로가기 | JWT Token | | ||
24 | -| user | 유저 삭제 | DELETE | api/user:id | 바로가기 | JWT Token | | ||
25 | -| user | 특정 유저 조회 | GET | api/user:id | 바로가기 | None | | ||
26 | -| user | 전체 유저 조회 | GET | api/user | 바로가기 | JWT Token | | ||
27 | -| friend | 유저 친구 등록 | POST | api/friend | 바로가기 | JWT Token | | ||
28 | -| friend | 유저의 친구 조회 | GET | api/friend:id | 바로가기 | None | | ||
29 | -| profile | 유저가 푼 문제 조회(백준) | GET | api/profile/solvedBJ:id | 바로가기 | None | | ||
30 | -| profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | 바로가기 | None | | ||
31 | -| profile | 유저 정보 수정 | POST | api/profile/setprofile | 바로가기 | JWT TOKEN | | ||
32 | -| profile | 유저 정보 받아오기 | POST | api/profile/getprofile | 바로가기 | JWT | | ||
33 | -| profile | 추천 문제 조회 | POST | api/profile/recommend | 바로가기 | None | | ||
34 | -| notify | 슬랙 메시지 전송 요청 (성취여부) | POST | api/notify/goal | 바로가기 | Jwt Token | | ||
35 | -| notify | 슬랙 메시지 전송 요청 (문제 추천) | POST | api/notify/recommend | 바로가기 | None | | ||
36 | -| auth | 로그인 | POST | api/auth/login | 바로가기 | None | | ||
37 | -| auth | 로그아웃 | POST | api/auth/logout | 바로가기 | JWT Token | | ||
38 | -| auth | 회원가입 | POST | api/auth/register | 바로가기 | None | | ||
39 | -| auth | 로그인 확인 | GET | api/auth/check | 바로가기 | None | |
jaksimsamil-server/README.md
0 → 100644
1 | +# Jaksimsamil Server Documentation | ||
2 | + | ||
3 | +## Overview | ||
4 | + | ||
5 | +- KOA 프레임워크 기반의 REST-API로 동작합니다. | ||
6 | +- API 문서는 아래를 참고해주세요. | ||
7 | + | ||
8 | +## Usage | ||
9 | + | ||
10 | +- Starting Server | ||
11 | + | ||
12 | +``` | ||
13 | +npm install | ||
14 | +npm update | ||
15 | +node index.js | ||
16 | +``` | ||
17 | + | ||
18 | +## Example | ||
19 | + | ||
20 | +``` | ||
21 | +POST http://facerain.dcom.club/profile/getprofile | ||
22 | +{ | ||
23 | + username: 'syw5141', | ||
24 | +} | ||
25 | +``` | ||
26 | + | ||
27 | +## API Table | ||
28 | + | ||
29 | +| group | description | method | URL | Detail | Auth | | ||
30 | +| ------- | -------------------------------------- | ------ | ----------------------- | -------------------------------------- | --------- | | ||
31 | +| profile | 유저가 푼 문제 조회(백준) | GET | api/profile/solvedBJ:id | [바로가기](/src/api/profile/README.md) | None | | ||
32 | +| profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | [바로가기](/src/api/profile/README.md) | None | | ||
33 | +| profile | 유저 정보 수정 | POST | api/profile/setprofile | [바로가기](/src/api/profile/README.md) | JWT TOKEN | | ||
34 | +| profile | 유저 정보 받아오기 | POST | api/profile/getprofile | [바로가기](/src/api/profile/README.md) | JWT | | ||
35 | +| profile | 추천 문제 조회 | POST | api/profile/recommend | [바로가기](/src/api/profile/README.md) | None | | ||
36 | +| profile | 친구 추가 | POST | /api/profile/addfriend | [바로가기](/src/api/profile/README.md) | JWT TOKEN | | ||
37 | +| notify | 슬랙 메시지 전송 요청 (목표 성취 여부) | POST | api/notify/goal | [바로가기](/src/api/notify/README.md) | Jwt Token | | ||
38 | +| notify | 슬랙 메시지 전송 요청 (문제 추천) | POST | api/notify/recommend | [바로가기](/src/api/notify/README.md) | None | | ||
39 | +| auth | 로그인 | POST | api/auth/login | [바로가기](/src/api/auth/README.md) | None | | ||
40 | +| auth | 로그아웃 | POST | api/auth/logout | [바로가기](/src/api/auth/README.md) | JWT Token | | ||
41 | +| auth | 회원가입 | POST | api/auth/register | [바로가기](/src/api/auth/README.md) | None | | ||
42 | +| auth | 로그인 확인 | GET | api/auth/check | [바로가기](/src/api/auth/README.md) | None | |
jaksimsamil-server/access.log
deleted
100644 → 0
This diff could not be displayed because it is too large.
jaksimsamil-server/npm-debug.log
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "dependencies": { | 6 | "dependencies": { |
7 | "axios": "^0.19.2", | 7 | "axios": "^0.19.2", |
8 | - "bcrypt": "^4.0.1", | 8 | + "bcrypt": "^3.0.0", |
9 | "body-parser": "^1.19.0", | 9 | "body-parser": "^1.19.0", |
10 | "cheerio": "^1.0.0-rc.3", | 10 | "cheerio": "^1.0.0-rc.3", |
11 | "cookie-parser": "^1.4.5", | 11 | "cookie-parser": "^1.4.5", |
... | @@ -15,11 +15,11 @@ | ... | @@ -15,11 +15,11 @@ |
15 | "iconv": "^3.0.0", | 15 | "iconv": "^3.0.0", |
16 | "joi": "^14.3.1", | 16 | "joi": "^14.3.1", |
17 | "jsonwebtoken": "^8.5.1", | 17 | "jsonwebtoken": "^8.5.1", |
18 | - "koa": "^2.12.0", | 18 | + "koa": "^2.13.0", |
19 | "koa-bodyparser": "^4.3.0", | 19 | "koa-bodyparser": "^4.3.0", |
20 | "koa-morgan": "^1.0.1", | 20 | "koa-morgan": "^1.0.1", |
21 | "koa-router": "^9.0.1", | 21 | "koa-router": "^9.0.1", |
22 | - "mongoose": "^5.9.17", | 22 | + "mongoose": "^5.9.20", |
23 | "morgan": "^1.10.0", | 23 | "morgan": "^1.10.0", |
24 | "node-schedule": "^1.3.2", | 24 | "node-schedule": "^1.3.2", |
25 | "path": "^0.12.7", | 25 | "path": "^0.12.7", |
... | @@ -29,11 +29,11 @@ | ... | @@ -29,11 +29,11 @@ |
29 | }, | 29 | }, |
30 | "devDependencies": { | 30 | "devDependencies": { |
31 | "babel-eslint": "^10.1.0", | 31 | "babel-eslint": "^10.1.0", |
32 | - "eslint": "^7.1.0", | 32 | + "eslint": "^7.3.1", |
33 | "nodemon": "^2.0.4" | 33 | "nodemon": "^2.0.4" |
34 | }, | 34 | }, |
35 | "scripts": { | 35 | "scripts": { |
36 | - "start": "node src", | 36 | + "start": "node ./index.js", |
37 | "start:dev": "nodemon --watch src/ src/index.js" | 37 | "start:dev": "nodemon --watch src/ src/index.js" |
38 | } | 38 | } |
39 | } | 39 | } | ... | ... |
jaksimsamil-server/src/api/auth/README.md
0 → 100644
File mode changed
jaksimsamil-server/src/api/friend/README.md
0 → 100644
File mode changed
jaksimsamil-server/src/api/notify/README.md
0 → 100644
File mode changed
jaksimsamil-server/src/api/profile/README.md
0 → 100644
1 | +. |
jaksimsamil-server/src/api/user/README.md
0 → 100644
File mode changed
This diff could not be displayed because it is too large.
jaksimsamil-server/src/models/challenge.js
0 → 100644
1 | +const mongoose = require("mongoose"); | ||
2 | + | ||
3 | +const { Schema }=mongoose; | ||
4 | + | ||
5 | +const GroupSchema=new Schema({ | ||
6 | + members:{type:[String]}, | ||
7 | +}); | ||
8 | + | ||
9 | +const ChallengeSchema=new Schema({ | ||
10 | + challengeName: {type: String, required: true}, | ||
11 | + startDate: {type: Object, required: true}, | ||
12 | + endDate: {type: Object, required: true}, | ||
13 | + durationPerSession: {type: String, required: true}, // '1d' means one day per session, '2w' means 2 weeks per session, '3m' means 3 months per session. | ||
14 | + goalPerSession: {type: Number, required:true}, // number of problems for one session | ||
15 | + groups:{type: [GroupSchema], required:true}, // groups attending challenge, group of only one member supposed to be single | ||
16 | +}); | ||
17 | + | ||
18 | +ChallengeSchema.statics.findByChallengeName=function(challengeName){ | ||
19 | + return this.findOne({challengeName:challengeName}); | ||
20 | +} | ||
21 | + | ||
22 | +ChallengeSchema.methods.addNewGroup=function(group){ | ||
23 | + this.groups.push(group); | ||
24 | + return this.save(); | ||
25 | +} | ||
26 | + | ||
27 | +ChallengeSchema.methods.removeGroup=function(group_id){ | ||
28 | + const idx=this.groups.findIndex((item)=>item._id===group_id); | ||
29 | + this.groups.splice(idx,1); | ||
30 | + return this.save(); | ||
31 | +} | ||
32 | + | ||
33 | +ChallengeSchema.methods.getChallengeName=function(){ | ||
34 | + return this.challengeName; | ||
35 | +} | ||
36 | + | ||
37 | +ChallengeSchema.methods.getStartDate=function(){ | ||
38 | + return this.startDate; | ||
39 | +} | ||
40 | + | ||
41 | +ChallengeSchema.methods.getEndDate=function(){ | ||
42 | + return this.endDate; | ||
43 | +} | ||
44 | + | ||
45 | +ChallengeSchema.method.getDurationPerSession=function(){ | ||
46 | + return this.durationPerSession; | ||
47 | +} | ||
48 | + | ||
49 | +ChallengeSchema.methods.getGoalPerSession=function(){ | ||
50 | + return this.goalPerSession; | ||
51 | +} | ||
52 | + | ||
53 | +ChallengeSchema.methods.getGroups=function(){ | ||
54 | + return this.groups; | ||
55 | +} | ||
56 | + | ||
57 | +ChallengeSchema.methods.serialize=function(){ | ||
58 | + return this.toJSON(); | ||
59 | +} | ||
60 | + | ||
61 | +const Challenge=mongoose.model('Challenge',ChallengeSchema); | ||
62 | +module.exports=Challenge; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
jaksimsamil-server/src/models/problem.js
0 → 100644
1 | +const mongoose=require('mongoose'); | ||
2 | + | ||
3 | +const {Schema}=mongoose; | ||
4 | + | ||
5 | +const ProblemSchema=new Schema({ | ||
6 | + problemNum: {type: Number, required: true, unique: true}, | ||
7 | + problemTitle: {type: String, required: true}, | ||
8 | + solvedacLevel: {type: Number}, | ||
9 | + sumbitNum: {type: Number, required: true}, | ||
10 | + correctNum: {type: Number, required: true}, | ||
11 | + category: {type:[String]} | ||
12 | +}); | ||
13 | + | ||
14 | +ProblemSchema.statics.findByProblemNum=function(problemNum){ | ||
15 | + return this.findOne({problemNum:problemNum}); | ||
16 | +} | ||
17 | + | ||
18 | +ProblemSchema.methods.addCategory=function(category){ | ||
19 | + this.category.push(category); | ||
20 | + return this.save(); | ||
21 | +} | ||
22 | + | ||
23 | +ProblemSchema.methods.removeCategory=function(category){ | ||
24 | + const idx=this.category.findIndex(item=>item===category); | ||
25 | + this.splice(idx,1); | ||
26 | + return this.save(); | ||
27 | +} | ||
28 | + | ||
29 | +ProblemSchema.methods.getProblemNum=function(){ | ||
30 | + return this.problemNum; | ||
31 | +} | ||
32 | + | ||
33 | +ProblemSchema.methods.getProblemTitle=function(){ | ||
34 | + return this.problemTitle; | ||
35 | +} | ||
36 | + | ||
37 | +ProblemSchema.methods.getSolvedacLevel=function(){ | ||
38 | + return this.solvedacLevel; | ||
39 | +} | ||
40 | + | ||
41 | +ProblemSchema.methods.getSumbitNum=function(){ | ||
42 | + return this.sumbitNum; | ||
43 | +} | ||
44 | + | ||
45 | +ProblemSchema.methods.getCorrectNum=function(){ | ||
46 | + return this.correctNum; | ||
47 | +} | ||
48 | + | ||
49 | +ProblemSchema.methods.getCategory=function(){ | ||
50 | + return this.category; | ||
51 | +} | ||
52 | + | ||
53 | +ProblemSchema.methods.serialize=function(){ | ||
54 | + return this.toJSON(); | ||
55 | +} | ||
56 | + | ||
57 | +const Problem=mongoose.model('Problem',ProblemSchema); | ||
58 | +module.exports=Problem; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment