first commit
This commit is contained in:
25
resources/frontend/core/services/resource/about.service.js
Normal file
25
resources/frontend/core/services/resource/about.service.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import axios from 'axios';
|
||||
|
||||
export default class AboutService {
|
||||
async getGeneralInfo() {
|
||||
const result = await axios.get('about');
|
||||
|
||||
return result.data;
|
||||
}
|
||||
|
||||
async getStorageInfo() {
|
||||
const result = await axios.get('about/storage');
|
||||
|
||||
return result.data.data;
|
||||
}
|
||||
|
||||
startCleanup() {
|
||||
return axios.post('about/storage');
|
||||
}
|
||||
|
||||
async getReportTypes() {
|
||||
const result = await axios.get('about/reports');
|
||||
|
||||
return result.data.data.types;
|
||||
}
|
||||
}
|
||||
24
resources/frontend/core/services/resource/gantt.service.js
Normal file
24
resources/frontend/core/services/resource/gantt.service.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import axios from 'axios';
|
||||
import ResourceService from '@/services/resource.service';
|
||||
|
||||
export default class GanttService extends ResourceService {
|
||||
getGanttData(projectId) {
|
||||
return axios.get(`projects/gantt-data?id=${projectId}`);
|
||||
}
|
||||
getPhases(projectId) {
|
||||
return axios.get(`projects/phases?id=${projectId}`);
|
||||
}
|
||||
createRelation(taskId, relation) {
|
||||
return axios.post(`tasks/create-relation`, {
|
||||
task_id: taskId,
|
||||
related_task_id: relation.taskId,
|
||||
relation_type: relation.type,
|
||||
});
|
||||
}
|
||||
removeRelation({ parent_id, child_id }) {
|
||||
return axios.post(`tasks/remove-relation`, {
|
||||
parent_id,
|
||||
child_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
import { serialize } from '@/utils/url';
|
||||
|
||||
export default class PriorityService extends ResourceService {
|
||||
/**
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getAll(config = {}) {
|
||||
return (await axios.get('priorities/list', config)).data.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns string
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `priorities/show?${serialize({ id })}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getItem(id) {
|
||||
return axios.get(this.getItemRequestUri(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param isNew
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
save(data, isNew = false) {
|
||||
return axios.post(`priorities/${isNew ? 'create' : 'edit'}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('priorities/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
getOptionLabelKey() {
|
||||
return 'name';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filters
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getWithFilters(filters, config = {}) {
|
||||
return (await axios.post('priorities/list', filters, config)).data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
import { serialize } from '@/utils/url';
|
||||
|
||||
export default class ProjectGroupsService extends ResourceService {
|
||||
/**
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getAll(config = {}) {
|
||||
return (await axios.get('project-groups/list', config)).data.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns string
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `project-groups/show?${serialize({ id })}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getItem(id) {
|
||||
return axios.get(this.getItemRequestUri(id) + '&' + serialize({ with: ['groupParent'] }));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param isNew
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
save(data, isNew = false) {
|
||||
return axios.post(`project-groups/${isNew ? 'create' : 'edit'}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('project-groups/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
getOptionLabelKey() {
|
||||
return 'name';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filters
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getWithFilters(filters, config = {}) {
|
||||
return (await axios.post('project-groups/list', filters, config)).data;
|
||||
}
|
||||
}
|
||||
82
resources/frontend/core/services/resource/project.service.js
Normal file
82
resources/frontend/core/services/resource/project.service.js
Normal file
@@ -0,0 +1,82 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
import { serialize } from '@/utils/url';
|
||||
|
||||
export default class ProjectService extends ResourceService {
|
||||
constructor(params = {}) {
|
||||
super();
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {string}
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `projects/show?id=${id}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param filters
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getItem(id, filters = {}) {
|
||||
return axios.get(this.getItemRequestUri(id) + '&' + serialize(filters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getAll(config = {}) {
|
||||
return (
|
||||
await axios.get('projects/list', {
|
||||
...config,
|
||||
params: this.params,
|
||||
})
|
||||
).data.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('projects/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filters
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getWithFilters(filters, config = {}) {
|
||||
return axios.post('projects/list', filters, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param isNew
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
save(data, isNew = false) {
|
||||
return axios.post(`projects/${isNew ? 'create' : 'edit'}`, data);
|
||||
}
|
||||
|
||||
getMembers(id) {
|
||||
return axios.post('project-members/list', { project_id: id });
|
||||
}
|
||||
|
||||
bulkEditMembers(data) {
|
||||
return axios.post('project-members/bulk-edit', data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
getOptionLabelKey() {
|
||||
return 'name';
|
||||
}
|
||||
}
|
||||
11
resources/frontend/core/services/resource/role.service.js
Normal file
11
resources/frontend/core/services/resource/role.service.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
|
||||
export default class RoleService extends ResourceService {
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getAll() {
|
||||
return axios.get('roles/list');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
|
||||
export default class ScreenshotService extends ResourceService {
|
||||
/**
|
||||
* @param id
|
||||
* @returns string
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `screenshots/show?id=${id}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getItem(id) {
|
||||
return axios.get(this.getItemRequestUri(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getAll() {
|
||||
return axios.get('screenshots/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filters
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getWithFilters(filters, config = {}) {
|
||||
return axios.post('screenshots/list', filters, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('screenshots/remove', { id });
|
||||
}
|
||||
}
|
||||
74
resources/frontend/core/services/resource/status.service.js
Normal file
74
resources/frontend/core/services/resource/status.service.js
Normal file
@@ -0,0 +1,74 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
import { serialize } from '@/utils/url';
|
||||
|
||||
export default class StatusService extends ResourceService {
|
||||
/**
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getAll(config = {}) {
|
||||
return (await axios.get('statuses/list', config)).data.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns string
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `statuses/show?${serialize({ id })}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getItem(id) {
|
||||
return axios.get(this.getItemRequestUri(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param isNew
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
save(data, isNew = false) {
|
||||
return axios.post(`statuses/${isNew ? 'create' : 'edit'}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('statuses/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
getOptionLabelKey() {
|
||||
return 'name';
|
||||
}
|
||||
|
||||
getOptionList() {
|
||||
// TODO: this probably will throw :(
|
||||
return this.getAll().then(({ data }) =>
|
||||
data.data.map(option => ({
|
||||
value: option.id,
|
||||
label: option[this.getOptionLabelKey()],
|
||||
active: option.active,
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filters
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getWithFilters(filters, config = {}) {
|
||||
return axios.post('statuses/list', filters, config);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
|
||||
export default class TaskActivityService extends ResourceService {
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteComment(id) {
|
||||
return axios.post('task-comment/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
*/
|
||||
saveComment(data) {
|
||||
return axios.post('task-comment/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
*/
|
||||
editComment(data) {
|
||||
return axios.post('task-comment/edit', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
*/
|
||||
getActivity(data) {
|
||||
return axios.post('tasks/activity', data);
|
||||
}
|
||||
}
|
||||
96
resources/frontend/core/services/resource/task.service.js
Normal file
96
resources/frontend/core/services/resource/task.service.js
Normal file
@@ -0,0 +1,96 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
import { serialize } from '@/utils/url';
|
||||
|
||||
export default class TasksService extends ResourceService {
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getAll() {
|
||||
return axios.get('tasks/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param id
|
||||
* @param filters
|
||||
*/
|
||||
getItem(id, filters = {}) {
|
||||
return axios.get(this.getItemRequestUri(id) + '&' + serialize(filters));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param id
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `tasks/show?${serialize({ id })}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userID
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getDashboardTasks(userID) {
|
||||
return axios.get(`tasks/dashboard?${serialize({ user_id: userID, with: ['project'] })}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param filters
|
||||
* @param config
|
||||
*/
|
||||
getWithFilters(filters, config = {}) {
|
||||
return axios.post('tasks/list', filters, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param id
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('tasks/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
* @param isNew
|
||||
*/
|
||||
save(data, isNew = false) {
|
||||
return axios.post(`tasks/${isNew ? 'create' : 'edit'}`, data);
|
||||
}
|
||||
|
||||
getOptionLabelKey() {
|
||||
return 'task_name';
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload attachment
|
||||
* @returns {Promise<void>}
|
||||
* @param payload
|
||||
* @param progressCallback
|
||||
*/
|
||||
async uploadAttachment(payload, progressCallback) {
|
||||
const formData = new FormData();
|
||||
formData.append('attachment', payload);
|
||||
|
||||
const { data } = await axios.post('/attachment', formData, {
|
||||
onUploadProgress: progressCallback,
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate tmp url for attachment
|
||||
* @returns {Promise<void>}
|
||||
* @param uuid
|
||||
* @param seconds
|
||||
*/
|
||||
async generateAttachmentTmpUrl(uuid, seconds = null) {
|
||||
const { data } = await axios.get(
|
||||
`/attachment/${uuid}/temporary-url?${typeof seconds === 'number' ? serialize({ seconds }) : ''}`,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
|
||||
export default class TimeIntervalService extends ResourceService {
|
||||
/**
|
||||
* @returns {string}
|
||||
* @param id
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `time-intervals/show?id=${id}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param id
|
||||
*/
|
||||
getItem(id) {
|
||||
return axios.get(this.getItemRequestUri(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param filters
|
||||
*/
|
||||
getAll(filters = {}) {
|
||||
return axios.post('time-intervals/list', filters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
*/
|
||||
save(data) {
|
||||
return axios.post('time-intervals/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
*/
|
||||
bulkEdit(data) {
|
||||
return axios.post('time-intervals/bulk-edit', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
* @param data
|
||||
*/
|
||||
bulkDelete(data) {
|
||||
return axios.post('time-intervals/bulk-remove', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('time-intervals/remove', { id });
|
||||
}
|
||||
}
|
||||
63
resources/frontend/core/services/resource/user.service.js
Normal file
63
resources/frontend/core/services/resource/user.service.js
Normal file
@@ -0,0 +1,63 @@
|
||||
import ResourceService from '@/services/resource.service';
|
||||
import axios from 'axios';
|
||||
import { serialize } from '@/utils/url';
|
||||
|
||||
export default class UsersService extends ResourceService {
|
||||
/**
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
async getAll(config = {}) {
|
||||
return (await axios.get('users/list', config)).data.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns string
|
||||
*/
|
||||
getItemRequestUri(id) {
|
||||
return `users/show?${serialize({ id, with: ['role', 'projectsRelation.role'] })}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getItem(id) {
|
||||
return axios.get(this.getItemRequestUri(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param data
|
||||
* @param isNew
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
save(data, isNew = false) {
|
||||
return axios.post(`users/${isNew ? 'create' : 'edit'}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
deleteItem(id) {
|
||||
return axios.post('users/remove', { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
getOptionLabelKey() {
|
||||
return 'full_name';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filters
|
||||
* @param config
|
||||
* @returns {Promise<AxiosResponse<T>>}
|
||||
*/
|
||||
getWithFilters(filters, config = {}) {
|
||||
return axios.post('users/list', filters, config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user