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

Commit

Permalink
feat(spare): add spare management for telephony and xdsl
Browse files Browse the repository at this point in the history
Ref: UXCT-177
  • Loading branch information
Stephanie Moallic committed Jul 29, 2019
1 parent fc62865 commit 101d8e3
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/api/telephony/spare/telephony-spare.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
angular.module("ovh-api-services").service("OvhApiTelephonySpare", function ($injector, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiTelephonySpare");

return {
v6: function () {
return $injector.get("OvhApiTelephonySpareV6");
},
resetCache: function () {
cache.removeAll();
},
cache: cache
};
});
61 changes: 61 additions & 0 deletions src/api/telephony/spare/telephony-spare.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
angular.module("ovh-api-services").service("OvhApiTelephonySpareV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiTelephonySpareV6");
var queryCache = $cacheFactory("OvhApiTelephonySpareV6V6Query");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.resource;
}
};

var spareResource = $resource("/telephony/spare", {
spare: "@spare"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: cache
},
getSpare: {
method: "GET",
url: "/telephony/spare/:spare"
},
replaceSpare: {
method: "POST",
url: "/telephony/spare/:spare/replace",
interceptor: interceptor
},
deleteSpare: {
method: "DELETE",
url: "/telephony/spare/:spare",
interceptor: interceptor
},
getBrands: {
method: "GET",
url: "/telephony/spare/brands",
},
getNewSpare: {
method: "GET",
url: "/order/telephony/spare/new",
},
orderNewSpare: {
method: "POST",
url: "/order/telephony/spare/new",
},
});

spareResource.resetAllCache = function () {
cache.removeAll();
queryCache.removeAll();
};

return spareResource;
});
15 changes: 15 additions & 0 deletions src/api/xdsl/spare/xdsl-spare.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
angular.module("ovh-api-services").service("OvhApiXdslSpare", function ($injector, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiXdslSpare");

return {
v6: function () {
return $injector.get("OvhApiXdslSpareV6");
},
resetCache: function () {
cache.removeAll();
},
cache: cache
};
});
66 changes: 66 additions & 0 deletions src/api/xdsl/spare/xdsl-spare.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
angular.module("ovh-api-services").service("OvhApiXdslSpareV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiXdslSpareV6");
var queryCache = $cacheFactory("OvhApiXdslSpareV6Query");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.resource;
}
};

var spareResource = $resource("/xdsl/spare", {
spare: "@spare"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: cache
},
getSpare: {
method: "GET",
url: "/xdsl/spare/:spare"
},
replaceSpare: {
method: "POST",
url: "/xdsl/spare/:spare/replace",
interceptor: interceptor
},
returnMerchandise: {
method: "POST",
url: "xdsl/spare/:spare/returnMerchandise",
interceptor: interceptor
},
deleteSpare: {
method: "DELETE",
url: "/xdsl/spare/:spare",
interceptor: interceptor
},
getBrands: {
method: "GET",
url: "/xdsl/spare/brands",
},
getNewSpare: {
method: "GET",
url: "/order/xdsl/spare/new",
},
orderNewSpare: {
method: "POST",
url: "/order/xdsl/spare/new",
},
});

spareResource.resetAllCache = function () {
cache.removeAll();
queryCache.removeAll();
};

return spareResource;
});

0 comments on commit 101d8e3

Please sign in to comment.