74 lines
1.5 KiB
TypeScript
74 lines
1.5 KiB
TypeScript
import request from "@/utils/request";
|
|
|
|
export interface School {
|
|
id: number;
|
|
tenantId: number;
|
|
address?: string;
|
|
phone?: string;
|
|
principal?: string;
|
|
established?: string;
|
|
description?: string;
|
|
logo?: string;
|
|
website?: string;
|
|
creator?: number;
|
|
modifier?: number;
|
|
createTime?: string;
|
|
modifyTime?: string;
|
|
tenant?: {
|
|
id: number;
|
|
name: string;
|
|
code: string;
|
|
};
|
|
}
|
|
|
|
export interface CreateSchoolForm {
|
|
address?: string;
|
|
phone?: string;
|
|
principal?: string;
|
|
established?: string;
|
|
description?: string;
|
|
logo?: string;
|
|
website?: string;
|
|
}
|
|
|
|
export interface UpdateSchoolForm {
|
|
address?: string;
|
|
phone?: string;
|
|
principal?: string;
|
|
established?: string;
|
|
description?: string;
|
|
logo?: string;
|
|
website?: string;
|
|
}
|
|
|
|
// 获取学校信息
|
|
export async function getSchool(): Promise<School> {
|
|
const response = await request.get<any, School>("/schools");
|
|
return response;
|
|
}
|
|
|
|
// 创建学校信息
|
|
export async function createSchool(data: CreateSchoolForm): Promise<School> {
|
|
const response = await request.post<any, School>("/schools", data);
|
|
return response;
|
|
}
|
|
|
|
// 更新学校信息
|
|
export async function updateSchool(data: UpdateSchoolForm): Promise<School> {
|
|
const response = await request.patch<any, School>("/schools", data);
|
|
return response;
|
|
}
|
|
|
|
// 删除学校信息
|
|
export async function deleteSchool(): Promise<void> {
|
|
return await request.delete<any, void>("/schools");
|
|
}
|
|
|
|
export const schoolsApi = {
|
|
get: getSchool,
|
|
create: createSchool,
|
|
update: updateSchool,
|
|
delete: deleteSchool,
|
|
};
|
|
|