mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
Added graph API for assets
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user