doctor and pharmacies crud

This commit is contained in:
Samandar Turgunboyev
2025-11-29 19:19:40 +05:00
parent bcf9d7cd2b
commit 9bc4c3df1f
45 changed files with 3610 additions and 1469 deletions

View File

@@ -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;
},
};

View File

@@ -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 };
}