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 16:21:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d7addc74a6cfde258739cff062eff768c5afef5c
d7addc74
1 parent
dff7309c
Fix query using _ids
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
6 deletions
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/group.js
View file @
d7addc7
...
...
@@ -9,9 +9,17 @@ const GroupSchema = new Schema({
});
GroupSchema
.
methods
.
addGroupMemeber
=
function
(
user
){
this
.
members
.
push
(
{
$oid
:
user
.
_id
.
$oid
}
);
this
.
members
.
push
(
user
.
_id
);
return
this
.
save
();
}
GroupSchema
.
methods
.
getMembers
=
function
(){
return
this
.
members
;
}
GroupSchema
.
methods
.
serialize
=
function
(){
return
this
.
toJSON
();
}
const
Group
=
mongoose
.
model
(
'Group'
,
GroupSchema
);
module
.
exports
=
Group
;
\ No newline at end of file
...
...
jaksimsamil-server/src/models/participation.js
View file @
d7addc7
...
...
@@ -18,11 +18,11 @@ const ParticipationSchema = new Schema({
});
ParticipationSchema
.
statics
.
findBySessionId
=
function
(
session
){
return
this
.
find
({
sessionId
:
session
.
_id
.
$oid
});
return
this
.
find
({
sessionId
:
session
.
_id
});
}
ParticipationSchema
.
statics
.
findByGroupId
=
function
(
group
){
return
this
.
find
({
groupId
:
group
.
_id
.
$oid
});
return
this
.
find
({
groupId
:
group
.
_id
});
}
ParticipationSchema
.
methods
.
addProblem
=
function
(
problem
){
...
...
jaksimsamil-server/src/models/problem.js
View file @
d7addc7
...
...
@@ -9,7 +9,7 @@ const ProblemSchema=new Schema({
sumbitNum
:
{
type
:
Number
,
required
:
true
},
correctNum
:
{
type
:
Number
,
required
:
true
},
count
:
{
type
:
Number
},
category
:
{
type
:[
String
]}
category
:
[{
type
:
String
}],
},{
collection
:
'problem'
});
...
...
jaksimsamil-server/src/models/session.js
View file @
d7addc7
...
...
@@ -12,7 +12,7 @@ const SessionSchema = new Schema({
});
SessionSchema
.
statics
.
findByChallengeId
=
function
(
challenge
){
return
this
.
find
({
challengeId
:
challenge
.
_id
.
$oid
});
return
this
.
find
({
challengeId
:
challenge
.
_id
});
}
SessionSchema
.
methods
.
getSessionStartDate
=
function
(){
...
...
jaksimsamil-server/src/models/user.js
View file @
d7addc7
...
...
@@ -22,7 +22,7 @@ UserSchema.statics.findByUsername = function (username) {
};
UserSchema
.
methods
.
addFriend
=
function
(
friend
){
this
.
friendList
.
push
(
{
$oid
:
friend
.
_id
.
$oid
}
);
this
.
friendList
.
push
(
friend
.
_id
);
return
this
.
save
();
}
...
...
Please
register
or
login
to post a comment