송용우

Merge commit '38227cf5' into feature/frontend_page

1 +import React from 'react';
2 +import { makeStyles } from '@material-ui/core/styles';
3 +
4 +import Button from '@material-ui/core/Button';
5 +import TextField from '@material-ui/core/TextField';
6 +
7 +const useStyles = makeStyles((theme) => ({
8 + root: {
9 + '& > *': {
10 + margin: theme.spacing(1),
11 + },
12 + },
13 +}));
14 +
15 +const GoalNumForm = ({ onChange, profile, onGoalNumSubmit }) => {
16 + const classes = useStyles();
17 + return (
18 + <div>
19 + <form onSubmit={onGoalNumSubmit}>
20 + <TextField
21 + name="goalNum"
22 + type="number"
23 + onChange={onChange}
24 + value={profile.goalNum}
25 + placeholder="일일 목표"
26 + label="일일 목표"
27 + InputLabelProps={{
28 + shrink: true,
29 + }}
30 + />
31 + <Button variant="outlined" type="submit">
32 + 등록
33 + </Button>
34 + </form>
35 + </div>
36 + );
37 +};
38 +
39 +export default GoalNumForm;
...@@ -2,9 +2,12 @@ import React from 'react'; ...@@ -2,9 +2,12 @@ import React from 'react';
2 import palette from '../../lib/styles/palette'; 2 import palette from '../../lib/styles/palette';
3 import BJIDForm from './BJIDForm'; 3 import BJIDForm from './BJIDForm';
4 import SlackForm from './SlackForm'; 4 import SlackForm from './SlackForm';
5 +import GoalNumForm from './GoalNumForm';
5 import { makeStyles } from '@material-ui/core/styles'; 6 import { makeStyles } from '@material-ui/core/styles';
6 import Paper from '@material-ui/core/Paper'; 7 import Paper from '@material-ui/core/Paper';
7 import Grid from '@material-ui/core/Grid'; 8 import Grid from '@material-ui/core/Grid';
9 +import CircularProgress from '@material-ui/core/CircularProgress';
10 +import styled from 'styled-components';
8 11
9 const useStyles = makeStyles((theme) => ({ 12 const useStyles = makeStyles((theme) => ({
10 root: { 13 root: {
...@@ -18,15 +21,29 @@ const useStyles = makeStyles((theme) => ({ ...@@ -18,15 +21,29 @@ const useStyles = makeStyles((theme) => ({
18 }, 21 },
19 })); 22 }));
20 23
24 +const LoadingParentStyle = styled.div`
25 + display: flex;
26 + flex-direction: column;
27 + justify-content: center;
28 + align-items: center;
29 + padding-top: 20px;
30 +`;
31 +
21 const SettingForm = ({ 32 const SettingForm = ({
22 onChange, 33 onChange,
23 onBJIDSubmit, 34 onBJIDSubmit,
24 onSlackURLSubmit, 35 onSlackURLSubmit,
25 profile, 36 profile,
26 onSyncBJIDSubmit, 37 onSyncBJIDSubmit,
38 + onGoalNumSubmit,
39 + isLoading,
27 }) => { 40 }) => {
28 const classes = useStyles(); 41 const classes = useStyles();
29 - return ( 42 + return isLoading ? (
43 + <LoadingParentStyle>
44 + <CircularProgress className={classes.loading} />
45 + </LoadingParentStyle>
46 + ) : (
30 <div className={classes.root}> 47 <div className={classes.root}>
31 <Grid container spacing={3}> 48 <Grid container spacing={3}>
32 <Grid item xs={12}> 49 <Grid item xs={12}>
...@@ -54,6 +71,16 @@ const SettingForm = ({ ...@@ -54,6 +71,16 @@ const SettingForm = ({
54 /> 71 />
55 </Paper> 72 </Paper>
56 </Grid> 73 </Grid>
74 +
75 + <Grid container item xs={12}>
76 + <Paper className={classes.paper} elevation={3}>
77 + <GoalNumForm
78 + profile={profile}
79 + onChange={onChange}
80 + onGoalNumSubmit={onGoalNumSubmit}
81 + />
82 + </Paper>
83 + </Grid>
57 </Grid> 84 </Grid>
58 </div> 85 </div>
59 ); 86 );
......
...@@ -3,14 +3,15 @@ import { useDispatch, useSelector } from 'react-redux'; ...@@ -3,14 +3,15 @@ import { useDispatch, useSelector } from 'react-redux';
3 import { withRouter } from 'react-router-dom'; 3 import { withRouter } from 'react-router-dom';
4 import HomeForm from '../../components/home/HomeForm'; 4 import HomeForm from '../../components/home/HomeForm';
5 import { getPROFILE } from '../../modules/profile'; 5 import { getPROFILE } from '../../modules/profile';
6 -import { analyzeBJ } from '../../lib/util/analyzeBJ';
7 const HomeContainer = ({ history }) => { 6 const HomeContainer = ({ history }) => {
8 const dispatch = useDispatch(); 7 const dispatch = useDispatch();
9 const { user, profile } = useSelector(({ user, profile }) => ({ 8 const { user, profile } = useSelector(({ user, profile }) => ({
10 user: user.user, 9 user: user.user,
11 profile: profile, 10 profile: profile,
12 })); 11 }));
13 - useEffect(() => {}, [profile.solvedBJ]); 12 + useEffect(() => {
13 + console.log(profile);
14 + }, [profile.solvedBJ]);
14 useEffect(() => { 15 useEffect(() => {
15 if (user) { 16 if (user) {
16 let username = user.username; 17 let username = user.username;
......
1 -import React, { useEffect } from 'react'; 1 +import React, { useEffect, useState } from 'react';
2 import { useDispatch, useSelector } from 'react-redux'; 2 import { useDispatch, useSelector } from 'react-redux';
3 import { withRouter } from 'react-router-dom'; 3 import { withRouter } from 'react-router-dom';
4 import { 4 import {
...@@ -8,15 +8,20 @@ import { ...@@ -8,15 +8,20 @@ import {
8 syncBJID, 8 syncBJID,
9 initializeProfile, 9 initializeProfile,
10 setSLACK, 10 setSLACK,
11 + setGOALNUM,
11 } from '../../modules/profile'; 12 } from '../../modules/profile';
12 import SettingForm from '../../components/setting/SettingForm'; 13 import SettingForm from '../../components/setting/SettingForm';
13 14
14 const SettingContainer = ({ history }) => { 15 const SettingContainer = ({ history }) => {
16 + const [isLoading, setLoading] = useState(false);
15 const dispatch = useDispatch(); 17 const dispatch = useDispatch();
16 - const { user, profile } = useSelector(({ user, profile }) => ({ 18 + const { user, profile, loading } = useSelector(
19 + ({ user, profile, loading }) => ({
17 user: user.user, 20 user: user.user,
18 profile: profile, 21 profile: profile,
19 - })); 22 + loading: loading,
23 + }),
24 + );
20 25
21 const onChange = (e) => { 26 const onChange = (e) => {
22 const { value, name } = e.target; 27 const { value, name } = e.target;
...@@ -33,6 +38,13 @@ const SettingContainer = ({ history }) => { ...@@ -33,6 +38,13 @@ const SettingContainer = ({ history }) => {
33 let username = profile.username; 38 let username = profile.username;
34 dispatch(syncBJID({ username })); 39 dispatch(syncBJID({ username }));
35 }; 40 };
41 +
42 + const onGoalNumSubmit = (e) => {
43 + e.preventDefault();
44 + let username = profile.username;
45 + let goalNum = profile.goalNum;
46 + dispatch(setGOALNUM({ username, goalNum }));
47 + };
36 const onSlackURLSubmit = (e) => { 48 const onSlackURLSubmit = (e) => {
37 e.preventDefault(); 49 e.preventDefault();
38 let username = profile.username; 50 let username = profile.username;
...@@ -60,6 +72,13 @@ const SettingContainer = ({ history }) => { ...@@ -60,6 +72,13 @@ const SettingContainer = ({ history }) => {
60 }; 72 };
61 } 73 }
62 }, [dispatch, user, history]); 74 }, [dispatch, user, history]);
75 + useEffect(() => {
76 + if (loading['profile/SYNC_BJID'] == true) {
77 + setLoading(true);
78 + } else {
79 + setLoading(false);
80 + }
81 + }, [dispatch, loading]);
63 82
64 return ( 83 return (
65 <SettingForm 84 <SettingForm
...@@ -68,7 +87,9 @@ const SettingContainer = ({ history }) => { ...@@ -68,7 +87,9 @@ const SettingContainer = ({ history }) => {
68 onBJIDSubmit={onBJIDSubmit} 87 onBJIDSubmit={onBJIDSubmit}
69 onSyncBJIDSubmit={onSyncBJIDSubmit} 88 onSyncBJIDSubmit={onSyncBJIDSubmit}
70 onSlackURLSubmit={onSlackURLSubmit} 89 onSlackURLSubmit={onSlackURLSubmit}
90 + onGoalNumSubmit={onGoalNumSubmit}
71 profile={profile} 91 profile={profile}
92 + isLoading={isLoading}
72 ></SettingForm> 93 ></SettingForm>
73 ); 94 );
74 }; 95 };
......
...@@ -17,6 +17,11 @@ const [ ...@@ -17,6 +17,11 @@ const [
17 SET_SLACK_FAILURE, 17 SET_SLACK_FAILURE,
18 ] = createRequestActionTypes('/profile/SET_SLACK'); 18 ] = createRequestActionTypes('/profile/SET_SLACK');
19 const [ 19 const [
20 + SET_GOALNUM,
21 + SET_GOALNUM_SUCCESS,
22 + SET_GOALNUM_FAILURE,
23 +] = createRequestActionTypes('/profile/SET_GOALNUM');
24 +const [
20 GET_PROFILE, 25 GET_PROFILE,
21 GET_PROFILE_SUCCESS, 26 GET_PROFILE_SUCCESS,
22 GET_PROFILE_FAILURE, 27 GET_PROFILE_FAILURE,
...@@ -31,6 +36,7 @@ export const initializeProfile = createAction(INITIALIZE); ...@@ -31,6 +36,7 @@ export const initializeProfile = createAction(INITIALIZE);
31 export const syncBJID = createAction(SYNC_BJID, ({ username }) => ({ 36 export const syncBJID = createAction(SYNC_BJID, ({ username }) => ({
32 username, 37 username,
33 })); 38 }));
39 +
34 export const setSLACK = createAction( 40 export const setSLACK = createAction(
35 SET_SLACK, 41 SET_SLACK,
36 ({ username, slackWebHookURL }) => ({ 42 ({ username, slackWebHookURL }) => ({
...@@ -38,6 +44,14 @@ export const setSLACK = createAction( ...@@ -38,6 +44,14 @@ export const setSLACK = createAction(
38 slackWebHookURL, 44 slackWebHookURL,
39 }), 45 }),
40 ); 46 );
47 +
48 +export const setGOALNUM = createAction(
49 + SET_GOALNUM,
50 + ({ username, goalNum }) => ({
51 + username,
52 + goalNum,
53 + }),
54 +);
41 export const setBJID = createAction(SET_BJID, ({ username, userBJID }) => ({ 55 export const setBJID = createAction(SET_BJID, ({ username, userBJID }) => ({
42 username, 56 username,
43 userBJID, 57 userBJID,
...@@ -58,16 +72,21 @@ const initialState = { ...@@ -58,16 +72,21 @@ const initialState = {
58 friendList: [], 72 friendList: [],
59 profileError: '', 73 profileError: '',
60 slackWebHookURL: '', 74 slackWebHookURL: '',
75 + solvedBJ_date: '',
76 + goalNum: '',
61 }; 77 };
62 const getPROFILESaga = createRequestSaga(GET_PROFILE, profileAPI.getPROFILE); 78 const getPROFILESaga = createRequestSaga(GET_PROFILE, profileAPI.getPROFILE);
63 const setBJIDSaga = createRequestSaga(SET_BJID, profileAPI.setBJID); 79 const setBJIDSaga = createRequestSaga(SET_BJID, profileAPI.setBJID);
64 const setSLACKSaga = createRequestSaga(SET_SLACK, profileAPI.setPROFILE); 80 const setSLACKSaga = createRequestSaga(SET_SLACK, profileAPI.setPROFILE);
81 +const setGOALNUMSaga = createRequestSaga(SET_GOALNUM, profileAPI.setPROFILE);
65 const syncBJIDSaga = createRequestSaga(SYNC_BJID, profileAPI.syncBJ); 82 const syncBJIDSaga = createRequestSaga(SYNC_BJID, profileAPI.syncBJ);
83 +
66 export function* profileSaga() { 84 export function* profileSaga() {
67 yield takeLatest(SET_BJID, setBJIDSaga); 85 yield takeLatest(SET_BJID, setBJIDSaga);
68 yield takeLatest(GET_PROFILE, getPROFILESaga); 86 yield takeLatest(GET_PROFILE, getPROFILESaga);
69 yield takeLatest(SYNC_BJID, syncBJIDSaga); 87 yield takeLatest(SYNC_BJID, syncBJIDSaga);
70 yield takeLatest(SET_SLACK, setSLACKSaga); 88 yield takeLatest(SET_SLACK, setSLACKSaga);
89 + yield takeLatest(SET_GOALNUM, setGOALNUMSaga);
71 } 90 }
72 91
73 export default handleActions( 92 export default handleActions(
...@@ -80,7 +99,15 @@ export default handleActions( ...@@ -80,7 +99,15 @@ export default handleActions(
80 [GET_PROFILE_SUCCESS]: ( 99 [GET_PROFILE_SUCCESS]: (
81 state, 100 state,
82 { 101 {
83 - payload: { username, userBJID, solvedBJ, friendList, slackWebHookURL }, 102 + payload: {
103 + username,
104 + userBJID,
105 + solvedBJ,
106 + friendList,
107 + slackWebHookURL,
108 + solvedBJ_date,
109 + goalNum,
110 + },
84 }, 111 },
85 ) => ({ 112 ) => ({
86 ...state, 113 ...state,
...@@ -90,6 +117,8 @@ export default handleActions( ...@@ -90,6 +117,8 @@ export default handleActions(
90 friendList: friendList, 117 friendList: friendList,
91 profileError: null, 118 profileError: null,
92 slackWebHookURL: slackWebHookURL, 119 slackWebHookURL: slackWebHookURL,
120 + solvedBJ_date: solvedBJ_date,
121 + goalNum: goalNum,
93 }), 122 }),
94 [GET_PROFILE_FAILURE]: (state, { payload: error }) => ({ 123 [GET_PROFILE_FAILURE]: (state, { payload: error }) => ({
95 ...state, 124 ...state,
...@@ -114,6 +143,14 @@ export default handleActions( ...@@ -114,6 +143,14 @@ export default handleActions(
114 ...state, 143 ...state,
115 profileError: error, 144 profileError: error,
116 }), 145 }),
146 + [SET_GOALNUM_SUCCESS]: (state, { payload: { goalNum } }) => ({
147 + ...state,
148 + goalNum: goalNum,
149 + }),
150 + [SET_GOALNUM_FAILURE]: (state, { payload: error }) => ({
151 + ...state,
152 + profileError: error,
153 + }),
117 [SYNC_BJID_SUCCESS]: (state, { payload: { solvedBJ } }) => ({ 154 [SYNC_BJID_SUCCESS]: (state, { payload: { solvedBJ } }) => ({
118 ...state, 155 ...state,
119 solvedBJ, 156 solvedBJ,
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 ## API Table 19 ## API Table
20 20
21 | group | description | method | URL | Detail | Auth | 21 | group | description | method | URL | Detail | Auth |
22 -| ------- | --------------------------- | --------- | ------------------------ | -------- | --------- | 22 +| ------- | --------------------------------- | ------ | ----------------------- | -------- | --------- |
23 | user | 유저 등록 | POST | api/user | 바로가기 | JWT Token | 23 | user | 유저 등록 | POST | api/user | 바로가기 | JWT Token |
24 | user | 유저 삭제 | DELETE | api/user:id | 바로가기 | JWT Token | 24 | user | 유저 삭제 | DELETE | api/user:id | 바로가기 | JWT Token |
25 | user | 특정 유저 조회 | GET | api/user:id | 바로가기 | None | 25 | user | 특정 유저 조회 | GET | api/user:id | 바로가기 | None |
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
30 | profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | 바로가기 | None | 30 | profile | 유저가 푼 문제 동기화(백준) | PATCH | api/profile/syncBJ | 바로가기 | None |
31 | profile | 유저 정보 수정 | POST | api/profile/setprofile | 바로가기 | JWT TOKEN | 31 | profile | 유저 정보 수정 | POST | api/profile/setprofile | 바로가기 | JWT TOKEN |
32 | profile | 유저 정보 받아오기 | POST | api/profile/getprofile | 바로가기 | JWT | 32 | profile | 유저 정보 받아오기 | POST | api/profile/getprofile | 바로가기 | JWT |
33 -| profile | 추천 문제 조회 | GET | api/profile/recommend:id | 바로가기 | None | 33 +| profile | 추천 문제 조회 | POST | api/profile/recommend | 바로가기 | None |
34 -| notify | 슬랙 메시지 전송 요청 | POST | api/notify/ | 34 +| notify | 슬랙 메시지 전송 요청 (성취여부) | POST | api/notify/goal | 바로가기 | Jwt Token |
35 -| slack | 바로가기 | Jwt Token | 35 +| notify | 슬랙 메시지 전송 요청 (문제 추천) | POST | api/notify/recommend | 바로가기 | None |
36 | auth | 로그인 | POST | api/auth/login | 바로가기 | None | 36 | auth | 로그인 | POST | api/auth/login | 바로가기 | None |
37 | auth | 로그아웃 | POST | api/auth/logout | 바로가기 | JWT Token | 37 | auth | 로그아웃 | POST | api/auth/logout | 바로가기 | JWT Token |
38 | auth | 회원가입 | POST | api/auth/register | 바로가기 | None | 38 | auth | 회원가입 | POST | api/auth/register | 바로가기 | None |
......
...@@ -1286,3 +1286,99 @@ ...@@ -1286,3 +1286,99 @@
1286 ::ffff:127.0.0.1 - - [24/Jun/2020:11:31:05 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 16266 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" 1286 ::ffff:127.0.0.1 - - [24/Jun/2020:11:31:05 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 16266 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1287 ::ffff:127.0.0.1 - - [24/Jun/2020:11:39:21 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" 1287 ::ffff:127.0.0.1 - - [24/Jun/2020:11:39:21 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1288 ::ffff:127.0.0.1 - - [24/Jun/2020:11:39:22 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 16266 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54" 1288 ::ffff:127.0.0.1 - - [24/Jun/2020:11:39:22 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 16266 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1289 +::ffff:127.0.0.1 - - [24/Jun/2020:13:41:48 +0000] "PATCH /api/profile/syncBJ HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1290 +::ffff:127.0.0.1 - - [24/Jun/2020:13:42:48 +0000] "PATCH /api/profile/syncBJ HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1291 +::1 - - [24/Jun/2020:13:52:15 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1292 +::1 - - [24/Jun/2020:13:53:07 +0000] "POST /api/profile/recommend HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0"
1293 +::1 - - [24/Jun/2020:13:54:22 +0000] "POST /api/profile/recommend HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0"
1294 +::1 - - [24/Jun/2020:13:54:40 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1295 +::1 - - [24/Jun/2020:13:55:32 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1296 +::1 - - [24/Jun/2020:13:57:11 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1297 +::1 - - [24/Jun/2020:13:57:49 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1298 +::1 - - [24/Jun/2020:13:58:26 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1299 +::ffff:127.0.0.1 - - [24/Jun/2020:13:58:49 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1300 +::1 - - [24/Jun/2020:13:58:59 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1301 +::1 - - [24/Jun/2020:13:59:43 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1302 +::1 - - [24/Jun/2020:14:00:09 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1303 +::1 - - [24/Jun/2020:14:02:01 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1304 +::1 - - [24/Jun/2020:14:02:52 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1305 +::1 - - [24/Jun/2020:14:03:53 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1306 +::1 - - [24/Jun/2020:14:04:43 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1307 +::1 - - [24/Jun/2020:14:05:13 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1308 +::1 - - [24/Jun/2020:14:07:09 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1309 +::1 - - [24/Jun/2020:14:08:00 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1310 +::1 - - [24/Jun/2020:14:09:35 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1311 +::1 - - [24/Jun/2020:14:10:57 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1312 +::1 - - [24/Jun/2020:14:11:19 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1313 +::1 - - [24/Jun/2020:14:12:04 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1314 +::1 - - [24/Jun/2020:14:15:21 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1315 +::1 - - [24/Jun/2020:14:15:24 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1316 +::1 - - [24/Jun/2020:14:15:27 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1317 +::1 - - [24/Jun/2020:14:15:28 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1318 +::1 - - [24/Jun/2020:14:15:30 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1319 +::1 - - [24/Jun/2020:14:15:35 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1320 +::1 - - [24/Jun/2020:14:15:38 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1321 +::1 - - [24/Jun/2020:14:15:40 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1322 +::1 - - [24/Jun/2020:14:19:33 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1323 +::1 - - [24/Jun/2020:14:19:36 +0000] "POST /api/profile/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1324 +::ffff:127.0.0.1 - - [24/Jun/2020:15:35:00 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1325 +::ffff:127.0.0.1 - - [24/Jun/2020:15:35:04 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1326 +::ffff:127.0.0.1 - - [24/Jun/2020:15:35:04 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1327 +::ffff:127.0.0.1 - - [24/Jun/2020:15:35:05 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1328 +::ffff:127.0.0.1 - - [24/Jun/2020:15:37:14 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1329 +::ffff:127.0.0.1 - - [24/Jun/2020:15:37:50 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1330 +::ffff:127.0.0.1 - - [24/Jun/2020:15:37:54 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1331 +::ffff:127.0.0.1 - - [24/Jun/2020:15:37:54 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1332 +::ffff:127.0.0.1 - - [24/Jun/2020:15:37:55 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1333 +::ffff:127.0.0.1 - - [24/Jun/2020:15:39:50 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1334 +::ffff:127.0.0.1 - - [24/Jun/2020:15:39:50 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1335 +::ffff:127.0.0.1 - - [24/Jun/2020:15:39:50 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1336 +::ffff:127.0.0.1 - - [24/Jun/2020:15:39:54 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1337 +::ffff:127.0.0.1 - - [24/Jun/2020:15:40:00 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1338 +::ffff:127.0.0.1 - - [24/Jun/2020:15:40:00 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1339 +::ffff:127.0.0.1 - - [24/Jun/2020:15:40:00 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33281 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1340 +::1 - - [24/Jun/2020:15:40:32 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33293 "-" "PostmanRuntime/7.25.0"
1341 +::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "GET /api/auth/check HTTP/1.1" 200 55 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1342 +::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "POST /api/profile/getprofile HTTP/1.1" 401 12 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1343 +::ffff:127.0.0.1 - - [24/Jun/2020:15:41:51 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1344 +::1 - - [24/Jun/2020:16:47:20 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1345 +::1 - - [24/Jun/2020:16:47:43 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1346 +::1 - - [24/Jun/2020:16:48:07 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1347 +::1 - - [24/Jun/2020:16:49:04 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1348 +::1 - - [24/Jun/2020:16:50:59 +0000] "POST /api/notify/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1349 +::1 - - [24/Jun/2020:16:52:40 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1350 +::ffff:127.0.0.1 - - [24/Jun/2020:16:52:55 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1351 +::1 - - [24/Jun/2020:16:54:01 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1352 +::1 - - [24/Jun/2020:16:54:14 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1353 +::1 - - [24/Jun/2020:16:54:28 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1354 +::1 - - [24/Jun/2020:16:56:14 +0000] "POST /api/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1355 +::1 - - [24/Jun/2020:16:56:33 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "-" "PostmanRuntime/7.25.0"
1356 +::1 - - [24/Jun/2020:16:56:52 +0000] "POST /api/notify/slack/goal HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0"
1357 +::1 - - [24/Jun/2020:16:57:18 +0000] "POST /api/notify/slack/goal HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0"
1358 +::1 - - [24/Jun/2020:16:57:50 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1359 +::1 - - [24/Jun/2020:17:00:04 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1360 +::ffff:127.0.0.1 - - [24/Jun/2020:17:00:27 +0000] "POST /api/profile/getprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1361 +::ffff:127.0.0.1 - - [24/Jun/2020:17:00:29 +0000] "POST /api/profile/setprofile HTTP/1.1" 200 33293 "http://localhost:3000/setting" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36 Edg/83.0.478.54"
1362 +::1 - - [24/Jun/2020:17:00:37 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1363 +::1 - - [24/Jun/2020:17:01:46 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1364 +::ffff:127.0.0.1 - - [24/Jun/2020:17:12:37 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1365 +::1 - - [24/Jun/2020:17:13:17 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1366 +::1 - - [24/Jun/2020:17:13:36 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1367 +::1 - - [24/Jun/2020:17:14:19 +0000] "POST /api/notify/slack/goal HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1368 +::1 - - [24/Jun/2020:17:22:37 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1369 +::1 - - [24/Jun/2020:17:23:06 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1370 +::1 - - [24/Jun/2020:17:27:52 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1371 +::1 - - [24/Jun/2020:17:30:55 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1372 +::1 - - [24/Jun/2020:17:32:42 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1373 +::1 - - [24/Jun/2020:17:34:03 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1374 +::1 - - [24/Jun/2020:17:36:50 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1375 +::1 - - [24/Jun/2020:17:40:43 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0"
1376 +::1 - - [24/Jun/2020:17:42:09 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1377 +::1 - - [24/Jun/2020:17:43:17 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1378 +::1 - - [24/Jun/2020:17:53:11 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1379 +::1 - - [24/Jun/2020:17:53:24 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1380 +::1 - - [24/Jun/2020:17:54:40 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1381 +::1 - - [24/Jun/2020:17:55:11 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1382 +::1 - - [24/Jun/2020:17:55:24 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1383 +::1 - - [24/Jun/2020:17:55:39 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 404 9 "-" "PostmanRuntime/7.25.0"
1384 +::1 - - [24/Jun/2020:18:00:32 +0000] "POST /api/notify/slack/recommend HTTP/1.1" 500 21 "-" "PostmanRuntime/7.25.0"
......
...@@ -3,7 +3,7 @@ const api = new Router(); ...@@ -3,7 +3,7 @@ const api = new Router();
3 3
4 const auth = require("./auth"); 4 const auth = require("./auth");
5 const friend = require("./friend"); 5 const friend = require("./friend");
6 -const notify = require("./profile"); 6 +const notify = require("./notify");
7 const user = require("./user"); 7 const user = require("./user");
8 const profile = require("./profile"); 8 const profile = require("./profile");
9 9
......
1 const Router = require("koa-router"); 1 const Router = require("koa-router");
2 const notify = new Router(); 2 const notify = new Router();
3 - 3 +const slackCtrl = require("./slack.ctrl");
4 -notify.post("/slack"); 4 +notify.post("/slack/goal", slackCtrl.slackGoal);
5 +notify.post("/slack/recommend", slackCtrl.slackRecommend);
5 6
6 module.exports = notify; 7 module.exports = notify;
......
1 +const Profile = require("../../models/profile");
2 +const sendSlack = require("../../util/sendSlack");
3 +const problem_set = require("../../data/problem_set");
4 +const compareBJ = require("../../util/compareBJ");
5 +/*
6 +POST api/notify/slack/goal
7 +{
8 + username: "username"
9 +}
10 +*/
11 +exports.slackGoal = async (ctx) => {
12 + try {
13 + const { username } = ctx.request.body;
14 +
15 + const profile = await Profile.findByUsername(username);
16 + if (!profile) {
17 + ctx.status = 401;
18 + return;
19 + }
20 + let slackURL = profile.getslackURL();
21 + if (!slackURL) {
22 + ctx.status = 401;
23 + return;
24 + }
25 + let goalNum = profile.getgoalNum();
26 + let todayNum = profile.getTodaySovled();
27 + let message = "";
28 + if (goalNum < todayNum) {
29 + message =
30 + "오늘의 목표 " +
31 + goalNum +
32 + "문제 중 " +
33 + todayNum +
34 + "문제를 풀었습니다." +
35 + "\n" +
36 + "잘하셨습니다!";
37 + } else {
38 + message =
39 + "오늘의 목표 " +
40 + goalNum +
41 + "문제 중 " +
42 + todayNum +
43 + "문제를 풀었습니다." +
44 + "\n" +
45 + "분발하세요!";
46 + }
47 +
48 + sendSlack.send(message, slackURL);
49 + } catch (e) {
50 + ctx.throw(500, e);
51 + }
52 +};
53 +
54 +/*
55 +POST api/notify/slack/recommend
56 +{
57 + username: "username"
58 +}
59 +*/
60 +exports.slackRecommend = async (ctx) => {
61 + try {
62 + console.log("1");
63 + const { username } = ctx.request.body;
64 +
65 + const profile = await Profile.findByUsername(username);
66 + if (!profile) {
67 + ctx.status = 401;
68 + return;
69 + }
70 + let slackURL = profile.getslackURL();
71 + if (!slackURL) {
72 + ctx.status = 401;
73 + return;
74 + }
75 + let unsolved_data = compareBJ.compareBJ(
76 + profile.getBJdata(),
77 + problem_set.problem_set
78 + );
79 + let recommendData = compareBJ.randomItem(unsolved_data);
80 +
81 + if (!recommendData) {
82 + ctx.status = 401;
83 + return;
84 + }
85 + let message =
86 + "오늘의 추천 문제는 " +
87 + recommendData.problem_number +
88 + "번 " +
89 + " <https://www.boj.kr/" +
90 + recommendData.problem_number +
91 + "|" +
92 + recommendData.problem_title +
93 + ">" +
94 + " 입니다.";
95 + sendSlack.send(message, slackURL);
96 + } catch (e) {
97 + ctx.throw(500, e);
98 + }
99 +};
1 const Router = require("koa-router"); 1 const Router = require("koa-router");
2 const profile = new Router(); 2 const profile = new Router();
3 const profileCtrl = require("./profile.ctrl"); 3 const profileCtrl = require("./profile.ctrl");
4 -
5 profile.post("/solved:id"); 4 profile.post("/solved:id");
6 profile.get("/solvednum:id"); 5 profile.get("/solvednum:id");
7 -profile.get("/recommendps:id"); 6 +profile.post("/recommend", profileCtrl.recommend);
8 profile.patch("/syncBJ", profileCtrl.syncBJ); 7 profile.patch("/syncBJ", profileCtrl.syncBJ);
9 profile.post("/setprofile", profileCtrl.setProfile); 8 profile.post("/setprofile", profileCtrl.setProfile);
10 profile.post("/getprofile", profileCtrl.getProfile); 9 profile.post("/getprofile", profileCtrl.getProfile);
......
...@@ -2,6 +2,9 @@ const Profile = require("../../models/profile"); ...@@ -2,6 +2,9 @@ const Profile = require("../../models/profile");
2 const mongoose = require("mongoose"); 2 const mongoose = require("mongoose");
3 const getBJ = require("../../util/getBJ"); 3 const getBJ = require("../../util/getBJ");
4 const Joi = require("joi"); 4 const Joi = require("joi");
5 +const analyzeBJ = require("../../util/analyzeBJ");
6 +const compareBJ = require("../../util/compareBJ");
7 +const problem_set = require("../../data/problem_set");
5 8
6 const { ObjectId } = mongoose.Types; 9 const { ObjectId } = mongoose.Types;
7 10
...@@ -47,7 +50,7 @@ exports.setProfile = async (ctx) => { ...@@ -47,7 +50,7 @@ exports.setProfile = async (ctx) => {
47 //freindList: Joi.array().items(Joi.string()), 50 //freindList: Joi.array().items(Joi.string()),
48 }) 51 })
49 .unknown(); 52 .unknown();
50 - 53 + console.log(ctx.request.body);
51 const result = Joi.validate(ctx.request.body, schema); 54 const result = Joi.validate(ctx.request.body, schema);
52 if (result.error) { 55 if (result.error) {
53 ctx.status = 400; 56 ctx.status = 400;
...@@ -95,9 +98,10 @@ exports.syncBJ = async function (ctx) { ...@@ -95,9 +98,10 @@ exports.syncBJ = async function (ctx) {
95 } 98 }
96 const BJID = await profile.getBJID(); 99 const BJID = await profile.getBJID();
97 let BJdata = await getBJ.getBJ(BJID); 100 let BJdata = await getBJ.getBJ(BJID);
101 + let BJdata_date = await analyzeBJ.analyzeBJ(BJdata);
98 const updateprofile = await Profile.findOneAndUpdate( 102 const updateprofile = await Profile.findOneAndUpdate(
99 { username: username }, 103 { username: username },
100 - { solvedBJ: BJdata }, 104 + { solvedBJ: BJdata, solvedBJ_date: BJdata_date },
101 { new: true } 105 { new: true }
102 ).exec(); 106 ).exec();
103 ctx.body = updateprofile; 107 ctx.body = updateprofile;
...@@ -105,3 +109,33 @@ exports.syncBJ = async function (ctx) { ...@@ -105,3 +109,33 @@ exports.syncBJ = async function (ctx) {
105 ctx.throw(500, e); 109 ctx.throw(500, e);
106 } 110 }
107 }; 111 };
112 +
113 +/*
114 +POST /api/proflie/recommend
115 +{
116 + username: 'userid'
117 +}
118 + */
119 +exports.recommend = async (ctx) => {
120 + const { username } = ctx.request.body;
121 +
122 + if (!username) {
123 + ctx.status = 401;
124 + return;
125 + }
126 + try {
127 + const profile = await Profile.findByUsername(username);
128 + if (!profile) {
129 + ctx.status = 401;
130 + return;
131 + }
132 + let unsolved_data = compareBJ.compareBJ(
133 + profile.getBJdata(),
134 + problem_set.problem_set
135 + );
136 + ctx.body = compareBJ.randomItem(unsolved_data);
137 + //데이터가 비었을 떄 예외처리 필요
138 + } catch (e) {
139 + ctx.throw(500, e);
140 + }
141 +};
......
1 -export const problem_set = [ 1 +exports.problem_set = [
2 - "1517", 2 + {
3 - "2448", 3 + problem_number: "1517",
4 - "1891", 4 + problem_title: "버블 소트",
5 - "1074", 5 + solved_date: "20200621",
6 - "2263", 6 + },
7 - "1780", 7 + {
8 - "11728", 8 + problem_number: "2448",
9 - "10816", 9 + problem_title: "별 찍기 - 11",
10 - "10815", 10 + solved_date: "20200621",
11 - "2109", 11 + },
12 - "1202", 12 + { problem_number: "1891", problem_title: "사분면", solved_date: "20200621" },
13 - "1285", 13 + { problem_number: "1074", problem_title: "Z", solved_date: "20200620" },
14 - "2138", 14 + {
15 - "1080", 15 + problem_number: "2263",
16 - "11399", 16 + problem_title: "트리의 순회",
17 - "1931", 17 + solved_date: "20200620",
18 - "11047", 18 + },
19 - "15666", 19 + {
20 - "15665", 20 + problem_number: "1780",
21 - "15664", 21 + problem_title: "종이의 개수",
22 - "15663", 22 + solved_date: "20200619",
23 - "15657", 23 + },
24 - "15656", 24 + {
25 - "15655", 25 + problem_number: "11728",
26 - "15654", 26 + problem_title: "배열 합치기",
27 - "15652", 27 + solved_date: "20200619",
28 - "15651", 28 + },
29 - "15650", 29 + {
30 - "15649", 30 + problem_number: "10816",
31 - "6603", 31 + problem_title: "숫자 카드 2",
32 - "10971", 32 + solved_date: "20200619",
33 - "10819", 33 + },
34 - "10973", 34 + {
35 - "10974", 35 + problem_number: "10815",
36 - "10972", 36 + problem_title: "숫자 카드",
37 - "7576", 37 + solved_date: "20200619",
38 - "1248", 38 + },
39 - "2529", 39 + {
40 - "15661", 40 + problem_number: "2109",
41 - "14501", 41 + problem_title: "순회강연",
42 - "1759", 42 + solved_date: "20200619",
43 - "14391", 43 + },
44 - "14889", 44 + {
45 - "1182", 45 + problem_number: "1202",
46 - "11723", 46 + problem_title: "보석 도둑",
47 - "1748", 47 + solved_date: "20200619",
48 - "6064", 48 + },
49 - "1107", 49 + {
50 - "3085", 50 + problem_number: "1285",
51 - "2309", 51 + problem_title: "동전 뒤집기",
52 - "1748", 52 + solved_date: "20200617",
53 - "14500", 53 + },
54 - "1107", 54 + {
55 - "1476", 55 + problem_number: "2138",
56 - "3085", 56 + problem_title: "전구와 스위치",
57 - "2309", 57 + solved_date: "20200617",
58 - "1261", 58 + },
59 - "13549", 59 + { problem_number: "1080", problem_title: "행렬", solved_date: "20200617" },
60 - "14226", 60 + { problem_number: "11399", problem_title: "ATM", solved_date: "20200616" },
61 - "13913", 61 + {
62 - "1697", 62 + problem_number: "1931",
63 - "1967", 63 + problem_title: "회의실배정",
64 - "1167", 64 + solved_date: "20200616",
65 - "11725", 65 + },
66 - "2250", 66 + { problem_number: "11047", problem_title: "동전 0", solved_date: "20200615" },
67 - "1991", 67 + {
68 - "7562", 68 + problem_number: "15666",
69 - "2178", 69 + problem_title: "N과 M (12)",
70 - "4963", 70 + solved_date: "20200614",
71 - "2667", 71 + },
72 - "1707", 72 + {
73 - "11724", 73 + problem_number: "15665",
74 - "1260", 74 + problem_title: "N과 M (11)",
75 - "13023", 75 + solved_date: "20200614",
76 - "11652", 76 + },
77 - "1377", 77 + {
78 - "11004", 78 + problem_number: "15664",
79 - "10825", 79 + problem_title: "N과 M (10)",
80 - "2751", 80 + solved_date: "20200614",
81 - "9461", 81 + },
82 - "1699", 82 + {
83 - "9095", 83 + problem_number: "15663",
84 - "2225", 84 + problem_title: "N과 M (9)",
85 - "2133", 85 + solved_date: "20200614",
86 - "11727", 86 + },
87 - "11726", 87 + {
88 - "1463", 88 + problem_number: "15657",
89 - "2748", 89 + problem_title: "N과 M (8)",
90 - "2747", 90 + solved_date: "20200614",
91 - "11656", 91 + },
92 - "10824", 92 + {
93 - "2743", 93 + problem_number: "15656",
94 - "10820", 94 + problem_title: "N과 M (7)",
95 - "10808", 95 + solved_date: "20200614",
96 - "11655", 96 + },
97 - "11720", 97 + {
98 - "1008", 98 + problem_number: "15655",
99 - "10951", 99 + problem_title: "N과 M (6)",
100 - "2557", 100 + solved_date: "20200614",
101 - "1021", 101 + },
102 - "1966", 102 + {
103 - "2164", 103 + problem_number: "15654",
104 - "10799", 104 + problem_title: "N과 M (5)",
105 - "17413", 105 + solved_date: "20200614",
106 - "10866", 106 + },
107 - "1158", 107 + {
108 - "10845", 108 + problem_number: "15652",
109 - "1406", 109 + problem_title: "N과 M (4)",
110 - "1874", 110 + solved_date: "20200614",
111 - "9012", 111 + },
112 - "9093", 112 + {
113 - "10828", 113 + problem_number: "15651",
114 - "11721", 114 + problem_title: "N과 M (3)",
115 - "11719", 115 + solved_date: "20200612",
116 - "11718", 116 + },
117 - "10953", 117 + {
118 - "2558", 118 + problem_number: "15650",
119 - "10814", 119 + problem_title: "N과 M (2)",
120 - "1181", 120 + solved_date: "20200612",
121 - "11651", 121 + },
122 - "11650", 122 + {
123 - "1427", 123 + problem_number: "15649",
124 - "2108", 124 + problem_title: "N과 M (1)",
125 - "10989", 125 + solved_date: "20200612",
126 - "2751", 126 + },
127 - "2750", 127 + { problem_number: "6603", problem_title: "로또", solved_date: "20200612" },
128 - "1436", 128 + {
129 - "1018", 129 + problem_number: "10971",
130 - "7568", 130 + problem_title: "외판원 순회 2",
131 - "2231", 131 + solved_date: "20200611",
132 - "2798", 132 + },
133 - "1002", 133 + {
134 - "3053", 134 + problem_number: "10819",
135 - "4153", 135 + problem_title: "차이를 최대로",
136 - "3009", 136 + solved_date: "20200611",
137 - "1085", 137 + },
138 - "9020", 138 + {
139 - "4948", 139 + problem_number: "10973",
140 - "1929", 140 + problem_title: "이전 순열",
141 - "2581", 141 + solved_date: "20200611",
142 - "1978", 142 + },
143 - "2292", 143 + {
144 - "6064", 144 + problem_number: "10974",
145 - "2775", 145 + problem_title: "모든 순열",
146 - "10250", 146 + solved_date: "20200611",
147 - "2869", 147 + },
148 - "1011", 148 + {
149 - "1193", 149 + problem_number: "10972",
150 - "2839", 150 + problem_title: "다음 순열",
151 - "1712", 151 + solved_date: "20200611",
152 - "1316", 152 + },
153 - "2941", 153 + { problem_number: "7576", problem_title: "토마토", solved_date: "20200608" },
154 - "5622", 154 + { problem_number: "1248", problem_title: "맞춰봐", solved_date: "20200312" },
155 - "2908", 155 + { problem_number: "2529", problem_title: "부등호", solved_date: "20200311" },
156 - "1152", 156 + {
157 - "1157", 157 + problem_number: "15661",
158 - "2675", 158 + problem_title: "링크와 스타트",
159 - "10809", 159 + solved_date: "20200311",
160 - "11720", 160 + },
161 - "11654", 161 + { problem_number: "14501", problem_title: "퇴사", solved_date: "20200311" },
162 - "11729", 162 + {
163 - "2447", 163 + problem_number: "1759",
164 - "3052", 164 + problem_title: "암호 만들기",
165 - "10818", 165 + solved_date: "20200310",
166 - "10872", 166 + },
167 - "10870", 167 + {
168 - "1065", 168 + problem_number: "14391",
169 - "4673", 169 + problem_title: "종이 조각",
170 - "15596", 170 + solved_date: "20200306",
171 - "4344", 171 + },
172 - "2920", 172 + {
173 - "8958", 173 + problem_number: "14889",
174 - "1546", 174 + problem_title: "스타트와 링크",
175 - "2577", 175 + solved_date: "20200305",
176 - "2562", 176 + },
177 - "1110", 177 + {
178 - "10951", 178 + problem_number: "1182",
179 - "10952", 179 + problem_title: "부분수열의 합",
180 - "10871", 180 + solved_date: "20200305",
181 - "2439", 181 + },
182 - "2438", 182 + { problem_number: "11723", problem_title: "집합", solved_date: "20200305" },
183 - "11022", 183 + {
184 - "11021", 184 + problem_number: "1748",
185 - "2742", 185 + problem_title: "수 이어 쓰기 1",
186 - "2741", 186 + solved_date: "20200305",
187 - "15552", 187 + },
188 - "8393", 188 + {
189 - "10950", 189 + problem_number: "6064",
190 - "2739", 190 + problem_title: "카잉 달력",
191 - "10817", 191 + solved_date: "20200305",
192 - "2884", 192 + },
193 - "2753", 193 + { problem_number: "1107", problem_title: "리모컨", solved_date: "20200305" },
194 - "9498", 194 + {
195 - "1330", 195 + problem_number: "3085",
196 - "2588", 196 + problem_title: "사탕 게임",
197 - "10430", 197 + solved_date: "20200305",
198 - "10869", 198 + },
199 - "1008", 199 + {
200 - "10998", 200 + problem_number: "2309",
201 - "7287", 201 + problem_title: "일곱 난쟁이",
202 - "10172", 202 + solved_date: "20200305",
203 - "10171", 203 + },
204 - "10718", 204 + {
205 - "1001", 205 + problem_number: "1748",
206 - "1000", 206 + problem_title: "수 이어 쓰기 1",
207 - "2557", 207 + solved_date: "20200228",
208 + },
209 + {
210 + problem_number: "14500",
211 + problem_title: "테트로미노",
212 + solved_date: "20200228",
213 + },
214 + { problem_number: "1107", problem_title: "리모컨", solved_date: "20200228" },
215 + {
216 + problem_number: "1476",
217 + problem_title: "날짜 계산",
218 + solved_date: "20200228",
219 + },
220 + {
221 + problem_number: "3085",
222 + problem_title: "사탕 게임",
223 + solved_date: "20200228",
224 + },
225 + {
226 + problem_number: "2309",
227 + problem_title: "일곱 난쟁이",
228 + solved_date: "20200228",
229 + },
230 + {
231 + problem_number: "1261",
232 + problem_title: "알고스팟",
233 + solved_date: "20200228",
234 + },
235 + {
236 + problem_number: "13549",
237 + problem_title: "숨바꼭질 3",
238 + solved_date: "20200227",
239 + },
240 + {
241 + problem_number: "14226",
242 + problem_title: "이모티콘",
243 + solved_date: "20200227",
244 + },
245 + {
246 + problem_number: "13913",
247 + problem_title: "숨바꼭질 4",
248 + solved_date: "20200227",
249 + },
250 + {
251 + problem_number: "1697",
252 + problem_title: "숨바꼭질",
253 + solved_date: "20200227",
254 + },
255 + {
256 + problem_number: "1967",
257 + problem_title: "트리의 지름",
258 + solved_date: "20200221",
259 + },
260 + {
261 + problem_number: "1167",
262 + problem_title: "트리의 지름",
263 + solved_date: "20200221",
264 + },
265 + {
266 + problem_number: "11725",
267 + problem_title: "트리의 부모 찾기",
268 + solved_date: "20200221",
269 + },
270 + {
271 + problem_number: "2250",
272 + problem_title: "트리의 높이와 너비",
273 + solved_date: "20200221",
274 + },
275 + {
276 + problem_number: "1991",
277 + problem_title: "트리 순회",
278 + solved_date: "20200221",
279 + },
280 + {
281 + problem_number: "7562",
282 + problem_title: "나이트의 이동",
283 + solved_date: "20200220",
284 + },
285 + {
286 + problem_number: "2178",
287 + problem_title: "미로 탐색",
288 + solved_date: "20200220",
289 + },
290 + {
291 + problem_number: "4963",
292 + problem_title: "섬의 개수",
293 + solved_date: "20200219",
294 + },
295 + {
296 + problem_number: "2667",
297 + problem_title: "단지번호붙이기",
298 + solved_date: "20200219",
299 + },
300 + {
301 + problem_number: "1707",
302 + problem_title: "이분 그래프",
303 + solved_date: "20200217",
304 + },
305 + {
306 + problem_number: "11724",
307 + problem_title: "연결 요소의 개수",
308 + solved_date: "20200214",
309 + },
310 + {
311 + problem_number: "1260",
312 + problem_title: "DFS와 BFS",
313 + solved_date: "20200214",
314 + },
315 + { problem_number: "13023", problem_title: "ABCDE", solved_date: "20200213" },
316 + { problem_number: "11652", problem_title: "카드", solved_date: "20200210" },
317 + {
318 + problem_number: "1377",
319 + problem_title: "버블 소트",
320 + solved_date: "20200210",
321 + },
322 + {
323 + problem_number: "11004",
324 + problem_title: "K번째 수",
325 + solved_date: "20200210",
326 + },
327 + { problem_number: "10825", problem_title: "국영수", solved_date: "20200210" },
328 + {
329 + problem_number: "2751",
330 + problem_title: "수 정렬하기 2",
331 + solved_date: "20200210",
332 + },
333 + {
334 + problem_number: "9461",
335 + problem_title: "파도반 수열",
336 + solved_date: "20200205",
337 + },
338 + {
339 + problem_number: "1699",
340 + problem_title: "제곱수의 합",
341 + solved_date: "20200205",
342 + },
343 + {
344 + problem_number: "9095",
345 + problem_title: "1, 2, 3 더하기",
346 + solved_date: "20200205",
347 + },
348 + { problem_number: "2225", problem_title: "합분해", solved_date: "20200205" },
349 + {
350 + problem_number: "2133",
351 + problem_title: "타일 채우기",
352 + solved_date: "20200204",
353 + },
354 + {
355 + problem_number: "11727",
356 + problem_title: "2×n 타일링 2",
357 + solved_date: "20200203",
358 + },
359 + {
360 + problem_number: "11726",
361 + problem_title: "2×n 타일링",
362 + solved_date: "20200203",
363 + },
364 + {
365 + problem_number: "1463",
366 + problem_title: "1로 만들기",
367 + solved_date: "20200203",
368 + },
369 + {
370 + problem_number: "2748",
371 + problem_title: "피보나치 수 2",
372 + solved_date: "20200203",
373 + },
374 + {
375 + problem_number: "2747",
376 + problem_title: "피보나치 수",
377 + solved_date: "20200203",
378 + },
379 + {
380 + problem_number: "11656",
381 + problem_title: "접미사 배열",
382 + solved_date: "20200203",
383 + },
384 + { problem_number: "10824", problem_title: "네 수", solved_date: "20200203" },
385 + {
386 + problem_number: "2743",
387 + problem_title: "단어 길이 재기",
388 + solved_date: "20200203",
389 + },
390 + {
391 + problem_number: "10820",
392 + problem_title: "문자열 분석",
393 + solved_date: "20200203",
394 + },
395 + {
396 + problem_number: "10808",
397 + problem_title: "알파벳 개수",
398 + solved_date: "20200203",
399 + },
400 + { problem_number: "11655", problem_title: "ROT13", solved_date: "20200203" },
401 + {
402 + problem_number: "11720",
403 + problem_title: "숫자의 합",
404 + solved_date: "20200131",
405 + },
406 + { problem_number: "1008", problem_title: "A/B", solved_date: "20200131" },
407 + {
408 + problem_number: "10951",
409 + problem_title: "A+B - 4",
410 + solved_date: "20200131",
411 + },
412 + {
413 + problem_number: "2557",
414 + problem_title: "Hello World",
415 + solved_date: "20200131",
416 + },
417 + {
418 + problem_number: "1021",
419 + problem_title: "회전하는 큐",
420 + solved_date: "20200131",
421 + },
422 + {
423 + problem_number: "1966",
424 + problem_title: "프린터 큐",
425 + solved_date: "20200131",
426 + },
427 + { problem_number: "2164", problem_title: "카드2", solved_date: "20200131" },
428 + {
429 + problem_number: "10799",
430 + problem_title: "쇠막대기",
431 + solved_date: "20200131",
432 + },
433 + {
434 + problem_number: "17413",
435 + problem_title: "단어 뒤집기 2",
436 + solved_date: "20200131",
437 + },
438 + { problem_number: "10866", problem_title: "덱", solved_date: "20200131" },
439 + {
440 + problem_number: "1158",
441 + problem_title: "요세푸스 문제",
442 + solved_date: "20200131",
443 + },
444 + { problem_number: "10845", problem_title: "큐", solved_date: "20200130" },
445 + { problem_number: "1406", problem_title: "에디터", solved_date: "20200130" },
446 + {
447 + problem_number: "1874",
448 + problem_title: "스택 수열",
449 + solved_date: "20200130",
450 + },
451 + { problem_number: "9012", problem_title: "괄호", solved_date: "20200130" },
452 + {
453 + problem_number: "9093",
454 + problem_title: "단어 뒤집기",
455 + solved_date: "20200130",
456 + },
457 + { problem_number: "10828", problem_title: "스택", solved_date: "20200129" },
458 + {
459 + problem_number: "11721",
460 + problem_title: "열 개씩 끊어 출력하기",
461 + solved_date: "20200126",
462 + },
463 + {
464 + problem_number: "11719",
465 + problem_title: "그대로 출력하기 2",
466 + solved_date: "20200126",
467 + },
468 + {
469 + problem_number: "11718",
470 + problem_title: "그대로 출력하기",
471 + solved_date: "20200126",
472 + },
473 + {
474 + problem_number: "10953",
475 + problem_title: "A+B - 6",
476 + solved_date: "20200126",
477 + },
478 + { problem_number: "2558", problem_title: "A+B - 2", solved_date: "20200126" },
479 + {
480 + problem_number: "10814",
481 + problem_title: "나이순 정렬",
482 + solved_date: "20200123",
483 + },
484 + {
485 + problem_number: "1181",
486 + problem_title: "단어 정렬",
487 + solved_date: "20200122",
488 + },
489 + {
490 + problem_number: "11651",
491 + problem_title: "좌표 정렬하기 2",
492 + solved_date: "20200122",
493 + },
494 + {
495 + problem_number: "11650",
496 + problem_title: "좌표 정렬하기",
497 + solved_date: "20200122",
498 + },
499 + {
500 + problem_number: "1427",
501 + problem_title: "소트인사이드",
502 + solved_date: "20190823",
503 + },
504 + { problem_number: "2108", problem_title: "통계학", solved_date: "20190823" },
505 + {
506 + problem_number: "10989",
507 + problem_title: "수 정렬하기 3",
508 + solved_date: "20190823",
509 + },
510 + {
511 + problem_number: "2751",
512 + problem_title: "수 정렬하기 2",
513 + solved_date: "20190814",
514 + },
515 + {
516 + problem_number: "2750",
517 + problem_title: "수 정렬하기",
518 + solved_date: "20190814",
519 + },
520 + {
521 + problem_number: "1436",
522 + problem_title: "영화감독 숌",
523 + solved_date: "20190814",
524 + },
525 + {
526 + problem_number: "1018",
527 + problem_title: "체스판 다시 칠하기",
528 + solved_date: "20190814",
529 + },
530 + { problem_number: "7568", problem_title: "덩치", solved_date: "20190814" },
531 + { problem_number: "2231", problem_title: "분해합", solved_date: "20190814" },
532 + { problem_number: "2798", problem_title: "블랙잭", solved_date: "20190814" },
533 + { problem_number: "1002", problem_title: "터렛", solved_date: "20190814" },
534 + {
535 + problem_number: "3053",
536 + problem_title: "택시 기하학",
537 + solved_date: "20190814",
538 + },
539 + {
540 + problem_number: "4153",
541 + problem_title: "직각삼각형",
542 + solved_date: "20190814",
543 + },
544 + {
545 + problem_number: "3009",
546 + problem_title: "네 번째 점",
547 + solved_date: "20190814",
548 + },
549 + {
550 + problem_number: "1085",
551 + problem_title: "직사각형에서 탈출",
552 + solved_date: "20190814",
553 + },
554 + {
555 + problem_number: "9020",
556 + problem_title: "골드바흐의 추측",
557 + solved_date: "20190814",
558 + },
559 + {
560 + problem_number: "4948",
561 + problem_title: "베르트랑 공준",
562 + solved_date: "20190814",
563 + },
564 + {
565 + problem_number: "1929",
566 + problem_title: "소수 구하기",
567 + solved_date: "20190814",
568 + },
569 + { problem_number: "2581", problem_title: "소수", solved_date: "20190811" },
570 + {
571 + problem_number: "1978",
572 + problem_title: "소수 찾기",
573 + solved_date: "20190811",
574 + },
575 + { problem_number: "2292", problem_title: "벌집", solved_date: "20190811" },
576 + {
577 + problem_number: "6064",
578 + problem_title: "카잉 달력",
579 + solved_date: "20190811",
580 + },
581 + {
582 + problem_number: "2775",
583 + problem_title: "부녀회장이 될테야",
584 + solved_date: "20190811",
585 + },
586 + {
587 + problem_number: "10250",
588 + problem_title: "ACM 호텔",
589 + solved_date: "20190811",
590 + },
591 + {
592 + problem_number: "2869",
593 + problem_title: "달팽이는 올라가고 싶다",
594 + solved_date: "20190811",
595 + },
596 + {
597 + problem_number: "1011",
598 + problem_title: "Fly me to the Alpha Centauri",
599 + solved_date: "20190811",
600 + },
601 + {
602 + problem_number: "1193",
603 + problem_title: "분수찾기",
604 + solved_date: "20190810",
605 + },
606 + {
607 + problem_number: "2839",
608 + problem_title: "설탕 배달",
609 + solved_date: "20190809",
610 + },
611 + {
612 + problem_number: "1712",
613 + problem_title: "손익분기점",
614 + solved_date: "20190809",
615 + },
616 + {
617 + problem_number: "1316",
618 + problem_title: "그룹 단어 체커",
619 + solved_date: "20190809",
620 + },
621 + {
622 + problem_number: "2941",
623 + problem_title: "크로아티아 알파벳",
624 + solved_date: "20190809",
625 + },
626 + { problem_number: "5622", problem_title: "다이얼", solved_date: "20190809" },
627 + { problem_number: "2908", problem_title: "상수", solved_date: "20190809" },
628 + {
629 + problem_number: "1152",
630 + problem_title: "단어의 개수",
631 + solved_date: "20190809",
632 + },
633 + {
634 + problem_number: "1157",
635 + problem_title: "단어 공부",
636 + solved_date: "20190809",
637 + },
638 + {
639 + problem_number: "2675",
640 + problem_title: "문자열 반복",
641 + solved_date: "20190809",
642 + },
643 + {
644 + problem_number: "10809",
645 + problem_title: "알파벳 찾기",
646 + solved_date: "20190809",
647 + },
648 + {
649 + problem_number: "11720",
650 + problem_title: "숫자의 합",
651 + solved_date: "20190809",
652 + },
653 + {
654 + problem_number: "11654",
655 + problem_title: "아스키 코드",
656 + solved_date: "20190809",
657 + },
658 + {
659 + problem_number: "11729",
660 + problem_title: "하노이 탑 이동 순서",
661 + solved_date: "20190809",
662 + },
663 + {
664 + problem_number: "2447",
665 + problem_title: "별 찍기 - 10",
666 + solved_date: "20190809",
667 + },
668 + { problem_number: "3052", problem_title: "나머지", solved_date: "20190807" },
669 + {
670 + problem_number: "10818",
671 + problem_title: "최소, 최대",
672 + solved_date: "20190807",
673 + },
674 + {
675 + problem_number: "10872",
676 + problem_title: "팩토리얼",
677 + solved_date: "20190628",
678 + },
679 + {
680 + problem_number: "10870",
681 + problem_title: "피보나치 수 5",
682 + solved_date: "20190628",
683 + },
684 + { problem_number: "1065", problem_title: "한수", solved_date: "20190628" },
685 + {
686 + problem_number: "4673",
687 + problem_title: "셀프 넘버",
688 + solved_date: "20190628",
689 + },
690 + {
691 + problem_number: "15596",
692 + problem_title: "정수 N개의 합",
693 + solved_date: "20190628",
694 + },
695 + {
696 + problem_number: "4344",
697 + problem_title: "평균은 넘겠지",
698 + solved_date: "20190628",
699 + },
700 + { problem_number: "2920", problem_title: "음계", solved_date: "20190628" },
701 + { problem_number: "8958", problem_title: "OX퀴즈", solved_date: "20190628" },
702 + { problem_number: "1546", problem_title: "평균", solved_date: "20190628" },
703 + {
704 + problem_number: "2577",
705 + problem_title: "숫자의 개수",
706 + solved_date: "20190628",
707 + },
708 + { problem_number: "2562", problem_title: "최댓값", solved_date: "20190628" },
709 + {
710 + problem_number: "1110",
711 + problem_title: "더하기 사이클",
712 + solved_date: "20190628",
713 + },
714 + {
715 + problem_number: "10951",
716 + problem_title: "A+B - 4",
717 + solved_date: "20190628",
718 + },
719 + {
720 + problem_number: "10952",
721 + problem_title: "A+B - 5",
722 + solved_date: "20190628",
723 + },
724 + {
725 + problem_number: "10871",
726 + problem_title: "X보다 작은 수",
727 + solved_date: "20190628",
728 + },
729 + {
730 + problem_number: "2439",
731 + problem_title: "별 찍기 - 2",
732 + solved_date: "20190628",
733 + },
734 + {
735 + problem_number: "2438",
736 + problem_title: "별 찍기 - 1",
737 + solved_date: "20190628",
738 + },
739 + {
740 + problem_number: "11022",
741 + problem_title: "A+B - 8",
742 + solved_date: "20190628",
743 + },
744 + {
745 + problem_number: "11021",
746 + problem_title: "A+B - 7",
747 + solved_date: "20190628",
748 + },
749 + { problem_number: "2742", problem_title: "기찍 N", solved_date: "20190628" },
750 + { problem_number: "2741", problem_title: "N 찍기", solved_date: "20190628" },
751 + {
752 + problem_number: "15552",
753 + problem_title: "빠른 A+B",
754 + solved_date: "20190628",
755 + },
756 + { problem_number: "8393", problem_title: "합", solved_date: "20190628" },
757 + {
758 + problem_number: "10950",
759 + problem_title: "A+B - 3",
760 + solved_date: "20190628",
761 + },
762 + { problem_number: "2739", problem_title: "구구단", solved_date: "20190628" },
763 + { problem_number: "10817", problem_title: "세 수", solved_date: "20190627" },
764 + {
765 + problem_number: "2884",
766 + problem_title: "알람 시계",
767 + solved_date: "20190627",
768 + },
769 + { problem_number: "2753", problem_title: "윤년", solved_date: "20190627" },
770 + {
771 + problem_number: "9498",
772 + problem_title: "시험 성적",
773 + solved_date: "20190627",
774 + },
775 + {
776 + problem_number: "1330",
777 + problem_title: "두 수 비교하기",
778 + solved_date: "20190627",
779 + },
780 + { problem_number: "2588", problem_title: "곱셈", solved_date: "20190627" },
781 + { problem_number: "10430", problem_title: "나머지", solved_date: "20190627" },
782 + {
783 + problem_number: "10869",
784 + problem_title: "사칙연산",
785 + solved_date: "20190627",
786 + },
787 + { problem_number: "1008", problem_title: "A/B", solved_date: "20190627" },
788 + { problem_number: "10998", problem_title: "A×B", solved_date: "20190627" },
789 + { problem_number: "7287", problem_title: "등록", solved_date: "20190627" },
790 + { problem_number: "10172", problem_title: "개", solved_date: "20190627" },
791 + { problem_number: "10171", problem_title: "고양이", solved_date: "20190627" },
792 + {
793 + problem_number: "10718",
794 + problem_title: "We love kriii",
795 + solved_date: "20190627",
796 + },
797 + { problem_number: "1001", problem_title: "A-B", solved_date: "20190607" },
798 + { problem_number: "1000", problem_title: "A+B", solved_date: "20190607" },
799 + {
800 + problem_number: "2557",
801 + problem_title: "Hello World",
802 + solved_date: "20190607",
803 + },
208 ]; 804 ];
......
...@@ -6,8 +6,10 @@ const ProfileSchema = new Schema({ ...@@ -6,8 +6,10 @@ const ProfileSchema = new Schema({
6 username: { type: String, required: true, unique: true }, 6 username: { type: String, required: true, unique: true },
7 userBJID: String, 7 userBJID: String,
8 solvedBJ: Object, 8 solvedBJ: Object,
9 + solvedBJ_date: Object,
9 friendList: [String], 10 friendList: [String],
10 slackWebHookURL: String, 11 slackWebHookURL: String,
12 + goalNum: Number,
11 }); 13 });
12 ProfileSchema.statics.findByUsername = function (username) { 14 ProfileSchema.statics.findByUsername = function (username) {
13 return this.findOne({ username }); 15 return this.findOne({ username });
...@@ -15,6 +17,20 @@ ProfileSchema.statics.findByUsername = function (username) { ...@@ -15,6 +17,20 @@ ProfileSchema.statics.findByUsername = function (username) {
15 ProfileSchema.methods.getBJID = function () { 17 ProfileSchema.methods.getBJID = function () {
16 return this.userBJID; 18 return this.userBJID;
17 }; 19 };
20 +ProfileSchema.methods.getBJdata = function () {
21 + return this.solvedBJ;
22 +};
23 +ProfileSchema.methods.getslackURL = function () {
24 + return this.slackWebHookURL;
25 +};
26 +ProfileSchema.methods.getgoalNum = function () {
27 + return this.goalNum;
28 +};
29 +ProfileSchema.methods.getTodaySovled = function () {
30 + if (this.solvedBJ_date) {
31 + return this.solvedBJ_date.presentNum;
32 + }
33 +};
18 34
19 ProfileSchema.methods.serialize = function () { 35 ProfileSchema.methods.serialize = function () {
20 const data = this.toJSON(); 36 const data = this.toJSON();
......
1 -/* 1 +let moment = require("moment");
2 -2. 현재 날짜와의 차이 =>
3 -3. 오늘 푼 문제 => 앞에서부터 순회하면서 데이트 같은거 찾기
4 -3. 최근 일주일간 푼 문제 수 => 앞에서부터 순회하면서 - 값이
5 -4. 추천 문제 => 정규 셋에서 없는거 찾기
6 -5. 날짜별로 묶기.
7 -데이터베이스에서 처리하자
8 -*/
9 -
10 -let moment = require('moment');
11 2
12 exports.analyzeBJ = function (solvedBJ) { 3 exports.analyzeBJ = function (solvedBJ) {
13 try { 4 try {
14 if (solvedBJ) { 5 if (solvedBJ) {
15 - console.log(solvedBJ[0]);
16 let presentDate = moment(); 6 let presentDate = moment();
17 - let presentDate_str = presentDate.format('YYYYMMDD'); 7 + let presentDate_str = presentDate.format("YYYYMMDD");
18 - let latestDate = moment(solvedBJ[0].solved_date, 'YYYYMMDD'); 8 + let latestDate = moment(solvedBJ[0].solved_date, "YYYYMMDD");
19 - let difflatest = presentDate.diff(latestDate, 'days'); 9 + let difflatest = presentDate.diff(latestDate, "days");
20 10
21 let solvedBJbyDATE = {}; 11 let solvedBJbyDATE = {};
22 for (let i = 0; i < solvedBJ.length; i++) { 12 for (let i = 0; i < solvedBJ.length; i++) {
...@@ -34,13 +24,13 @@ exports.analyzeBJ = function (solvedBJ) { ...@@ -34,13 +24,13 @@ exports.analyzeBJ = function (solvedBJ) {
34 ? solvedBJbyDATE[presentDate_str].length 24 ? solvedBJbyDATE[presentDate_str].length
35 : 0; 25 : 0;
36 let returnOBJ = { 26 let returnOBJ = {
37 - latestDate: latestDate.format('YYYYMMDD'), 27 + latestDate: latestDate.format("YYYYMMDD"),
38 difflatest: difflatest, 28 difflatest: difflatest,
39 latestNum: latestNum, 29 latestNum: latestNum,
40 presentNum: presentNum, 30 presentNum: presentNum,
41 solvedBJbyDATE: solvedBJbyDATE, 31 solvedBJbyDATE: solvedBJbyDATE,
42 }; 32 };
43 - console.log(returnOBJ); 33 +
44 return returnOBJ; 34 return returnOBJ;
45 } 35 }
46 } catch (e) { 36 } catch (e) {
......
1 -/*
2 -집중을 해보자.
3 -새거와 데이터가 있다.
4 -데이터 기준으로 새거에 자료가 있으면 넘어가기
5 -없으면 새 배열에 추가
6 -키만 모아둔 리스트를 만들자.
7 -그렇게 해서
8 -반복은 새거 길이만큼
9 -데이터에 있으면 추가 X
10 -없으면 추가
11 -그렇게 반환
12 -*/
13 -
14 exports.compareBJ = function (solvedBJ_new, problem_set) { 1 exports.compareBJ = function (solvedBJ_new, problem_set) {
15 try { 2 try {
16 let new_obj = []; 3 let new_obj = [];
17 - for (let i = 0; i < solvedBJ.length; i++) { 4 +
18 - if (solvedBJ_new[i].problem_number in problem_set) { 5 + for (let i = 0; i < problem_set.length; i++) {
19 - new_obj.push(solvedBJ_new[i]); 6 + let found = false;
7 + for (let j = 0; j < solvedBJ_new.length; j++) {
8 + if (solvedBJ_new[j].problem_number == problem_set[i].problem_number) {
9 + found = true;
10 + break;
11 + }
12 + }
13 + if (!found) {
14 + new_obj.push(problem_set[i]);
20 } 15 }
21 } 16 }
22 console.log(new_obj); 17 console.log(new_obj);
18 + return new_obj;
23 } catch (e) { 19 } catch (e) {
24 console.log(e); 20 console.log(e);
25 } 21 }
26 }; 22 };
23 +
24 +exports.randomItem = function (a) {
25 + return a[Math.floor(Math.random() * a.length)];
26 +};
......
1 const Slack = require("slack-node"); // 슬랙 모듈 사용 1 const Slack = require("slack-node"); // 슬랙 모듈 사용
2 2
3 +/*
3 const webhookUri = 4 const webhookUri =
4 - "https://hooks.slack.com/services/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"; // Webhook URL 5 + "https://hooks.slack.com/services/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"; // Webhook URL
6 +*/
5 7
6 -const slack = new Slack(); 8 +exports.send = async (message, webhookUri) => {
7 -slack.setWebhook(webhookUri); 9 + const slack = new Slack();
8 - 10 + slack.setWebhook(webhookUri);
9 -const send = async (message) => {
10 slack.webhook( 11 slack.webhook(
11 { 12 {
12 text: message, 13 text: message,
...@@ -16,5 +17,3 @@ const send = async (message) => { ...@@ -16,5 +17,3 @@ const send = async (message) => {
16 } 17 }
17 ); 18 );
18 }; 19 };
19 -
20 -send("hello");
......
1 var getBJ = require("./getBJ"); 1 var getBJ = require("./getBJ");
2 var fs = require("fs"); 2 var fs = require("fs");
3 3
4 -let dataset = [
5 - "1517",
6 - "2448",
7 - "1891",
8 - "1074",
9 - "2263",
10 - "1780",
11 - "11728",
12 - "10816",
13 - "10815",
14 - "2109",
15 - "1202",
16 - "1285",
17 - "2138",
18 - "1080",
19 - "11399",
20 - "1931",
21 - "11047",
22 - "15666",
23 - "15665",
24 - "15664",
25 - "15663",
26 - "15657",
27 - "15656",
28 - "15655",
29 - "15654",
30 - "15652",
31 - "15651",
32 - "15650",
33 - "15649",
34 - "6603",
35 - "10971",
36 - "10819",
37 - "10973",
38 - "10974",
39 - "10972",
40 - "7576",
41 - "1248",
42 - "2529",
43 - "15661",
44 - "14501",
45 - "1759",
46 - "14391",
47 - "14889",
48 - "1182",
49 - "11723",
50 - "1748",
51 - "6064",
52 - "1107",
53 - "3085",
54 - "2309",
55 - "1748",
56 - "14500",
57 - "1107",
58 - "1476",
59 - "3085",
60 - "2309",
61 - "1261",
62 - "13549",
63 - "14226",
64 - "13913",
65 - "1697",
66 - "1967",
67 - "1167",
68 - "11725",
69 - "2250",
70 - "1991",
71 - "7562",
72 - "2178",
73 - "4963",
74 - "2667",
75 - "1707",
76 - "11724",
77 - "1260",
78 - "13023",
79 - "11652",
80 - "1377",
81 - "11004",
82 - "10825",
83 - "2751",
84 - "9461",
85 - "1699",
86 - "9095",
87 - "2225",
88 - "2133",
89 - "11727",
90 - "11726",
91 - "1463",
92 - "2748",
93 - "2747",
94 - "11656",
95 - "10824",
96 - "2743",
97 - "10820",
98 - "10808",
99 - "11655",
100 - "11720",
101 - "1008",
102 - "10951",
103 - "2557",
104 - "1021",
105 - "1966",
106 - "2164",
107 - "10799",
108 - "17413",
109 - "10866",
110 - "1158",
111 - "10845",
112 - "1406",
113 - "1874",
114 - "9012",
115 - "9093",
116 - "10828",
117 - "11721",
118 - "11719",
119 - "11718",
120 - "10953",
121 - "2558",
122 - "10814",
123 - "1181",
124 - "11651",
125 - "11650",
126 - "1427",
127 - "2108",
128 - "10989",
129 - "2751",
130 - "2750",
131 - "1436",
132 - "1018",
133 - "7568",
134 - "2231",
135 - "2798",
136 - "1002",
137 - "3053",
138 - "4153",
139 - "3009",
140 - "1085",
141 - "9020",
142 - "4948",
143 - "1929",
144 - "2581",
145 - "1978",
146 - "2292",
147 - "6064",
148 - "2775",
149 - "10250",
150 - "2869",
151 - "1011",
152 - "1193",
153 - "2839",
154 - "1712",
155 - "1316",
156 - "2941",
157 - "5622",
158 - "2908",
159 - "1152",
160 - "1157",
161 - "2675",
162 - "10809",
163 - "11720",
164 - "11654",
165 - "11729",
166 - "2447",
167 - "3052",
168 - "10818",
169 - "10872",
170 - "10870",
171 - "1065",
172 - "4673",
173 - "15596",
174 - "4344",
175 - "2920",
176 - "8958",
177 - "1546",
178 - "2577",
179 - "2562",
180 - "1110",
181 - "10951",
182 - "10952",
183 - "10871",
184 - "2439",
185 - "2438",
186 - "11022",
187 - "11021",
188 - "2742",
189 - "2741",
190 - "15552",
191 - "8393",
192 - "10950",
193 - "2739",
194 - "10817",
195 - "2884",
196 - "2753",
197 - "9498",
198 - "1330",
199 - "2588",
200 - "10430",
201 - "10869",
202 - "1008",
203 - "10998",
204 - "7287",
205 - "10172",
206 - "10171",
207 - "10718",
208 - "1001",
209 - "1000",
210 - "2557",
211 -];
212 -
213 const test = async (userid) => { 4 const test = async (userid) => {
214 let lst = await getBJ.getBJ(userid); 5 let lst = await getBJ.getBJ(userid);
215 let return_lst = []; 6 let return_lst = [];
...@@ -217,7 +8,7 @@ const test = async (userid) => { ...@@ -217,7 +8,7 @@ const test = async (userid) => {
217 return_lst.push(lst[i].problem_number); 8 return_lst.push(lst[i].problem_number);
218 } 9 }
219 10
220 - var stringJson = JSON.stringify(return_lst) + "\n"; 11 + var stringJson = JSON.stringify(lst) + "\n";
221 fs.open("test.json", "a", "666", function (err, id) { 12 fs.open("test.json", "a", "666", function (err, id) {
222 if (err) { 13 if (err) {
223 console.log("file open err!!"); 14 console.log("file open err!!");
......
...@@ -206,3 +206,4 @@ ...@@ -206,3 +206,4 @@
206 "1000", 206 "1000",
207 "2557" 207 "2557"
208 ] 208 ]
209 +[{"problem_number":"1517","problem_title":"버블 소트","solved_date":"20200621"},{"problem_number":"2448","problem_title":"별 찍기 - 11","solved_date":"20200621"},{"problem_number":"1891","problem_title":"사분면","solved_date":"20200621"},{"problem_number":"1074","problem_title":"Z","solved_date":"20200620"},{"problem_number":"2263","problem_title":"트리의 순회","solved_date":"20200620"},{"problem_number":"1780","problem_title":"종이의 개수","solved_date":"20200619"},{"problem_number":"11728","problem_title":"배열 합치기","solved_date":"20200619"},{"problem_number":"10816","problem_title":"숫자 카드 2","solved_date":"20200619"},{"problem_number":"10815","problem_title":"숫자 카드","solved_date":"20200619"},{"problem_number":"2109","problem_title":"순회강연","solved_date":"20200619"},{"problem_number":"1202","problem_title":"보석 도둑","solved_date":"20200619"},{"problem_number":"1285","problem_title":"동전 뒤집기","solved_date":"20200617"},{"problem_number":"2138","problem_title":"전구와 스위치","solved_date":"20200617"},{"problem_number":"1080","problem_title":"행렬","solved_date":"20200617"},{"problem_number":"11399","problem_title":"ATM","solved_date":"20200616"},{"problem_number":"1931","problem_title":"회의실배정","solved_date":"20200616"},{"problem_number":"11047","problem_title":"동전 0","solved_date":"20200615"},{"problem_number":"15666","problem_title":"N과 M (12)","solved_date":"20200614"},{"problem_number":"15665","problem_title":"N과 M (11)","solved_date":"20200614"},{"problem_number":"15664","problem_title":"N과 M (10)","solved_date":"20200614"},{"problem_number":"15663","problem_title":"N과 M (9)","solved_date":"20200614"},{"problem_number":"15657","problem_title":"N과 M (8)","solved_date":"20200614"},{"problem_number":"15656","problem_title":"N과 M (7)","solved_date":"20200614"},{"problem_number":"15655","problem_title":"N과 M (6)","solved_date":"20200614"},{"problem_number":"15654","problem_title":"N과 M (5)","solved_date":"20200614"},{"problem_number":"15652","problem_title":"N과 M (4)","solved_date":"20200614"},{"problem_number":"15651","problem_title":"N과 M (3)","solved_date":"20200612"},{"problem_number":"15650","problem_title":"N과 M (2)","solved_date":"20200612"},{"problem_number":"15649","problem_title":"N과 M (1)","solved_date":"20200612"},{"problem_number":"6603","problem_title":"로또","solved_date":"20200612"},{"problem_number":"10971","problem_title":"외판원 순회 2","solved_date":"20200611"},{"problem_number":"10819","problem_title":"차이를 최대로","solved_date":"20200611"},{"problem_number":"10973","problem_title":"이전 순열","solved_date":"20200611"},{"problem_number":"10974","problem_title":"모든 순열","solved_date":"20200611"},{"problem_number":"10972","problem_title":"다음 순열","solved_date":"20200611"},{"problem_number":"7576","problem_title":"토마토","solved_date":"20200608"},{"problem_number":"1248","problem_title":"맞춰봐","solved_date":"20200312"},{"problem_number":"2529","problem_title":"부등호","solved_date":"20200311"},{"problem_number":"15661","problem_title":"링크와 스타트","solved_date":"20200311"},{"problem_number":"14501","problem_title":"퇴사","solved_date":"20200311"},{"problem_number":"1759","problem_title":"암호 만들기","solved_date":"20200310"},{"problem_number":"14391","problem_title":"종이 조각","solved_date":"20200306"},{"problem_number":"14889","problem_title":"스타트와 링크","solved_date":"20200305"},{"problem_number":"1182","problem_title":"부분수열의 합","solved_date":"20200305"},{"problem_number":"11723","problem_title":"집합","solved_date":"20200305"},{"problem_number":"1748","problem_title":"수 이어 쓰기 1","solved_date":"20200305"},{"problem_number":"6064","problem_title":"카잉 달력","solved_date":"20200305"},{"problem_number":"1107","problem_title":"리모컨","solved_date":"20200305"},{"problem_number":"3085","problem_title":"사탕 게임","solved_date":"20200305"},{"problem_number":"2309","problem_title":"일곱 난쟁이","solved_date":"20200305"},{"problem_number":"1748","problem_title":"수 이어 쓰기 1","solved_date":"20200228"},{"problem_number":"14500","problem_title":"테트로미노","solved_date":"20200228"},{"problem_number":"1107","problem_title":"리모컨","solved_date":"20200228"},{"problem_number":"1476","problem_title":"날짜 계산","solved_date":"20200228"},{"problem_number":"3085","problem_title":"사탕 게임","solved_date":"20200228"},{"problem_number":"2309","problem_title":"일곱 난쟁이","solved_date":"20200228"},{"problem_number":"1261","problem_title":"알고스팟","solved_date":"20200228"},{"problem_number":"13549","problem_title":"숨바꼭질 3","solved_date":"20200227"},{"problem_number":"14226","problem_title":"이모티콘","solved_date":"20200227"},{"problem_number":"13913","problem_title":"숨바꼭질 4","solved_date":"20200227"},{"problem_number":"1697","problem_title":"숨바꼭질","solved_date":"20200227"},{"problem_number":"1967","problem_title":"트리의 지름","solved_date":"20200221"},{"problem_number":"1167","problem_title":"트리의 지름","solved_date":"20200221"},{"problem_number":"11725","problem_title":"트리의 부모 찾기","solved_date":"20200221"},{"problem_number":"2250","problem_title":"트리의 높이와 너비","solved_date":"20200221"},{"problem_number":"1991","problem_title":"트리 순회","solved_date":"20200221"},{"problem_number":"7562","problem_title":"나이트의 이동","solved_date":"20200220"},{"problem_number":"2178","problem_title":"미로 탐색","solved_date":"20200220"},{"problem_number":"4963","problem_title":"섬의 개수","solved_date":"20200219"},{"problem_number":"2667","problem_title":"단지번호붙이기","solved_date":"20200219"},{"problem_number":"1707","problem_title":"이분 그래프","solved_date":"20200217"},{"problem_number":"11724","problem_title":"연결 요소의 개수","solved_date":"20200214"},{"problem_number":"1260","problem_title":"DFS와 BFS","solved_date":"20200214"},{"problem_number":"13023","problem_title":"ABCDE","solved_date":"20200213"},{"problem_number":"11652","problem_title":"카드","solved_date":"20200210"},{"problem_number":"1377","problem_title":"버블 소트","solved_date":"20200210"},{"problem_number":"11004","problem_title":"K번째 수","solved_date":"20200210"},{"problem_number":"10825","problem_title":"국영수","solved_date":"20200210"},{"problem_number":"2751","problem_title":"수 정렬하기 2","solved_date":"20200210"},{"problem_number":"9461","problem_title":"파도반 수열","solved_date":"20200205"},{"problem_number":"1699","problem_title":"제곱수의 합","solved_date":"20200205"},{"problem_number":"9095","problem_title":"1, 2, 3 더하기","solved_date":"20200205"},{"problem_number":"2225","problem_title":"합분해","solved_date":"20200205"},{"problem_number":"2133","problem_title":"타일 채우기","solved_date":"20200204"},{"problem_number":"11727","problem_title":"2×n 타일링 2","solved_date":"20200203"},{"problem_number":"11726","problem_title":"2×n 타일링","solved_date":"20200203"},{"problem_number":"1463","problem_title":"1로 만들기","solved_date":"20200203"},{"problem_number":"2748","problem_title":"피보나치 수 2","solved_date":"20200203"},{"problem_number":"2747","problem_title":"피보나치 수","solved_date":"20200203"},{"problem_number":"11656","problem_title":"접미사 배열","solved_date":"20200203"},{"problem_number":"10824","problem_title":"네 수","solved_date":"20200203"},{"problem_number":"2743","problem_title":"단어 길이 재기","solved_date":"20200203"},{"problem_number":"10820","problem_title":"문자열 분석","solved_date":"20200203"},{"problem_number":"10808","problem_title":"알파벳 개수","solved_date":"20200203"},{"problem_number":"11655","problem_title":"ROT13","solved_date":"20200203"},{"problem_number":"11720","problem_title":"숫자의 합","solved_date":"20200131"},{"problem_number":"1008","problem_title":"A/B","solved_date":"20200131"},{"problem_number":"10951","problem_title":"A+B - 4","solved_date":"20200131"},{"problem_number":"2557","problem_title":"Hello World","solved_date":"20200131"},{"problem_number":"1021","problem_title":"회전하는 큐","solved_date":"20200131"},{"problem_number":"1966","problem_title":"프린터 큐","solved_date":"20200131"},{"problem_number":"2164","problem_title":"카드2","solved_date":"20200131"},{"problem_number":"10799","problem_title":"쇠막대기","solved_date":"20200131"},{"problem_number":"17413","problem_title":"단어 뒤집기 2","solved_date":"20200131"},{"problem_number":"10866","problem_title":"덱","solved_date":"20200131"},{"problem_number":"1158","problem_title":"요세푸스 문제","solved_date":"20200131"},{"problem_number":"10845","problem_title":"큐","solved_date":"20200130"},{"problem_number":"1406","problem_title":"에디터","solved_date":"20200130"},{"problem_number":"1874","problem_title":"스택 수열","solved_date":"20200130"},{"problem_number":"9012","problem_title":"괄호","solved_date":"20200130"},{"problem_number":"9093","problem_title":"단어 뒤집기","solved_date":"20200130"},{"problem_number":"10828","problem_title":"스택","solved_date":"20200129"},{"problem_number":"11721","problem_title":"열 개씩 끊어 출력하기","solved_date":"20200126"},{"problem_number":"11719","problem_title":"그대로 출력하기 2","solved_date":"20200126"},{"problem_number":"11718","problem_title":"그대로 출력하기","solved_date":"20200126"},{"problem_number":"10953","problem_title":"A+B - 6","solved_date":"20200126"},{"problem_number":"2558","problem_title":"A+B - 2","solved_date":"20200126"},{"problem_number":"10814","problem_title":"나이순 정렬","solved_date":"20200123"},{"problem_number":"1181","problem_title":"단어 정렬","solved_date":"20200122"},{"problem_number":"11651","problem_title":"좌표 정렬하기 2","solved_date":"20200122"},{"problem_number":"11650","problem_title":"좌표 정렬하기","solved_date":"20200122"},{"problem_number":"1427","problem_title":"소트인사이드","solved_date":"20190823"},{"problem_number":"2108","problem_title":"통계학","solved_date":"20190823"},{"problem_number":"10989","problem_title":"수 정렬하기 3","solved_date":"20190823"},{"problem_number":"2751","problem_title":"수 정렬하기 2","solved_date":"20190814"},{"problem_number":"2750","problem_title":"수 정렬하기","solved_date":"20190814"},{"problem_number":"1436","problem_title":"영화감독 숌","solved_date":"20190814"},{"problem_number":"1018","problem_title":"체스판 다시 칠하기","solved_date":"20190814"},{"problem_number":"7568","problem_title":"덩치","solved_date":"20190814"},{"problem_number":"2231","problem_title":"분해합","solved_date":"20190814"},{"problem_number":"2798","problem_title":"블랙잭","solved_date":"20190814"},{"problem_number":"1002","problem_title":"터렛","solved_date":"20190814"},{"problem_number":"3053","problem_title":"택시 기하학","solved_date":"20190814"},{"problem_number":"4153","problem_title":"직각삼각형","solved_date":"20190814"},{"problem_number":"3009","problem_title":"네 번째 점","solved_date":"20190814"},{"problem_number":"1085","problem_title":"직사각형에서 탈출","solved_date":"20190814"},{"problem_number":"9020","problem_title":"골드바흐의 추측","solved_date":"20190814"},{"problem_number":"4948","problem_title":"베르트랑 공준","solved_date":"20190814"},{"problem_number":"1929","problem_title":"소수 구하기","solved_date":"20190814"},{"problem_number":"2581","problem_title":"소수","solved_date":"20190811"},{"problem_number":"1978","problem_title":"소수 찾기","solved_date":"20190811"},{"problem_number":"2292","problem_title":"벌집","solved_date":"20190811"},{"problem_number":"6064","problem_title":"카잉 달력","solved_date":"20190811"},{"problem_number":"2775","problem_title":"부녀회장이 될테야","solved_date":"20190811"},{"problem_number":"10250","problem_title":"ACM 호텔","solved_date":"20190811"},{"problem_number":"2869","problem_title":"달팽이는 올라가고 싶다","solved_date":"20190811"},{"problem_number":"1011","problem_title":"Fly me to the Alpha Centauri","solved_date":"20190811"},{"problem_number":"1193","problem_title":"분수찾기","solved_date":"20190810"},{"problem_number":"2839","problem_title":"설탕 배달","solved_date":"20190809"},{"problem_number":"1712","problem_title":"손익분기점","solved_date":"20190809"},{"problem_number":"1316","problem_title":"그룹 단어 체커","solved_date":"20190809"},{"problem_number":"2941","problem_title":"크로아티아 알파벳","solved_date":"20190809"},{"problem_number":"5622","problem_title":"다이얼","solved_date":"20190809"},{"problem_number":"2908","problem_title":"상수","solved_date":"20190809"},{"problem_number":"1152","problem_title":"단어의 개수","solved_date":"20190809"},{"problem_number":"1157","problem_title":"단어 공부","solved_date":"20190809"},{"problem_number":"2675","problem_title":"문자열 반복","solved_date":"20190809"},{"problem_number":"10809","problem_title":"알파벳 찾기","solved_date":"20190809"},{"problem_number":"11720","problem_title":"숫자의 합","solved_date":"20190809"},{"problem_number":"11654","problem_title":"아스키 코드","solved_date":"20190809"},{"problem_number":"11729","problem_title":"하노이 탑 이동 순서","solved_date":"20190809"},{"problem_number":"2447","problem_title":"별 찍기 - 10","solved_date":"20190809"},{"problem_number":"3052","problem_title":"나머지","solved_date":"20190807"},{"problem_number":"10818","problem_title":"최소, 최대","solved_date":"20190807"},{"problem_number":"10872","problem_title":"팩토리얼","solved_date":"20190628"},{"problem_number":"10870","problem_title":"피보나치 수 5","solved_date":"20190628"},{"problem_number":"1065","problem_title":"한수","solved_date":"20190628"},{"problem_number":"4673","problem_title":"셀프 넘버","solved_date":"20190628"},{"problem_number":"15596","problem_title":"정수 N개의 합","solved_date":"20190628"},{"problem_number":"4344","problem_title":"평균은 넘겠지","solved_date":"20190628"},{"problem_number":"2920","problem_title":"음계","solved_date":"20190628"},{"problem_number":"8958","problem_title":"OX퀴즈","solved_date":"20190628"},{"problem_number":"1546","problem_title":"평균","solved_date":"20190628"},{"problem_number":"2577","problem_title":"숫자의 개수","solved_date":"20190628"},{"problem_number":"2562","problem_title":"최댓값","solved_date":"20190628"},{"problem_number":"1110","problem_title":"더하기 사이클","solved_date":"20190628"},{"problem_number":"10951","problem_title":"A+B - 4","solved_date":"20190628"},{"problem_number":"10952","problem_title":"A+B - 5","solved_date":"20190628"},{"problem_number":"10871","problem_title":"X보다 작은 수","solved_date":"20190628"},{"problem_number":"2439","problem_title":"별 찍기 - 2","solved_date":"20190628"},{"problem_number":"2438","problem_title":"별 찍기 - 1","solved_date":"20190628"},{"problem_number":"11022","problem_title":"A+B - 8","solved_date":"20190628"},{"problem_number":"11021","problem_title":"A+B - 7","solved_date":"20190628"},{"problem_number":"2742","problem_title":"기찍 N","solved_date":"20190628"},{"problem_number":"2741","problem_title":"N 찍기","solved_date":"20190628"},{"problem_number":"15552","problem_title":"빠른 A+B","solved_date":"20190628"},{"problem_number":"8393","problem_title":"합","solved_date":"20190628"},{"problem_number":"10950","problem_title":"A+B - 3","solved_date":"20190628"},{"problem_number":"2739","problem_title":"구구단","solved_date":"20190628"},{"problem_number":"10817","problem_title":"세 수","solved_date":"20190627"},{"problem_number":"2884","problem_title":"알람 시계","solved_date":"20190627"},{"problem_number":"2753","problem_title":"윤년","solved_date":"20190627"},{"problem_number":"9498","problem_title":"시험 성적","solved_date":"20190627"},{"problem_number":"1330","problem_title":"두 수 비교하기","solved_date":"20190627"},{"problem_number":"2588","problem_title":"곱셈","solved_date":"20190627"},{"problem_number":"10430","problem_title":"나머지","solved_date":"20190627"},{"problem_number":"10869","problem_title":"사칙연산","solved_date":"20190627"},{"problem_number":"1008","problem_title":"A/B","solved_date":"20190627"},{"problem_number":"10998","problem_title":"A×B","solved_date":"20190627"},{"problem_number":"7287","problem_title":"등록","solved_date":"20190627"},{"problem_number":"10172","problem_title":"개","solved_date":"20190627"},{"problem_number":"10171","problem_title":"고양이","solved_date":"20190627"},{"problem_number":"10718","problem_title":"We love kriii","solved_date":"20190627"},{"problem_number":"1001","problem_title":"A-B","solved_date":"20190607"},{"problem_number":"1000","problem_title":"A+B","solved_date":"20190607"},{"problem_number":"2557","problem_title":"Hello World","solved_date":"20190607"}]
......