송용우

Merge commit '53e17546' into develop

MIT License
Copyright (c) 2020 Yong-Woo Song
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# Jaksimsamil
![issue badge](https://img.shields.io/github/issues/FacerAin/OSS-Jaksimsamil)
![fork badge](https://img.shields.io/github/forks/FacerAin/OSS-Jaksimsamil)
![star badge](https://img.shields.io/github/stars/FacerAin/OSS-Jaksimsamil)
![license badge](https://img.shields.io/github/license/FacerAin/OSS-Jaksimsamil)
## Project Overview
> **Jaksaimsamil Algorithm Study Helper Service**
>
> 작심삼일 알고리즘 문제풀이 도우미 서비스<br/>
>
> > 알고리즘 문제 풀이 스터디를 꾸준히 할 수 있게 돕는 웹 서비스입니다.
> > <br> [링크](http://facerain.dcom.club)에서 직접 사용해 보세요!
![그림1](https://user-images.githubusercontent.com/16442978/85690047-236d1d00-b70e-11ea-8d2b-480593c0daf3.png)
![그림2](https://user-images.githubusercontent.com/16442978/85690058-2536e080-b70e-11ea-98cd-45fdf04084ce.png)
## Features (ver.1.0.0)
- 회원가입/로그인 제공
- Online Judge 연동 가능 (Baekjoon)
- 나의 학습 현황 한눈에 보기
- 추천 문제 제공
- Slack 알리미
## Upcoming Features
- 친구 추가
- 친구와의 경쟁
- 그룹 추가
- 그룹 추천
- 개선된 문제 추천 (사용자 실력 맞춤형)
## Usages
#### 회원
1. 로그인하여 서비스에 접속 할 수 있습니다.
2. 서비스가 처음이라면, 회원가입을 하세요.
<br>
#### 설정
1. 백준 아이디를 등록하고 동기화하세요. [상세]()
2. 슬랙 HOOK URL을 등록하세요. [상세]()
3. 일일 목표량을 등록하세요.
## Getting Started
1. Clone
```
git clone https://github.com/FacerAin/OSS-Jaksimsamil.git
```
2. Install MongoDB(Ubuntu)
```
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
```
3. Set Serverfile
```
cd Jaksimsamil-server
touch .env
---TYPE THIS IN FILE----
SERVER_PORT= ###
MONGO_URL= ###
JWT_SECRET= ###
```
4. Start Node Server
```
cd Jaksimsamil-server
sudo npm install
npm start
```
[링크](/jaksimsamil-server/README.md)에서 API 제공 목록을 볼 수 있습니다.
<br>
5. Set Front-end page
```
cd Jaksimsamil-server
sudo npm install
npm start #Start React
```
## Contributing
컨트리뷰션은 언제나 환영입니다. 다음 절차를 지켜주세요!
1. Fork the Project
2. Create your Feature Branch
3. Commit our changes
4. Push to Branch
5. Open a Pull Request
## License
- MIT LICENCE
......
# Jaksimsamil API Documentation
## Overview
- TBA
## URL
- TBA
## Usage
- TBA
## Example
- TBA
## API Table
| group | description | method | URL | Detail | Auth |
| ------- | --------------------------------- | ------ | ----------------------- | -------- | --------- |
| user | 유저 등록 | POST | api/user | 바로가기 | JWT Token |
| user | 유저 삭제 | DELETE | api/user:id | 바로가기 | JWT Token |
| user | 특정 유저 조회 | GET | api/user:id | 바로가기 | None |
| user | 전체 유저 조회 | GET | api/user | 바로가기 | JWT Token |
| friend | 유저 친구 등록 | POST | api/friend | 바로가기 | JWT Token |
| friend | 유저의 친구 조회 | GET | api/friend:id | 바로가기 | None |
| profile | 유저가 푼 문제 조회(백준) | GET | api/profile/solvedBJ:id | 바로가기 | None |
| profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | 바로가기 | None |
| profile | 유저 정보 수정 | POST | api/profile/setprofile | 바로가기 | JWT TOKEN |
| profile | 유저 정보 받아오기 | POST | api/profile/getprofile | 바로가기 | JWT |
| profile | 추천 문제 조회 | POST | api/profile/recommend | 바로가기 | None |
| notify | 슬랙 메시지 전송 요청 (성취여부) | POST | api/notify/goal | 바로가기 | Jwt Token |
| notify | 슬랙 메시지 전송 요청 (문제 추천) | POST | api/notify/recommend | 바로가기 | None |
| auth | 로그인 | POST | api/auth/login | 바로가기 | None |
| auth | 로그아웃 | POST | api/auth/logout | 바로가기 | JWT Token |
| auth | 회원가입 | POST | api/auth/register | 바로가기 | None |
| auth | 로그인 확인 | GET | api/auth/check | 바로가기 | None |
# Jaksimsamil Server Documentation
## Overview
- KOA 프레임워크 기반의 REST-API로 동작합니다.
- API 문서는 아래를 참고해주세요.
## Usage
- Starting Server
```
npm install
npm update
node index.js
```
## Example
```
POST http://facerain.dcom.club/profile/getprofile
{
username: 'syw5141',
}
```
## API Table
| group | description | method | URL | Detail | Auth |
| ------- | -------------------------------------- | ------ | ----------------------- | -------------------------------------- | --------- |
| profile | 유저가 푼 문제 조회(백준) | GET | api/profile/solvedBJ:id | [바로가기](/src/api/profile/README.md) | None |
| profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | [바로가기](/src/api/profile/README.md) | None |
| profile | 유저 정보 수정 | POST | api/profile/setprofile | [바로가기](/src/api/profile/README.md) | JWT TOKEN |
| profile | 유저 정보 받아오기 | POST | api/profile/getprofile | [바로가기](/src/api/profile/README.md) | JWT |
| profile | 추천 문제 조회 | POST | api/profile/recommend | [바로가기](/src/api/profile/README.md) | None |
| profile | 친구 추가 | POST | /api/profile/addfriend | [바로가기](/src/api/profile/README.md) | JWT TOKEN |
| notify | 슬랙 메시지 전송 요청 (목표 성취 여부) | POST | api/notify/goal | [바로가기](/src/api/notify/README.md) | Jwt Token |
| notify | 슬랙 메시지 전송 요청 (문제 추천) | POST | api/notify/recommend | [바로가기](/src/api/notify/README.md) | None |
| auth | 로그인 | POST | api/auth/login | [바로가기](/src/api/auth/README.md) | None |
| auth | 로그아웃 | POST | api/auth/logout | [바로가기](/src/api/auth/README.md) | JWT Token |
| auth | 회원가입 | POST | api/auth/register | [바로가기](/src/api/auth/README.md) | None |
| auth | 로그인 확인 | GET | api/auth/check | [바로가기](/src/api/auth/README.md) | None |
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
......@@ -5,7 +5,7 @@
"license": "MIT",
"dependencies": {
"axios": "^0.19.2",
"bcrypt": "^4.0.1",
"bcrypt": "^3.0.0",
"body-parser": "^1.19.0",
"cheerio": "^1.0.0-rc.3",
"cookie-parser": "^1.4.5",
......@@ -15,11 +15,11 @@
"iconv": "^3.0.0",
"joi": "^14.3.1",
"jsonwebtoken": "^8.5.1",
"koa": "^2.12.0",
"koa": "^2.13.0",
"koa-bodyparser": "^4.3.0",
"koa-morgan": "^1.0.1",
"koa-router": "^9.0.1",
"mongoose": "^5.9.17",
"mongoose": "^5.9.20",
"morgan": "^1.10.0",
"node-schedule": "^1.3.2",
"path": "^0.12.7",
......@@ -29,11 +29,11 @@
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.1.0",
"eslint": "^7.3.1",
"nodemon": "^2.0.4"
},
"scripts": {
"start": "node src",
"start": "node ./index.js",
"start:dev": "nodemon --watch src/ src/index.js"
}
}
......
This diff could not be displayed because it is too large.
const mongoose = require("mongoose");
const { Schema }=mongoose;
const GroupSchema=new Schema({
members:{type:[String]},
});
const ChallengeSchema=new Schema({
challengeName: {type: String, required: true},
startDate: {type: Object, required: true},
endDate: {type: Object, required: true},
durationPerSession: {type: String, required: true}, // '1d' means one day per session, '2w' means 2 weeks per session, '3m' means 3 months per session.
goalPerSession: {type: Number, required:true}, // number of problems for one session
groups:{type: [GroupSchema], required:true}, // groups attending challenge, group of only one member supposed to be single
});
ChallengeSchema.statics.findByChallengeName=function(challengeName){
return this.findOne({challengeName:challengeName});
}
ChallengeSchema.methods.addNewGroup=function(group){
this.groups.push(group);
return this.save();
}
ChallengeSchema.methods.removeGroup=function(group_id){
const idx=this.groups.findIndex((item)=>item._id===group_id);
this.groups.splice(idx,1);
return this.save();
}
ChallengeSchema.methods.getChallengeName=function(){
return this.challengeName;
}
ChallengeSchema.methods.getStartDate=function(){
return this.startDate;
}
ChallengeSchema.methods.getEndDate=function(){
return this.endDate;
}
ChallengeSchema.method.getDurationPerSession=function(){
return this.durationPerSession;
}
ChallengeSchema.methods.getGoalPerSession=function(){
return this.goalPerSession;
}
ChallengeSchema.methods.getGroups=function(){
return this.groups;
}
ChallengeSchema.methods.serialize=function(){
return this.toJSON();
}
const Challenge=mongoose.model('Challenge',ChallengeSchema);
module.exports=Challenge;
\ No newline at end of file
const mongoose=require('mongoose');
const {Schema}=mongoose;
const ProblemSchema=new Schema({
problemNum: {type: Number, required: true, unique: true},
problemTitle: {type: String, required: true},
solvedacLevel: {type: Number},
sumbitNum: {type: Number, required: true},
correctNum: {type: Number, required: true},
category: {type:[String]}
});
ProblemSchema.statics.findByProblemNum=function(problemNum){
return this.findOne({problemNum:problemNum});
}
ProblemSchema.methods.addCategory=function(category){
this.category.push(category);
return this.save();
}
ProblemSchema.methods.removeCategory=function(category){
const idx=this.category.findIndex(item=>item===category);
this.splice(idx,1);
return this.save();
}
ProblemSchema.methods.getProblemNum=function(){
return this.problemNum;
}
ProblemSchema.methods.getProblemTitle=function(){
return this.problemTitle;
}
ProblemSchema.methods.getSolvedacLevel=function(){
return this.solvedacLevel;
}
ProblemSchema.methods.getSumbitNum=function(){
return this.sumbitNum;
}
ProblemSchema.methods.getCorrectNum=function(){
return this.correctNum;
}
ProblemSchema.methods.getCategory=function(){
return this.category;
}
ProblemSchema.methods.serialize=function(){
return this.toJSON();
}
const Problem=mongoose.model('Problem',ProblemSchema);
module.exports=Problem;
\ No newline at end of file
......@@ -23,4 +23,4 @@ const test = async (userid) => {
/*
*/
test("jwseo001");
test("thak00");
......
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.