Added graph API for assets

This commit is contained in:
Wyatt Johnson
2017-08-28 18:57:32 -06:00
parent df6f6a72ef
commit 90a8a87eaf
11 changed files with 342 additions and 36 deletions
-20
View File
@@ -1,7 +1,6 @@
const express = require('express');
const router = express.Router();
const scraper = require('../../../services/scraper');
const errors = require('../../../errors');
const AssetsService = require('../../../services/assets');
@@ -88,25 +87,6 @@ router.get('/:asset_id', async (req, res, next) => {
}
});
// Adds the asset id to the queue to be scraped.
router.post('/:asset_id/scrape', async (req, res, next) => {
try {
// Send back the asset.
let asset = await AssetsService.findById(req.params.asset_id);
if (!asset) {
return next(errors.ErrNotFound);
}
let job = await scraper.create(asset);
// Send the job back for monitoring.
res.status(201).json(job);
} catch (e) {
return next(e);
}
});
router.put('/:asset_id/settings', async (req, res, next) => {
try {
await AssetsService.overrideSettings(req.params.asset_id, req.body);