Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-arena-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-arena-api
Commits
e2c65dc0
Commit
e2c65dc0
authored
Jan 09, 2019
by
Joe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api
parent
aeb2e0ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
2 deletions
+70
-2
routes/api.js
routes/api.js
+70
-2
No files found.
routes/api.js
View file @
e2c65dc0
...
...
@@ -162,9 +162,9 @@ router.post('/score', function (req, res) {
let
arena
=
req
.
body
.
arena
||
'
entertain
'
if
(
userscoreA
==
-
5
&&
userscoreB
==
-
5
)
{
return
res
.
status
(
200
).
send
(
'
ghost match wont calculate the score.
'
);
return
res
.
status
(
200
).
send
(
'
ghost match wont calculate the score.
'
);
}
if
(
!
usernameA
||
!
usernameB
)
{
return
res
.
status
(
404
).
send
(
'
username can not be null
'
)
}
...
...
@@ -2022,6 +2022,74 @@ router.post('/adSwitchChange', function (req, res) {
});
router
.
get
(
'
/label
'
,
function
(
req
,
res
)
{
pool
.
connect
(
function
(
err
,
client
,
done
)
{
if
(
err
)
{
done
()
return
console
.
error
(
'
error fetching client from pool
'
,
err
);
}
var
sql
=
"
select config_value from site_config where config_key = 'label'
"
console
.
log
(
sql
)
client
.
query
(
sql
,
function
(
err
,
result
)
{
done
()
var
text
=
result
.
rows
[
0
].
config_value
var
response
=
{};
if
(
err
)
{
console
.
log
(
err
)
response
.
code
=
500
;
}
else
{
response
.
code
=
200
;
response
.
text
=
text
;
}
res
.
json
(
response
);
});
});
});
router
.
post
(
'
/label
'
,
function
(
req
,
res
)
{
// to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool
pool
.
connect
(
function
(
err
,
client
,
done
)
{
if
(
err
)
{
done
()
return
console
.
error
(
'
error fetching client from pool
'
,
err
);
}
let
labelone
=
req
.
body
.
labelone
;
var
sql
=
`update site_config set
config_value = '
${
labelone
}
'
where config_key = 'label'`
;
console
.
log
(
sql
);
client
.
query
(
sql
,
function
(
err
,
result
)
{
done
();
var
response
=
{};
if
(
err
)
{
console
.
log
(
err
)
response
.
code
=
500
;
}
else
{
response
.
code
=
200
;
}
res
.
json
(
response
);
});
});
});
router
.
post
(
'
/activity
'
,
function
(
req
,
res
)
{
// to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool
...
...
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