Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mirera-db
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mirera
mirera-db
Commits
2dff8a9c
Commit
2dff8a9c
authored
Sep 24, 2016
by
Данила Ерёмин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updateContest and removeContestLogo functions
parent
4fd9b49c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
6 deletions
+12
-6
dbContest.js
dbContest.js
+3
-0
file.js
file.js
+3
-0
models/Contest.js
models/Contest.js
+3
-3
models/Course.js
models/Course.js
+1
-1
models/Program.js
models/Program.js
+1
-1
models/Task.js
models/Task.js
+1
-1
No files found.
dbContest.js
View file @
2dff8a9c
...
...
@@ -11,6 +11,9 @@ module.exports = function (Contest) {
addContest
:
function
(
courseId
,
name
,
info
,
description
,
start
,
finish
,
meta
)
{
return
dbUtils
.
dbCreateItem
(
Contest
,{
course
:
courseId
,
name
:
name
,
info
:
info
,
description
:
description
,
start
:
start
,
finish
:
finish
,
meta
:
meta
});
},
updateContest
:
function
(
contestId
,
name
,
info
,
description
,
start
,
finish
)
{
return
dbUtils
.
dbFindOneAndUpdate
(
Contest
,{
_id
:
contestId
},{
name
:
name
,
info
:
info
,
description
:
description
,
start
:
start
,
finish
:
finish
});
},
getContestById
:
function
(
contestId
)
{
return
dbUtils
.
dbFindOne
(
Contest
,
{
_id
:
contestId
},
[{
path
:
'
course
'
}]);
},
...
...
file.js
View file @
2dff8a9c
...
...
@@ -12,6 +12,9 @@ module.exports = function (gfs) {
getCourseLogo
:
function
(
courseId
)
{
return
dbUtils
.
readFileToBuffer
(
gfs
,
courseId
.
toString
()
+
'
/logo.png
'
);
},
removeContestLogo
:
function
(
contestId
)
{
return
dbUtils
.
removeFile
(
gfs
,
contestId
.
toString
()
+
'
/logo.png
'
);
},
saveContestLogo
:
function
(
path
,
contestId
)
{
return
dbUtils
.
copyFileToGridFS
(
gfs
,
path
,
contestId
.
toString
()
+
'
/logo.png
'
);
},
...
...
models/Contest.js
View file @
2dff8a9c
...
...
@@ -30,17 +30,17 @@ var ContestSchema = new mongoose.Schema({
created
:
{
type
:
Date
,
default
:
Date
.
now
,
required
:
true
,
required
:
true
},
start
:
{
type
:
Date
,
default
:
Date
.
now
,
required
:
true
,
required
:
true
},
finish
:
{
type
:
Date
,
default
:
Date
.
now
,
required
:
true
,
required
:
true
},
meta
:
{
type
:
{},
...
...
models/Course.js
View file @
2dff8a9c
...
...
@@ -30,7 +30,7 @@ var CourseSchema = new mongoose.Schema({
created
:
{
type
:
Date
,
default
:
Date
.
now
,
required
:
true
,
required
:
true
}
});
...
...
models/Program.js
View file @
2dff8a9c
...
...
@@ -17,7 +17,7 @@ var ProgramSchema = new mongoose.Schema({
testProgramId
:
{
type
:
mongoose
.
Schema
.
Types
.
ObjectId
,
required
:
true
}
,
}
});
module
.
exports
=
ProgramSchema
;
\ No newline at end of file
models/Task.js
View file @
2dff8a9c
...
...
@@ -35,7 +35,7 @@ var TaskSchema = new mongoose.Schema({
created
:
{
type
:
Date
,
default
:
Date
.
now
,
required
:
true
,
required
:
true
},
meta
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment