This commit is contained in:
archer
2023-07-04 15:39:57 +08:00
parent 9bdd5f522d
commit 6e1ef89d65
44 changed files with 213 additions and 1216 deletions

View File

@@ -1,44 +1,44 @@
import { GET, POST, DELETE, PUT } from './request';
import type { AppSchema } from '@/types/mongoSchema';
import type { ModelUpdateParams } from '@/types/model';
import type { AppUpdateParams } from '@/types/app';
import { RequestPaging } from '../types/index';
import type { ModelListResponse } from './response/model';
import type { AppListResponse } from './response/app';
/**
* 获取模型列表
*/
export const getMyModels = () => GET<ModelListResponse>('/model/list');
export const getMyModels = () => GET<AppListResponse>('/app/list');
/**
* 创建一个模型
*/
export const postCreateModel = (data: { name: string }) => POST<string>('/model/create', data);
export const postCreateModel = (data: { name: string }) => POST<string>('/app/create', data);
/**
* 根据 ID 删除模型
*/
export const delModelById = (id: string) => DELETE(`/model/del?modelId=${id}`);
export const delModelById = (id: string) => DELETE(`/app/del?modelId=${id}`);
/**
* 根据 ID 获取模型
*/
export const getModelById = (id: string) => GET<AppSchema>(`/model/detail?modelId=${id}`);
export const getModelById = (id: string) => GET<AppSchema>(`/app/detail?modelId=${id}`);
/**
* 根据 ID 更新模型
*/
export const putAppById = (id: string, data: ModelUpdateParams) =>
PUT(`/model/update?appId=${id}`, data);
export const putAppById = (id: string, data: AppUpdateParams) =>
PUT(`/app/update?appId=${id}`, data);
/* 共享市场 */
/**
* 获取共享市场模型
*/
export const getShareModelList = (data: { searchText?: string } & RequestPaging) =>
POST(`/model/share/getModels`, data);
POST(`/app/share/getModels`, data);
/**
* 收藏/取消收藏模型
*/
export const triggerModelCollection = (modelId: string) =>
POST<number>(`/model/share/collection?modelId=${modelId}`);
POST<number>(`/app/share/collection?modelId=${modelId}`);