unclean SPARC
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
class SupportModel extends EICModel {
|
||||
|
||||
constructor(privileges) {
|
||||
super('/zammad/tickets', privileges);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
list(filters) {
|
||||
//if(!this.hasPrivilege('list')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('list');
|
||||
return (
|
||||
this.request(endpoint.uri, endpoint.method, filters)
|
||||
.then( async serverData => {
|
||||
return serverData.payload;
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
get(id) {
|
||||
// if(!this.hasPrivilege('list')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('get');
|
||||
endpoint.uri = endpoint.uri.replace('{id}', id);
|
||||
|
||||
return (
|
||||
this.request(endpoint.uri, endpoint.method)
|
||||
.then( async serverData => {
|
||||
return serverData.payload;
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
create(ticket) {
|
||||
//if(!this.hasPrivilege('create')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('create');
|
||||
|
||||
return (
|
||||
this.request(endpoint.uri, endpoint.method, ticket)
|
||||
.then( async serverData => {
|
||||
return serverData.payload;
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
update(id, content) {
|
||||
//if(!this.hasPrivilege('list')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('update');
|
||||
endpoint.uri = endpoint.uri.replace('{id}', id);
|
||||
|
||||
return (
|
||||
this.request(endpoint.uri, endpoint.method, content)
|
||||
.then( async serverData => {
|
||||
return serverData.payload;
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
download(ticketId, articleId, attachmentId) {
|
||||
// if(!this.hasPrivilege('list')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('download');
|
||||
endpoint.uri = endpoint.uri.replace('{ticid}', ticketId);
|
||||
endpoint.uri = endpoint.uri.replace('{artid}', articleId);
|
||||
endpoint.uri = endpoint.uri.replace('{attid}', attachmentId);
|
||||
|
||||
window.open(endpoint.uri, '_blank');
|
||||
}
|
||||
}
|
||||
app.registerClass('SupportModel', SupportModel);
|
||||
Reference in New Issue
Block a user