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
JJuOn
2020-08-25 17:09:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
638ffb08b3063424a3c5313c3e31909db6d63444
638ffb08
1 parent
16421cc1
Add routing challenge api
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
jaksimsamil-server/src/api/challenge/challege.ctrl.js
jaksimsamil-server/src/api/challenge/index.js
jaksimsamil-server/src/api/index.js
jaksimsamil-server/src/api/challenge/challege.ctrl.js
View file @
638ffb0
...
...
@@ -25,7 +25,6 @@ exports.getChallenge = async (ctx) => {
endDate: Date Object,
durationPerSession: "2w", // '1d' means one day per session, '2w' means 2 weeks per session, '3m' means 3 months per session.
goalPerSession: 3,
groups: [{'name1', 'name2'}]
}
*/
exports
.
addChallenge
=
async
(
ctx
)
=>
{
...
...
@@ -35,8 +34,7 @@ exports.addChallenge = async (ctx) => {
startDate
:
Joi
.
date
(),
endDate
:
Joi
.
date
(),
durationPerSession
:
Joi
.
string
(),
goalPerSession
:
Joi
.
number
(),
groups
:
Joi
.
array
().
items
(
Joi
.
string
()),
goalPerSession
:
Joi
.
number
()
})
.
unknown
();
const
result
=
Joi
.
validate
(
ctx
.
request
.
body
,
schema
);
...
...
jaksimsamil-server/src/api/challenge/index.js
View file @
638ffb0
const
Router
=
require
(
'koa-router'
);
const
challenge
=
new
Router
();
const
challengeCtrl
=
require
(
'./challege.ctrl'
);
challenge
.
post
(
"/getchallenge"
,
challengeCtrl
.
getChallenge
);
challenge
.
post
(
"/addchallenge"
,
challengeCtrl
.
addChallenge
);
module
.
exports
=
challenge
;
\ No newline at end of file
...
...
jaksimsamil-server/src/api/index.js
View file @
638ffb0
...
...
@@ -6,11 +6,13 @@ const friend = require("./friend");
const
notify
=
require
(
"./notify"
);
const
user
=
require
(
"./user"
);
const
profile
=
require
(
"./profile"
);
const
challenge
=
require
(
"./challenge"
);
api
.
use
(
"/auth"
,
auth
.
routes
());
api
.
use
(
"/friend"
,
friend
.
routes
());
api
.
use
(
"/notify"
,
notify
.
routes
());
api
.
use
(
"/user"
,
user
.
routes
());
api
.
use
(
"/profile"
,
profile
.
routes
());
api
.
use
(
"/challenge"
,
challenge
.
routes
());
module
.
exports
=
api
;
...
...
Please
register
or
login
to post a comment