Toggle navigation
Toggle navigation
This project
Loading...
Sign in
송용우
/
oss-Jaksimsamil
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
송용우
2020-08-28 21:21:53 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
05582aae0cd21f825c893c30a4df318ea2d5f2d2
05582aae
2 parents
ae933b07
7a39581f
Merge commit '
7a39581f
' into feature/rest_api
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
265 additions
and
144 deletions
jaksimsamil-page/package.json
jaksimsamil-page/src/components/home/HeatMap.js
jaksimsamil-page/src/components/home/HomeForm.js
jaksimsamil-page/src/containers/home/HomeContainer.js
jaksimsamil-page/yarn.lock
jaksimsamil-server/src/models/challenge.js
jaksimsamil-server/src/models/session.js
jaksimsamil-page/package.json
View file @
05582aa
...
...
@@ -13,6 +13,7 @@
"moment"
:
"^2.27.0"
,
"open-color"
:
"^1.7.0"
,
"react"
:
"^16.13.1"
,
"react-calendar-heatmap"
:
"^1.8.1"
,
"react-dom"
:
"^16.13.1"
,
"react-redux"
:
"^7.2.0"
,
"react-router-dom"
:
"^5.2.0"
,
...
...
jaksimsamil-page/src/components/home/HeatMap.js
0 → 100644
View file @
05582aa
import
React
,
{
use
}
from
'react'
;
import
CalendarHeatmap
from
'react-calendar-heatmap'
;
import
'react-calendar-heatmap/dist/styles.css'
;
/*
TODO: 날짜 범위 지정, 날짜별 검색 추가
*/
/*
solvedBJbyDATE:
solvedBJbyDATE:{
20190304 : [Object]
...
}
*/
const
HeatMap
=
(
HMArr
)
=>
{
return
(
<
div
>
<
CalendarHeatmap
onClick
=
{()
=>
{
console
.
log
(
HMArr
);
}}
startDate
=
{
new
Date
(
'2020-01-01'
)}
endDate
=
{
new
Date
(
'2020-12-01'
)}
values
=
{
HMArr
.
HMArr
}
classForValue
=
{(
value
)
=>
{
if
(
!
value
)
{
return
'color-empty'
;
}
return
`color-github-
${
value
.
count
}
`
;
}}
tooltipDataAttrs
=
{(
value
)
=>
{
return
{
'data-tooltip'
:
`
${
value
.
date
}
has count:
${
value
.
count
}
`
,
};
}}
showWeekdayLabels
=
{
true
}
/
>
<
/div
>
);
};
export
default
HeatMap
;
jaksimsamil-page/src/components/home/HomeForm.js
View file @
05582aa
...
...
@@ -3,7 +3,7 @@ import { makeStyles } from '@material-ui/core/styles';
import
Paper
from
'@material-ui/core/Paper'
;
import
Grid
from
'@material-ui/core/Grid'
;
import
palette
from
'../../lib/styles/palette'
;
import
AuthForm
from
'../auth/AuthForm
'
;
import
HeatMap
from
'./HeatMap
'
;
const
useStyles
=
makeStyles
((
theme
)
=>
({
root
:
{
flexGrow
:
1
,
...
...
@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme) => ({
color
:
theme
.
palette
.
text
.
secondary
,
},
}));
const
HomeForm
=
({
PSdata
,
goalNum
})
=>
{
const
HomeForm
=
({
PSdata
,
HMArr
,
goalNum
})
=>
{
const
classes
=
useStyles
();
return
PSdata
?
(
<
div
className
=
{
classes
.
root
}
>
...
...
@@ -48,7 +48,11 @@ const HomeForm = ({ PSdata, goalNum }) => {
<
h3
>
마지막으로
푼
문제
<
/h3
>
<
/Paper
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
>
<
Paper
className
=
{
classes
.
paper
}
>
<
HeatMap
HMArr
=
{
HMArr
}
/
>
<
/Paper
>
<
/Grid
>
<
Grid
item
xs
=
{
4
}
>
<
Paper
className
=
{
classes
.
paper
}
>
<
h1
>
{
PSdata
.
weekNum
}
<
/h1
>
...
...
jaksimsamil-page/src/containers/home/HomeContainer.js
View file @
05582aa
import
React
,
{
useEffect
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
HomeForm
from
'../../components/home/HomeForm'
;
import
{
getPROFILE
,
initializeProfile
}
from
'../../modules/profile'
;
const
HomeContainer
=
({
history
})
=>
{
const
dispatch
=
useDispatch
();
const
[
HMArr
,
setHMArr
]
=
useState
([]);
const
{
user
,
profile
}
=
useSelector
(({
user
,
profile
})
=>
({
user
:
user
.
user
,
profile
:
profile
,
}));
const
makeHeatmapValues
=
(
PSdata
)
=>
{
let
obj_keys
=
Object
.
keys
(
PSdata
);
let
result
=
[];
for
(
let
i
=
0
;
i
<
obj_keys
.
length
;
i
++
)
{
result
.
push
({
date
:
//2019-10-15
obj_keys
[
i
].
slice
(
0
,
4
)
+
'-'
+
obj_keys
[
i
].
slice
(
4
,
6
)
+
'-'
+
obj_keys
[
i
].
slice
(
6
,
8
),
count
:
PSdata
[
obj_keys
[
i
]].
length
,
});
}
return
result
;
};
useEffect
(()
=>
{
if
(
!
user
)
{
alert
(
'로그인이 필요합니다 '
);
...
...
@@ -23,7 +42,9 @@ const HomeContainer = ({ history }) => {
}
},
[
dispatch
,
user
,
history
]);
useEffect
(()
=>
{
console
.
log
(
profile
);
if
(
profile
.
solvedBJ_date
)
{
setHMArr
(
makeHeatmapValues
(
profile
.
solvedBJ_date
.
solvedBJbyDATE
));
}
},
[
profile
]);
useEffect
(()
=>
{
if
(
user
)
{
...
...
@@ -31,6 +52,12 @@ const HomeContainer = ({ history }) => {
dispatch
(
getPROFILE
({
username
}));
}
},
[
dispatch
,
user
]);
return
<
HomeForm
PSdata
=
{
profile
.
solvedBJ_date
}
goalNum
=
{
profile
.
goalNum
}
/>
;
return
(
<
HomeForm
PSdata
=
{
profile
.
solvedBJ_date
}
HMArr
=
{
HMArr
}
goalNum
=
{
profile
.
goalNum
}
/
>
);
};
export
default
withRouter
(
HomeContainer
);
...
...
jaksimsamil-page/yarn.lock
View file @
05582aa
...
...
@@ -1703,6 +1703,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"
integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==
"@types/json-schema@^7.0.4":
version "7.0.5"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd"
integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==
"@types/minimatch@*":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
...
...
@@ -2120,6 +2125,16 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.0, ajv@^6.5.5:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ajv@^6.12.2:
version "6.12.4"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.4.tgz#0614facc4522127fa713445c6bfd3ebd376e2234"
integrity sha512-eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==
dependencies:
fast-deep-equal "^3.1.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
alphanum-sort@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"
...
...
@@ -5114,7 +5129,7 @@ find-cache-dir@^2.1.0:
make-dir "^2.0.0"
pkg-dir "^3.0.0"
find-cache-dir@^3.
2.0
:
find-cache-dir@^3.
3.1
:
version "3.3.1"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880"
integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==
...
...
@@ -5755,10 +5770,10 @@ html-encoding-sniffer@^1.0.2:
dependencies:
whatwg-encoding "^1.0.1"
html-entities@^1.
2
.1:
version "1.
2
.1"
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.
2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f
"
integrity sha
1-DfKTUfByEWNRXfueVUPl9u7VFi8
=
html-entities@^1.
3
.1:
version "1.
3
.1"
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.
3.1.tgz#fb9a1a4b5b14c5daba82d3e34c6ae4fe701a0e44
"
integrity sha
512-rhE/4Z3hIhzHAUKbW8jVcCyuT5oJCXXqhN/6mXXVCpzTmvJnoH2HL/bt3EZ6p55jbFJBeAe1ZNpL5BugLujxNA=
=
html-escaper@^2.0.0:
version "2.0.0"
...
...
@@ -5968,10 +5983,10 @@ immer@1.10.0:
resolved "https://registry.yarnpkg.com/immer/-/immer-1.10.0.tgz#bad67605ba9c810275d91e1c2a47d4582e98286d"
integrity sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg==
immer@^7.0.
1
:
version "7.0.
1
"
resolved "https://registry.yarnpkg.com/immer/-/immer-7.0.
1.tgz#830f44a36c4181c0eca4385e7782e164e5eb9249
"
integrity sha512-
DpWL/ES2Ba8KwW+A5AgNRoJPZP8LxdHejKXar1VfbF5a7ATvvekzmmNSQxje+WG0DIhuanvFEumFffVqyCLmBQ
==
immer@^7.0.
5
:
version "7.0.
7
"
resolved "https://registry.yarnpkg.com/immer/-/immer-7.0.
7.tgz#9dfe713d49bf871cc59aedfce59b1992fa37a977
"
integrity sha512-
Q8yYwVADJXrNfp1ZUAh4XDHkcoE3wpdpb4mC5abDSajs2EbW8+cGdPyAnglMyLnm7EF6ojD2xBFX7L5i4TIytw
==
import-cwd@^2.0.0:
version "2.1.0"
...
...
@@ -6973,10 +6988,10 @@ jest-worker@^24.6.0, jest-worker@^24.9.0:
merge-stream "^2.0.0"
supports-color "^6.1.0"
jest-worker@^25.
1
.0:
version "25.
1
.0"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.
1.0.tgz#75d038bad6fdf58eba0d2ec1835856c497e3907a
"
integrity sha512-
ZHhHtlxOWSxCoNOKHGbiLzXnl42ga9CxDr27H36Qn+15pQZd3R/F24jrmjDelw9j/iHUIWMWs08/u2QN50HHOg
==
jest-worker@^25.
4
.0:
version "25.
5
.0"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.
5.0.tgz#2611d071b79cea0f43ee57a3d118593ac1547db1
"
integrity sha512-
/dsSmUkIy5EBGfv/IjjqmFxrNAUpBERfGs1oHROyD7yxjG/w+t0GOJDX8O1k32ySmd7+a5IhnJU2qQFcJ4n1vw
==
dependencies:
merge-stream "^2.0.0"
supports-color "^7.0.0"
...
...
@@ -7659,10 +7674,10 @@ lodash.without@~4.4.0:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
loglevel@^1.6.
6
:
version "1.6.
7
"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.
7.tgz#b3e034233188c68b889f5b862415306f565e2c56
"
integrity sha512-
cY2eLFrQSAfVPhCgH1s7JI73tMbg9YC3v3+ZHVW67sBS7UxWzNEk/ZBbSfLykBWHp33dqqtOv82gjhKEi81T/
A==
loglevel@^1.6.
8
:
version "1.6.
8
"
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.
8.tgz#8a25fb75d092230ecd4457270d80b54e28011171
"
integrity sha512-
bsU7+gc9AJ2SqpzxwU3+1fedl8zAntbtC5XYlt3s2j1hJcn2PsXSmgN8TaLG/J1/2mod4+cE/3vNL70/c1RNC
A==
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
version "1.4.0"
...
...
@@ -7808,6 +7823,11 @@ mem@^4.0.0:
mimic-fn "^2.0.0"
p-is-promise "^2.0.0"
memoize-one@^5.0.0:
version "5.1.1"
resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0"
integrity sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA==
memory-fs@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552"
...
...
@@ -8063,6 +8083,11 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.1:
dependencies:
minimist "^1.2.5"
moment@^2.27.0:
version "2.27.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.27.0.tgz#8bff4e3e26a236220dfe3e36de756b6ebaa0105d"
integrity sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ==
move-concurrently@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
...
...
@@ -8778,7 +8803,7 @@ os-locale@^2.0.0:
lcid "^1.0.0"
mem "^1.1.0"
os-locale@^3.
0.0, os-locale@^3.
1.0:
os-locale@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a"
integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==
...
...
@@ -8829,13 +8854,20 @@ p-limit@^1.1.0:
dependencies:
p-try "^1.0.0"
p-limit@^2.0.0, p-limit@^2.2.0
, p-limit@^2.2.2
:
p-limit@^2.0.0, p-limit@^2.2.0:
version "2.2.2"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e"
integrity sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==
dependencies:
p-try "^2.0.0"
p-limit@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
dependencies:
p-try "^2.0.0"
p-locate@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
...
...
@@ -9221,14 +9253,14 @@ popper.js@1.16.1-lts:
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1-lts.tgz#cf6847b807da3799d80ee3d6d2f90df8a3f50b05"
integrity sha512-Kjw8nKRl1m+VrSFCoVGPph93W/qrSO7ZkqPpTf7F4bk/sqcfWK019dWBUpE/fBOsOQY1dks/Bmcbfn1heM/IsA==
portfinder@^1.0.2
5
:
version "1.0.2
5
"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.2
5.tgz#254fd337ffba869f4b9d37edc298059cb4d35eca
"
integrity sha512-
6ElJnHBbxVA1XSLgBp7G1FiCkQdlqGzuF7DswL5tcea+E8UpuvPU7beVAjjRwCioTS9ZluNbu+ZyRvgTsmqEBg
==
portfinder@^1.0.2
6
:
version "1.0.2
8
"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.2
8.tgz#67c4622852bd5374dd1dd900f779f53462fac778
"
integrity sha512-
Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA
==
dependencies:
async "^2.6.2"
debug "^3.1.1"
mkdirp "^0.5.
1
"
mkdirp "^0.5.
5
"
posix-character-classes@^0.1.0:
version "0.1.1"
...
...
@@ -10154,7 +10186,7 @@ raf@^3.4.1:
dependencies:
performance-now "^2.1.0"
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5
, randombytes@^2.1.0
:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
...
...
@@ -10206,6 +10238,14 @@ react-app-polyfill@^1.0.6:
regenerator-runtime "^0.13.3"
whatwg-fetch "^3.0.0"
react-calendar-heatmap@^1.8.1:
version "1.8.1"
resolved "https://registry.yarnpkg.com/react-calendar-heatmap/-/react-calendar-heatmap-1.8.1.tgz#8370151f6cf7477d49cb3459596d6d046bdfc704"
integrity sha512-4Hbq/pDMJoCPzZnyIWFfHgokLlLXzKyGsDcMgNhYpi7zcKHcvsK9soLEPvhW2dBBqgDrQOSp/uG4wtifaDg4eQ==
dependencies:
memoize-one "^5.0.0"
prop-types "^15.6.2"
react-dev-utils@^10.2.1:
version "10.2.1"
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-10.2.1.tgz#f6de325ae25fa4d546d09df4bb1befdc6dd19c19"
...
...
@@ -10296,10 +10336,10 @@ react-router@5.2.0:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
react-scripts@
3.4.1
:
version "3.4.
1
"
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-3.4.
1.tgz#f551298b5c71985cc491b9acf3c8e8c0ae3ada0a
"
integrity sha512-
JpTdi/0Sfd31mZA6Ukx+lq5j1JoKItX7qqEK4OiACjVQletM1P38g49d9/D0yTxp9FrSF+xpJFStkGgKEIRjlQ
==
react-scripts@
^3.4.3
:
version "3.4.
3
"
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-3.4.
3.tgz#21de5eb93de41ee92cd0b85b0e1298d0bb2e6c51
"
integrity sha512-
oSnoWmii/iKdeQiwaO6map1lUaZLmG0xIUyb/HwCVFLT7gNbj8JZ9RmpvMCZ4fB98ZUMRfNmp/ft8uy/xD1RLA
==
dependencies:
"@babel/core" "7.9.0"
"@svgr/webpack" "4.3.3"
...
...
@@ -10346,11 +10386,11 @@ react-scripts@3.4.1:
sass-loader "8.0.2"
semver "6.3.0"
style-loader "0.23.1"
terser-webpack-plugin "2.3.
5
"
terser-webpack-plugin "2.3.
8
"
ts-pnp "1.1.6"
url-loader "2.3.0"
webpack "4.42.0"
webpack-dev-server "3.1
0.3
"
webpack-dev-server "3.1
1.0
"
webpack-manifest-plugin "2.2.0"
workbox-webpack-plugin "4.3.1"
optionalDependencies:
...
...
@@ -11010,7 +11050,7 @@ schema-utils@^1.0.0:
ajv-errors "^1.0.0"
ajv-keywords "^3.1.0"
schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.1, schema-utils@^2.6.
4, schema-utils@^2.6.
5:
schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.1, schema-utils@^2.6.5:
version "2.6.5"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.5.tgz#c758f0a7e624263073d396e29cd40aa101152d8a"
integrity sha512-5KXuwKziQrTVHh8j/Uxz+QUbxkaLW9X/86NBlx/gnKgtsZA2GIVMUn17qWhRFwF8jdYb3Dig5hRO/W5mZqy6SQ==
...
...
@@ -11018,6 +11058,15 @@ schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.1, schema-utils@^2.6
ajv "^6.12.0"
ajv-keywords "^3.4.1"
schema-utils@^2.6.6:
version "2.7.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.0.tgz#17151f76d8eae67fbbf77960c33c676ad9f4efc7"
integrity sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==
dependencies:
"@types/json-schema" "^7.0.4"
ajv "^6.12.2"
ajv-keywords "^3.4.1"
select-hose@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca"
...
...
@@ -11076,6 +11125,13 @@ serialize-javascript@^2.1.2:
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61"
integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==
serialize-javascript@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa"
integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==
dependencies:
randombytes "^2.1.0"
serve-index@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239"
...
...
@@ -11301,13 +11357,14 @@ sockjs-client@1.4.0:
json3 "^3.3.2"
url-parse "^1.4.3"
sockjs@0.3.
19
:
version "0.3.
19
"
resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.
19.tgz#d976bbe800af7bd20ae08598d582393508993c0d
"
integrity sha512-
V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw
==
sockjs@0.3.
20
:
version "0.3.
20
"
resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.
20.tgz#b26a283ec562ef8b2687b44033a4eeceac75d855
"
integrity sha512-
SpmVOVpdq0DJc0qArhF3E5xsxvaiqGNb73XfgBpK1y3UD5gs8DSo8aCTsuT5pX8rssdc2NDIzANwP9eCAiSdTA
==
dependencies:
faye-websocket "^0.10.0"
uuid "^3.0.1"
uuid "^3.4.0"
websocket-driver "0.6.5"
socks-proxy-agent@^4.0.0:
version "4.0.2"
...
...
@@ -11422,10 +11479,10 @@ spdy-transport@^3.0.0:
readable-stream "^3.0.6"
wbuf "^1.7.3"
spdy@^4.0.
1
:
version "4.0.
1
"
resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.
1.tgz#6f12ed1c5db7ea4f24ebb8b89ba58c87c08257f2
"
integrity sha512-
HeZS3PBdMA+sZSu0qwpCxl3DeALD5ASx8pAX0jZdKXSpPWbQ6SYGnlg3BBmYLx5LtiZrmkAZfErCm2oECBci
oA==
spdy@^4.0.
2
:
version "4.0.
2
"
resolved "https://registry.yarnpkg.com/spdy/-/spdy-4.0.
2.tgz#b74f466203a3eda452c02492b91fb9e84a27677b
"
integrity sha512-
r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcD
oA==
dependencies:
debug "^4.1.0"
handle-thing "^2.0.0"
...
...
@@ -11861,19 +11918,19 @@ term-size@^1.2.0:
dependencies:
execa "^0.7.0"
terser-webpack-plugin@2.3.
5
:
version "2.3.
5
"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.
5.tgz#5ad971acce5c517440ba873ea4f09687de2f4a81
"
integrity sha512-
WlWksUoq+E4+JlJ+h+U+QUzXpcsMSSNXkDy9lBVkSqDn1w23Gg29L/ary9GeJVYCGiNJJX7LnVc4bwL1N3/g
1w==
terser-webpack-plugin@2.3.
8
:
version "2.3.
8
"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.
8.tgz#894764a19b0743f2f704e7c2a848c5283a696724
"
integrity sha512-
/fKw3R+hWyHfYx7Bv6oPqmk4HGQcrWLtV3X6ggvPuwPNHSnzvVV51z6OaaCOus4YLjutYGOz3pEpbhe6Up2s
1w==
dependencies:
cacache "^13.0.1"
find-cache-dir "^3.
2.0
"
jest-worker "^25.
1
.0"
p-limit "^2.
2.2
"
schema-utils "^2.6.
4
"
serialize-javascript "^
2.1.2
"
find-cache-dir "^3.
3.1
"
jest-worker "^25.
4
.0"
p-limit "^2.
3.0
"
schema-utils "^2.6.
6
"
serialize-javascript "^
4.0.0
"
source-map "^0.6.1"
terser "^4.
4.3
"
terser "^4.
6.12
"
webpack-sources "^1.4.3"
terser-webpack-plugin@^1.4.3:
...
...
@@ -11891,7 +11948,7 @@ terser-webpack-plugin@^1.4.3:
webpack-sources "^1.4.0"
worker-farm "^1.7.0"
terser@^4.1.2, terser@^4.
4.3, terser@^4.
6.3:
terser@^4.1.2, terser@^4.6.3:
version "4.6.7"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.7.tgz#478d7f9394ec1907f0e488c5f6a6a9a2bad55e72"
integrity sha512-fmr7M1f7DBly5cX2+rFDvmGBAaaZyPrHYK4mMdHEDAdNTqXSZgSOfqsfGq2HqPGT/1V0foZZuCZFx8CHKgAk3g==
...
...
@@ -11900,6 +11957,15 @@ terser@^4.1.2, terser@^4.4.3, terser@^4.6.3:
source-map "~0.6.1"
source-map-support "~0.5.12"
terser@^4.6.12:
version "4.8.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.8.0.tgz#63056343d7c70bb29f3af665865a46fe03a0df17"
integrity sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"
source-map-support "~0.5.12"
test-exclude@^5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0"
...
...
@@ -12387,7 +12453,7 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
uuid@^3.
0.1, uuid@^3.3.2, uuid@^3.3.3
:
uuid@^3.
3.2, uuid@^3.3.3, uuid@^3.4.0
:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
...
...
@@ -12508,10 +12574,10 @@ webpack-dev-middleware@^3.7.2:
range-parser "^1.2.1"
webpack-log "^2.0.0"
webpack-dev-server@3.1
0.3
:
version "3.1
0.3
"
resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.1
0.3.tgz#f35945036813e57ef582c2420ef7b470e14d3af0
"
integrity sha512-
e4nWev8YzEVNdOMcNzNeCN947sWJNd43E5XvsJzbAL08kGc2frm1tQ32hTJslRS+H65LCb/AaUCYU7fjHCpDeQ
==
webpack-dev-server@3.1
1.0
:
version "3.1
1.0
"
resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.1
1.0.tgz#8f154a3bce1bcfd1cc618ef4e703278855e7ff8c
"
integrity sha512-
PUxZ+oSTxogFQgkTtFndEtJIPNmml7ExwufBZ9L2/Xyyd5PnOL5UreWe5ZT7IU25DSdykL9p1MLQzmLh2ljSeg
==
dependencies:
ansi-html "0.0.7"
bonjour "^3.5.0"
...
...
@@ -12521,31 +12587,31 @@ webpack-dev-server@3.10.3:
debug "^4.1.1"
del "^4.1.1"
express "^4.17.1"
html-entities "^1.
2
.1"
html-entities "^1.
3
.1"
http-proxy-middleware "0.19.1"
import-local "^2.0.0"
internal-ip "^4.3.0"
ip "^1.1.5"
is-absolute-url "^3.0.3"
killable "^1.0.1"
loglevel "^1.6.
6
"
loglevel "^1.6.
8
"
opn "^5.5.0"
p-retry "^3.0.1"
portfinder "^1.0.2
5
"
portfinder "^1.0.2
6
"
schema-utils "^1.0.0"
selfsigned "^1.10.7"
semver "^6.3.0"
serve-index "^1.9.1"
sockjs "0.3.
19
"
sockjs "0.3.
20
"
sockjs-client "1.4.0"
spdy "^4.0.
1
"
spdy "^4.0.
2
"
strip-ansi "^3.0.1"
supports-color "^6.1.0"
url "^0.11.0"
webpack-dev-middleware "^3.7.2"
webpack-log "^2.0.0"
ws "^6.2.1"
yargs "
12.0.5
"
yargs "
^13.3.2
"
webpack-log@^2.0.0:
version "2.0.0"
...
...
@@ -12602,6 +12668,13 @@ webpack@4.42.0:
watchpack "^1.6.0"
webpack-sources "^1.4.1"
websocket-driver@0.6.5:
version "0.6.5"
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.6.5.tgz#5cb2556ceb85f4373c6d8238aa691c8454e13a36"
integrity sha1-XLJVbOuF9Dc8bYI4qmkchFThOjY=
dependencies:
websocket-extensions ">=0.1.1"
websocket-driver@>=0.5.1:
version "0.7.3"
resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9"
...
...
@@ -12931,7 +13004,7 @@ y18n@^3.2.1:
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
integrity sha1-bRX7qITAhnnA136I53WegR4H+kE=
"y18n@^3.2.1 || ^4.0.0",
y18n@^4.0.0:
y18n@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
...
...
@@ -12958,14 +13031,6 @@ yaml@^1.7.2:
dependencies:
"@babel/runtime" "^7.8.7"
yargs-parser@^11.1.1:
version "11.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.1.tgz#879a0865973bca9f6bab5cbdf3b1c67ec7d3bcf4"
integrity sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==
dependencies:
camelcase "^5.0.0"
decamelize "^1.2.0"
yargs-parser@^13.1.2:
version "13.1.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"
...
...
@@ -12988,24 +13053,6 @@ yargs-parser@^9.0.2:
dependencies:
camelcase "^4.1.0"
yargs@12.0.5:
version "12.0.5"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13"
integrity sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==
dependencies:
cliui "^4.0.0"
decamelize "^1.2.0"
find-up "^3.0.0"
get-caller-file "^1.0.1"
os-locale "^3.0.0"
require-directory "^2.1.1"
require-main-filename "^1.0.1"
set-blocking "^2.0.0"
string-width "^2.0.0"
which-module "^2.0.0"
y18n "^3.2.1 || ^4.0.0"
yargs-parser "^11.1.1"
yargs@^11.0.0:
version "11.1.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.1.tgz#5052efe3446a4df5ed669c995886cc0f13702766"
...
...
@@ -13024,7 +13071,7 @@ yargs@^11.0.0:
y18n "^3.2.1"
yargs-parser "^9.0.2"
yargs@^13.3.0:
yargs@^13.3.0
, yargs@^13.3.2
:
version "13.3.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd"
integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==
...
...
jaksimsamil-server/src/models/challenge.js
View file @
05582aa
...
...
@@ -2,47 +2,48 @@ const mongoose = require("mongoose");
const
{
Schema
}
=
mongoose
;
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
isOpen
:
{
type
:
Boolean
},
},
{
collection
:
"challenge"
,
}
);
ChallengeSchema
.
statics
.
findByChallengeName
=
function
(
challengeName
)
{
return
this
.
findOne
({
challengeName
:
challengeName
});
};
ChallengeSchema
.
methods
.
getChallengeName
=
function
()
{
return
this
.
challengeName
;
};
ChallengeSchema
.
methods
.
getStartDate
=
function
()
{
return
this
.
startDate
;
};
ChallengeSchema
.
methods
.
getEndDate
=
function
()
{
return
this
.
endDate
;
};
ChallengeSchema
.
methods
.
getDurationPerSession
=
function
()
{
return
this
.
durationPerSession
;
};
ChallengeSchema
.
methods
.
getGoalPerSession
=
function
()
{
return
this
.
goalPerSession
;
};
ChallengeSchema
.
methods
.
serialize
=
function
()
{
return
this
.
toJSON
();
};
const
Challenge
=
mongoose
.
model
(
"Challenge"
,
ChallengeSchema
);
module
.
exports
=
Challenge
;
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
status
:
{
type
:
String
}
},{
collection
:
'challenge'
});
ChallengeSchema
.
statics
.
findByChallengeName
=
function
(
challengeName
){
return
this
.
findOne
({
challengeName
:
challengeName
});
}
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
.
getStatus
=
function
(){
return
this
.
status
;
}
ChallengeSchema
.
methods
.
serialize
=
function
(){
return
this
.
toJSON
();
}
const
Challenge
=
mongoose
.
model
(
'Challenge'
,
ChallengeSchema
);
module
.
exports
=
Challenge
;
\ No newline at end of file
...
...
jaksimsamil-server/src/models/session.js
View file @
05582aa
...
...
@@ -6,7 +6,7 @@ const SessionSchema = new Schema({
challengeId
:
{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'Challenge'
},
sessionStartDate
:
{
type
:
Object
},
sessionEndDate
:
{
type
:
Object
},
isOpen
:
{
type
:
Boolean
}
status
:
{
type
:
String
}
},{
collection
:
'session'
});
...
...
@@ -23,8 +23,8 @@ SessionSchema.methods.getSessionEndDate=function(){
return
this
.
sessionEndDate
;
}
SessionSchema
.
methods
.
get
IsOpen
=
function
(){
return
this
.
isOpen
;
SessionSchema
.
methods
.
get
Status
=
function
(){
return
this
.
status
;
}
SessionSchema
.
methods
.
serialize
=
function
(){
...
...
Please
register
or
login
to post a comment