Migrate new service (#1)
This commit is contained in:
1 parent
f13ca37d63
commit
28da0263dc
109 files changed
+1160
-1053
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { httpClient } from './common';
|
||||
import { IApplication, IApplicationDetailResponse, IApplicationListResponse, IApplicationType } from '@/models';
|
||||
|
||||
export interface IApplicationQuery {
|
||||
user_id?: string;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
type?: IApplicationType;
|
||||
service_id?: string;
|
||||
ordering?: string;
|
||||
}
|
||||
|
||||
class ApplicationOperator {
|
||||
key = 'applications';
|
||||
|
||||
async getAll(query: IApplicationQuery): Promise<AxiosResponse<IApplicationListResponse>> {
|
||||
return await httpClient.get(`/${this.key}/`, {
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
async get(id: string): Promise<AxiosResponse<IApplicationDetailResponse>> {
|
||||
return await httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
async create(data: IApplication): Promise<AxiosResponse<IApplicationDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: IApplication): Promise<AxiosResponse<IApplicationDetailResponse>> {
|
||||
return await httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<AxiosResponse<null>> {
|
||||
return await httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const applicationOperator = new ApplicationOperator();
|
||||
Reference in new issue
Block a user