2020-06-11 17:27:21 +00:00
|
|
|
import AbstractService from './abstractService'
|
2022-11-13 21:04:57 +00:00
|
|
|
import ProjectModel from '@/models/project'
|
2022-09-06 09:36:01 +00:00
|
|
|
|
2022-11-13 21:04:57 +00:00
|
|
|
import type { IProject } from '@/modelTypes/IProject'
|
2022-09-06 09:36:01 +00:00
|
|
|
import type { IFile } from '@/modelTypes/IFile'
|
2020-06-11 17:27:21 +00:00
|
|
|
|
|
|
|
export default class BackgroundUploadService extends AbstractService {
|
|
|
|
constructor() {
|
|
|
|
super({
|
2022-11-13 21:04:57 +00:00
|
|
|
create: '/projects/{projectId}/backgrounds/upload',
|
2020-06-11 17:27:21 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
useCreateInterceptor() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-11-13 21:04:57 +00:00
|
|
|
modelCreateFactory(data: Partial<IProject>) {
|
|
|
|
return new ProjectModel(data)
|
2020-06-11 17:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Uploads a file to the server
|
|
|
|
*/
|
2022-11-13 21:04:57 +00:00
|
|
|
create(projectId: IProject['id'], file: IFile) {
|
2020-08-02 17:17:29 +00:00
|
|
|
return this.uploadFile(
|
2022-11-13 21:04:57 +00:00
|
|
|
this.getReplacedRoute(this.paths.create, {projectId}),
|
2020-08-02 17:17:29 +00:00
|
|
|
file,
|
2020-09-05 20:35:52 +00:00
|
|
|
'background',
|
2020-06-11 17:27:21 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|