Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

feat(hosting): add extraSqlPerso path #281

Merged
merged 1 commit into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/api/hosting/web/extraSqlPerso/extraSqlPerso.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('ovh-api-services').service('OvhApiHostingWebExtraSqlPerso', ($injector) => ({
v6() {
return $injector.get('OvhApiHostingWebExtraSqlPersoV6');
},
}));
63 changes: 63 additions & 0 deletions src/api/hosting/web/extraSqlPerso/extraSqlPerso.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
angular.module('ovh-api-services').service('OvhApiHostingWebExtraSqlPersoV6', ($cacheFactory, $resource) => {
const cache = $cacheFactory('OvhApiHostingWebExtraSqlPersoV6');
const queryCache = $cacheFactory('OvhApiHostingWebExtraSqlPersoV6Query');

const interceptor = {
response(response) {
cache.resetCache();
queryCache.resetCache();
return response.data;
},
};

const resource = $resource('/hosting/web/:serviceName/extraSqlPerso/:name', {
serviceName: '@serviceName',
name: '@name',
}, {
query: {
method: 'GET',
isArray: true,
cache: queryCache,
},

get: {
method: 'GET',
cache,
},

queryDatabases: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/databases',
method: 'GET',
isArray: true,
cache: queryCache,
},

getServiceInfos: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/serviceInfos',
method: 'GET',
cache,
},

updateServiceInfos: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/serviceInfosUpdate',
method: 'POST',
interceptor,
},

terminate: {
url: '/hosting/web/:serviceName/extraSqlPerso/:name/terminate',
method: 'POST',
interceptor,
},
});

resource.resetCache = function resetCache() {
cache.removeAll();
};

resource.resetQueryCache = function resetQueryCache() {
queryCache.removeAll();
};

return resource;
});
3 changes: 3 additions & 0 deletions src/api/hosting/web/web.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ angular.module('ovh-api-services').service('OvhApiHostingWeb', ($injector) => ({
Database() {
return $injector.get('OvhApiHostingWebDatabase');
},
ExtraSqlPerso() {
return $injector.get('OvhApiHostingWebExtraSqlPerso');
},
ModuleList() {
return $injector.get('OvhApiHostingWebModuleList');
},
Expand Down