doctor and pharmacies crud
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import type { DoctorListRes } from "@/features/doctors/lib/data";
|
||||
import type {
|
||||
CreateDoctorReq,
|
||||
DoctorListRes,
|
||||
UpdateDoctorReq,
|
||||
} from "@/features/doctors/lib/data";
|
||||
import httpClient from "@/shared/config/api/httpClient";
|
||||
import { DOCTOR } from "@/shared/config/api/URLs";
|
||||
import type { AxiosResponse } from "axios";
|
||||
@@ -17,4 +21,19 @@ export const doctor_api = {
|
||||
const res = await httpClient.get(`${DOCTOR}list/`, { params });
|
||||
return res;
|
||||
},
|
||||
|
||||
async create(body: CreateDoctorReq) {
|
||||
const res = await httpClient.post(`${DOCTOR}create/`, body);
|
||||
return res;
|
||||
},
|
||||
|
||||
async update({ body, id }: { id: number; body: UpdateDoctorReq }) {
|
||||
const res = await httpClient.patch(`${DOCTOR}${id}/update/`, body);
|
||||
return res;
|
||||
},
|
||||
|
||||
async delete(id: number) {
|
||||
const res = await httpClient.delete(`${DOCTOR}${id}/delete/`);
|
||||
return res;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -92,3 +92,32 @@ export interface DoctorListResData {
|
||||
};
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface CreateDoctorReq {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
phone_number: string;
|
||||
work_place: string;
|
||||
sphere: string;
|
||||
description: string;
|
||||
district_id: number;
|
||||
place_id: number;
|
||||
user_id: number;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
extra_location: {
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
};
|
||||
}
|
||||
export interface UpdateDoctorReq {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
phone_number: string;
|
||||
work_place: string;
|
||||
sphere: string;
|
||||
description: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
extra_location: { longitude: number; latitude: number };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user