58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
/**
|
|
*
|
|
*/
|
|
class ICMPProjectModel extends EICModel {
|
|
|
|
current = null;
|
|
|
|
constructor(privileges) { super('/icmp', privileges); }
|
|
|
|
get(number) {
|
|
if(!this.hasPrivilege('read')) return( new Promise((resolve, reject) => reject()))
|
|
|
|
this.current = null;
|
|
|
|
let endpoint = this.getApiEndpoint('getProject');
|
|
endpoint.uri = endpoint.uri.replace('{projectId}', number);
|
|
|
|
return (
|
|
this.request(endpoint.uri, endpoint.method)
|
|
.then( async serverData => {
|
|
this.current = this.sanitize(serverData.payload);
|
|
return this.current;
|
|
})
|
|
)
|
|
}
|
|
|
|
sanitize(data) { return data; }
|
|
|
|
documents(number) {
|
|
if(!this.hasPrivilege('read')) return( new Promise((resolve, reject) => reject()))
|
|
|
|
let endpoint = this.getApiEndpoint('getProjectDocuments');
|
|
endpoint.uri = endpoint.uri.replace('{projectId}', number);
|
|
|
|
return (
|
|
this.request(endpoint.uri, endpoint.method)
|
|
.then( async serverData => {
|
|
return serverData.payload;
|
|
})
|
|
)
|
|
}
|
|
|
|
contributors(number) {
|
|
if(!this.hasPrivilege('read')) return( new Promise((resolve, reject) => reject()))
|
|
|
|
let endpoint = this.getApiEndpoint('getProjectContributors');
|
|
endpoint.uri = endpoint.uri.replace('{projectId}', number);
|
|
|
|
return (
|
|
this.request(endpoint.uri, endpoint.method)
|
|
.then( async serverData => {
|
|
return serverData.payload;
|
|
})
|
|
)
|
|
}
|
|
}
|
|
|
|
app.registerClass('ICMPProjectModel', ICMPProjectModel); |