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
213340cb
Commit
213340cb
authored
Apr 21, 2020
by
Никита Бесшапошников
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected compilers and programs
parent
16d934fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
48 deletions
+25
-48
compiler.js
compiler.js
+9
-19
index.js
index.js
+1
-0
program.js
program.js
+15
-29
No files found.
compiler.js
View file @
213340cb
"
use strict
"
;
const
mongoose
=
require
(
'
mongoose
'
);
const
logger
=
require
(
'
../libs/log
'
);
const
CompilerSchema
=
new
mongoose
.
Schema
({
name
:
{
...
...
@@ -52,22 +51,19 @@ module.exports.getAll = () => {
return
Compiler
.
find
({});
};
module
.
exports
.
getMany
=
(
ids
)
=>
{
module
.
exports
.
getMany
=
ids
=>
{
return
Compiler
.
findOne
({
_id
:
{
$in
:
ids
}});
};
module
.
exports
.
getShotForNames
=
(
names
)
=>
{
module
.
exports
.
getShotForNames
=
names
=>
{
return
Compiler
.
find
({
name
:
{
$in
:
names
}}).
select
({
_id
:
0
,
name
:
1
,
displayedName
:
1
,
isProject
:
1
,
extensions
:
1
});
};
module
.
exports
.
getCompiler
=
(
compilerId
)
=>
{
return
Compiler
.
findOne
({
_id
:
compilerId
})
.
catch
(
err
=>
{
logger
.
error
(
err
);
});
module
.
exports
.
get
=
id
=>
{
return
Compiler
.
findOne
({
_id
:
id
})
};
module
.
exports
.
add
Compiler
=
(
name
,
displayedName
,
isProject
,
compileCommands
,
detectCommand
,
detectOutput
,
runCommand
,
forcedCompileOutputExtension
)
=>
{
module
.
exports
.
add
=
(
name
,
displayedName
,
isProject
,
compileCommands
,
detectCommand
,
detectOutput
,
runCommand
,
forcedCompileOutputExtension
)
=>
{
return
(
new
Compiler
({
name
:
name
,
displayedName
:
displayedName
,
...
...
@@ -77,15 +73,12 @@ module.exports.addCompiler = (name, displayedName, isProject, compileCommands, d
detectOutput
:
detectOutput
,
runCommand
:
runCommand
,
forcedCompileOutputExtension
:
forcedCompileOutputExtension
}))
.
save
()
.
catch
(
err
=>
{
logger
.
error
(
err
);
});
})).
save
()
};
module
.
exports
.
update
Compiler
=
(
compilerI
d
,
name
,
displayedName
,
isProject
,
compileCommands
,
detectCommand
,
detectOutput
,
runCommand
,
forcedCompileOutputExtension
)
=>
{
return
Compiler
.
findOneAndUpdate
({
_id
:
compilerI
d
},
{
module
.
exports
.
update
=
(
i
d
,
name
,
displayedName
,
isProject
,
compileCommands
,
detectCommand
,
detectOutput
,
runCommand
,
forcedCompileOutputExtension
)
=>
{
return
Compiler
.
findOneAndUpdate
({
_id
:
i
d
},
{
name
:
name
,
displayedName
:
displayedName
,
isProject
:
isProject
,
...
...
@@ -95,7 +88,4 @@ module.exports.updateCompiler = (compilerId, name, displayedName, isProject, com
runCommand
:
runCommand
,
forcedCompileOutputExtension
:
forcedCompileOutputExtension
})
.
catch
(
err
=>
{
logger
.
error
(
err
);
})
};
index.js
View file @
213340cb
...
...
@@ -63,6 +63,7 @@ module.exports.connect = async (uri, options) => {
module
.
exports
.
timetables
=
require
(
'
./timetable
'
);
module
.
exports
.
solutions
=
require
(
'
./solution
'
);
module
.
exports
.
compilers
=
require
(
'
./compiler
'
);
module
.
exports
.
programs
=
require
(
'
./program
'
);
module
.
exports
.
testers
=
require
(
'
./tester
'
);
}
catch
(
error
)
{
...
...
program.js
View file @
213340cb
"
use strict
"
;
const
mongoose
=
require
(
'
mongoose
'
);
const
logger
=
require
(
'
../libs/log
'
);
const
ProgramSchema
=
new
mongoose
.
Schema
({
compiler
:
{
...
...
@@ -43,39 +41,27 @@ module.exports.schema = ProgramSchema;
const
Program
=
mongoose
.
connection
.
model
(
'
Program
'
,
ProgramSchema
);
module
.
exports
.
model
=
Program
;
module
.
exports
.
get
Programs
=
()
=>
{
module
.
exports
.
get
All
=
()
=>
{
return
Program
.
find
({})
.
catch
(
err
=>
{
logger
.
error
(
err
);
});
};
module
.
exports
.
getProgram
=
(
programId
)
=>
{
return
Program
.
findOne
({
_id
:
programId
})
.
catch
(
err
=>
{
logger
.
error
(
err
);
});
module
.
exports
.
get
=
id
=>
{
return
Program
.
findOne
({
_id
:
id
})
};
module
.
exports
.
getProgramsForOwner
=
(
userId
)
=>
{
return
Program
.
find
({
owner
:
userId
})
.
catch
(
err
=>
{
logger
.
error
(
err
);
});
module
.
exports
.
getForOwner
=
owner
=>
{
return
Program
.
find
({
owner
});
};
module
.
exports
.
add
Program
=
(
userId
,
displayedName
,
compiler
,
compilerArgs
,
file
,
IOType
,
outputFileNames
)
=>
{
module
.
exports
.
add
=
(
owner
,
displayedName
,
compiler
,
compilerArgs
,
file
,
IOType
,
outputFileNames
)
=>
{
return
(
new
Program
({
owner
:
userId
,
displayedName
:
displayedName
,
compiler
:
compiler
,
compilerArgs
:
compilerArgs
,
file
:
file
,
IOType
:
IOType
,
outputFileNames
:
outputFileNames
}))
.
save
()
.
catch
(
err
=>
{
logger
.
error
(
err
);
});
owner
,
displayedName
,
compiler
,
compilerArgs
,
file
,
IOType
,
outputFileNames
})).
save
()
};
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