-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update apply * updates * fix * fix http status logs * add algorithm build API * update algorithm build API * update algorithm build API * swagger-ui update * improve validation * apply algorithm * fixes * updates * update algorithm apply * updates * updates * update PR * update PR * updates
- Loading branch information
1 parent
e73a0d0
commit 4d55974
Showing
19 changed files
with
2,436 additions
and
820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ npm-debug.log* | |
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
#uploads | ||
# uploads | ||
uploads | ||
|
||
# IDE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const express = require('express'); | ||
const builds = require('../../../../lib/service/builds'); | ||
const methods = require('../../middlewares/methods'); | ||
const logger = require('../../middlewares/logger'); | ||
|
||
const routes = (options) => { | ||
const router = express.Router(); | ||
router.get('/', (req, res, next) => { | ||
res.json({ message: `${options.version} ${options.file} api` }); | ||
next(); | ||
}); | ||
router.all('/status/:buildId?', methods(['GET']), logger(), (req, res, next) => { | ||
const { buildId } = req.params; | ||
builds.getBuild({ buildId }).then((response) => { | ||
res.json(response); | ||
next(); | ||
}).catch((error) => { | ||
return next(error); | ||
}); | ||
}); | ||
router.all('/list/:name?', methods(['GET']), logger(), (req, res, next) => { | ||
const { name } = req.params; | ||
const { sort, order, limit } = req.query; | ||
builds.getBuilds({ name, sort, order, limit }).then((response) => { | ||
res.json(response); | ||
next(); | ||
}).catch((error) => { | ||
return next(error); | ||
}); | ||
}); | ||
router.all('/stop', methods(['POST']), logger(), (req, res, next) => { | ||
const { buildId } = req.body; | ||
builds.stopBuild({ buildId }).then(() => { | ||
res.json({ message: 'OK' }); | ||
next(); | ||
}).catch((error) => { | ||
return next(error); | ||
}); | ||
}); | ||
router.all('/rerun', methods(['POST']), logger(), (req, res, next) => { | ||
const { buildId } = req.body; | ||
builds.rerunBuild({ buildId }).then(() => { | ||
res.json({ message: 'OK' }); | ||
next(); | ||
}).catch((error) => { | ||
return next(error); | ||
}); | ||
}); | ||
return router; | ||
}; | ||
|
||
module.exports = routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.