Add updateRequestState endpoint
This commit is contained in:
parent
75e5022090
commit
0f3d921d96
2 changed files with 44 additions and 0 deletions
21
src/app.ts
21
src/app.ts
|
@ -39,6 +39,27 @@ app.post("/api/addRequest", async (request, response) => {
|
|||
.catch((e: any) => errorHandler(request,response,e));
|
||||
});
|
||||
|
||||
app.post("/api/updateRequestState", async (request, response) => {
|
||||
response.type('text/plain');
|
||||
if (!request.body.url) {
|
||||
response.status(400);
|
||||
response.send("Missing url");
|
||||
return
|
||||
}
|
||||
if (!request.body.state) {
|
||||
response.status(400);
|
||||
response.send("Missing scoreDiff");
|
||||
return
|
||||
}
|
||||
var url = request.body.url as string;
|
||||
var state = request.body.state as string;
|
||||
requests.updateRequestState(url,state).then((val: [number,string]) => {
|
||||
response.status(val[0]);
|
||||
response.send(val[1]);
|
||||
})
|
||||
.catch((e: any) => errorHandler(request,response,e));
|
||||
});
|
||||
|
||||
app.post("/api/updateRequestScore", async (request, response) => {
|
||||
response.type('text/plain');
|
||||
if (!request.body.url) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue