Toggle navigation
Toggle navigation
This project
Loading...
Sign in
엄성진
/
learn-in-web-backend
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
sungjin
2021-12-02 19:19:49 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b61431853beb21e0b2690880adc2796cc454b5cc
b6143185
1 parent
7fcad948
Fix cpp, add level when making post.
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
README.md
src/post/post.service.ts
src/runner/runner.service.ts
README.md
100755 → 100644
View file @
b614318
This diff is collapsed. Click to expand it.
src/post/post.service.ts
View file @
b614318
...
...
@@ -18,12 +18,21 @@ export class PostService {
example
:
string
,
testinput
:
string
[],
testoutput
:
string
[],
difficulty
:
number
,
)
{
const
user
=
await
this
.
auth
.
validateUser
(
(
await
this
.
auth
.
getUserFromToken
(
token
)
).
id
,
);
let
level
:
Level
;
if
(
difficulty
==
1
)
{
level
=
'LOW'
;
}
else
if
(
difficulty
==
2
)
{
level
=
'MEDIUM'
;
}
else
{
level
=
'HIGH'
;
}
const
post
=
await
this
.
prisma
.
post
.
create
({
data
:
{
author
:
{
...
...
@@ -37,6 +46,7 @@ export class PostService {
example
:
example
,
testinput
:
testinput
,
testoutput
:
testoutput
,
level
:
level
,
},
});
return
post
;
...
...
src/runner/runner.service.ts
View file @
b614318
...
...
@@ -85,7 +85,7 @@ export class RunnerService {
cpp
(
body
:
any
,
location
:
string
)
{
const
output
:
Array
<
string
>
=
[];
if
(
body
.
input
==
[])
{
const
test
=
child_process
.
spawnSync
(
'g
cc
'
,
[
location
,
'-o'
,
'tmp'
],
{
const
test
=
child_process
.
spawnSync
(
'g
++
'
,
[
location
,
'-o'
,
'tmp'
],
{
encoding
:
'utf8'
,
shell
:
true
,
});
...
...
@@ -101,7 +101,7 @@ export class RunnerService {
output
.
push
(
result
.
stdout
as
string
);
}
for
(
const
ip
of
body
.
input
)
{
const
test
=
child_process
.
spawnSync
(
'g
cc
'
,
[
location
,
'-o'
,
'tmp'
],
{
const
test
=
child_process
.
spawnSync
(
'g
++
'
,
[
location
,
'-o'
,
'tmp'
],
{
encoding
:
'utf8'
,
shell
:
true
,
});
...
...
@@ -176,7 +176,7 @@ export class RunnerService {
output
.
push
(
result
.
stdout
as
string
);
}
for
(
const
ip
of
body
.
input
)
{
const
result
=
child_process
.
spawnSync
(
'
go
'
,
[
'run'
,
location
],
{
const
result
=
child_process
.
spawnSync
(
'
ts-node
'
,
[
'run'
,
location
],
{
encoding
:
'utf8'
,
shell
:
true
,
input
:
ip
,
...
...
Please
register
or
login
to post a comment