mirror of
https://github.com/wassname/talk.git
synced 2026-08-11 11:27:10 +08:00
Merge pull request #169 from coralproject/pluralize-asset
pluralize asset endpoints
This commit is contained in:
@@ -16,7 +16,7 @@ export const updateConfiguration = newConfig => (dispatch, getState) => {
|
||||
.toArray()[0];
|
||||
|
||||
dispatch(updateConfigRequest());
|
||||
coralApi(`/asset/${assetId}/settings`, {method: 'PUT', body: newConfig})
|
||||
coralApi(`/assets/${assetId}/settings`, {method: 'PUT', body: newConfig})
|
||||
.then(() => {
|
||||
dispatch(addNotification('success', lang.t('successUpdateSettings')));
|
||||
dispatch(updateConfigSuccess(newConfig));
|
||||
@@ -31,7 +31,7 @@ export const updateOpenStream = closedBody => (dispatch, getState) => {
|
||||
|
||||
dispatch(updateConfigRequest());
|
||||
|
||||
coralApi(`/asset/${assetId}/status`, {method: 'PUT', body: closedBody})
|
||||
coralApi(`/assets/${assetId}/status`, {method: 'PUT', body: closedBody})
|
||||
.then(() => {
|
||||
dispatch(addNotification('success', lang.t('successUpdateSettings')));
|
||||
dispatch(updateConfigSuccess(closedBody));
|
||||
|
||||
+4
-4
@@ -256,7 +256,7 @@ paths:
|
||||
description: An error occured.
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
/asset:
|
||||
/assets:
|
||||
get:
|
||||
parameters:
|
||||
- name: limit
|
||||
@@ -294,7 +294,7 @@ paths:
|
||||
items:
|
||||
$ref: '#/definitions/Asset'
|
||||
|
||||
/asset/{asset_id}:
|
||||
/assets/{asset_id}:
|
||||
get:
|
||||
parameters:
|
||||
- name: asset_id
|
||||
@@ -315,7 +315,7 @@ paths:
|
||||
$ref: '#/definitions/Error'
|
||||
|
||||
|
||||
/asset/{asset_id}/scrape:
|
||||
/assets/{asset_id}/scrape:
|
||||
post:
|
||||
parameters:
|
||||
- name: asset_id
|
||||
@@ -335,7 +335,7 @@ paths:
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
|
||||
/asset/{asset_id}/settings:
|
||||
/assets/{asset_id}/settings:
|
||||
put:
|
||||
parameters:
|
||||
- name: asset_id
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ const router = express.Router();
|
||||
// Filter all content going down the pipe based on user roles.
|
||||
router.use(payloadFilter);
|
||||
|
||||
router.use('/asset', authorization.needed('admin'), require('./asset'));
|
||||
router.use('/assets', authorization.needed('admin'), require('./assets'));
|
||||
router.use('/settings', authorization.needed('admin'), require('./settings'));
|
||||
router.use('/queue', authorization.needed('admin'), require('./queue'));
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('/api/v1/assets', () => {
|
||||
|
||||
it('should return all assets without a search query', () => {
|
||||
return chai.request(app)
|
||||
.get('/api/v1/asset')
|
||||
.get('/api/v1/assets')
|
||||
.set(passport.inject({roles: ['admin']}))
|
||||
.then((res) => {
|
||||
const body = res.body;
|
||||
@@ -48,7 +48,7 @@ describe('/api/v1/assets', () => {
|
||||
|
||||
it('should return assets that we search for', () => {
|
||||
return chai.request(app)
|
||||
.get('/api/v1/asset?search=term2')
|
||||
.get('/api/v1/assets?search=term2')
|
||||
.set(passport.inject({roles: ['admin']}))
|
||||
.then((res) => {
|
||||
const body = res.body;
|
||||
@@ -69,7 +69,7 @@ describe('/api/v1/assets', () => {
|
||||
|
||||
it('should not return assets that we do not search for', () => {
|
||||
return chai.request(app)
|
||||
.get('/api/v1/asset?search=term3')
|
||||
.get('/api/v1/assets?search=term3')
|
||||
.set(passport.inject({roles: ['admin']}))
|
||||
.then((res) => {
|
||||
const body = res.body;
|
||||
@@ -94,7 +94,7 @@ describe('/api/v1/assets', () => {
|
||||
expect(asset).to.have.property('closedAt', null);
|
||||
|
||||
return chai.request(app)
|
||||
.put(`/api/v1/asset/${asset.id}/status`)
|
||||
.put(`/api/v1/assets/${asset.id}/status`)
|
||||
.set(passport.inject({roles: ['admin']}))
|
||||
.send({closedAt: today});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user