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-21 17:50:31 +0900
1
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ce195302ab0205fd4648b0a3c53711b2e20878f5
ce195302
1 parent
9faca42b
Force collection name
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
3 deletions
jaksimsamil-server/src/models/challenge.js
jaksimsamil-server/src/models/group.js
jaksimsamil-server/src/models/participation.js
jaksimsamil-server/src/models/problem.js
jaksimsamil-server/src/models/session.js
jaksimsamil-server/src/models/user.js
jaksimsamil-server/src/models/challenge.js
View file @
ce19530
...
...
@@ -9,6 +9,8 @@ const ChallengeSchema=new Schema({
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
){
...
...
jaksimsamil-server/src/models/group.js
View file @
ce19530
...
...
@@ -4,6 +4,8 @@ const { Schema } = mongoose;
const
GroupSchema
=
new
Schema
({
members
:
[{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'User'
}]
},{
collection
:
'group'
});
const
Group
=
mongoose
.
model
(
'Group'
,
GroupSchema
);
...
...
jaksimsamil-server/src/models/participation.js
View file @
ce19530
...
...
@@ -5,6 +5,8 @@ const { Schema } = mongoose;
const
ParticipationSchema
=
new
Schema
({
sessionId
:
{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'Session'
},
groupId
:
{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'Group'
}
},{
collection
:
'particiaption'
});
const
Participation
=
mongoose
.
model
(
'Participation'
,
ParticipationSchema
);
...
...
jaksimsamil-server/src/models/problem.js
View file @
ce19530
...
...
@@ -10,6 +10,8 @@ const ProblemSchema=new Schema({
correctNum
:
{
type
:
Number
,
required
:
true
},
count
:
{
type
:
Number
},
category
:
{
type
:[
String
]}
},{
collection
:
'problem'
});
ProblemSchema
.
statics
.
findByProblemNum
=
function
(
problemNum
){
...
...
@@ -59,5 +61,5 @@ ProblemSchema.methods.serialize=function(){
return
this
.
toJSON
();
}
const
Problem
=
mongoose
.
model
(
'Problem'
,
ProblemSchema
);
module
.
exports
=
Problem
;
\ No newline at end of file
const
Problem
=
mongoose
.
model
(
'Problem'
,
ProblemSchema
);
module
.
exports
=
Problem
;
\ No newline at end of file
...
...
jaksimsamil-server/src/models/session.js
View file @
ce19530
...
...
@@ -5,7 +5,10 @@ const { Schema } = mongoose;
const
SessionSchema
=
new
Schema
({
challengeId
:
{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'Challenge'
},
sessionStartDate
:
{
type
:
Object
},
sessionEndDate
:
{
type
:
Object
}
sessionEndDate
:
{
type
:
Object
},
isOpen
:
{
type
:
Boolean
}
},{
collection
:
'session'
});
const
Session
=
mongoose
.
model
(
'Session'
,
SessionSchema
);
...
...
jaksimsamil-server/src/models/user.js
View file @
ce19530
...
...
@@ -13,6 +13,8 @@ const UserSchema = new Schema({
friendList
:
[{
type
:
Schema
.
Types
.
ObjectId
,
ref
:
'User'
}],
slackWebHookURL
:
String
,
goalNum
:
Number
,
},{
collection
:
'user'
});
UserSchema
.
statics
.
findByUsername
=
function
(
username
)
{
...
...
송용우
@2019102188
2020-09-26 12:41:26 UTC
Mentioned in commit
42919eb6
Please
register
or
login
to post a comment