67 lines
2.1 KiB
TypeScript

import { RestService, Rest } from '@abp/ng.core';
import { Injectable } from '@angular/core';
import type { PagedResultDto } from '../abp/application/services/dto/models';
import type { AppointmentDto, CreateOrUpdateAppointmentDto } from '../appoinments/dto/models';
import type { PagingSortResultDto } from '../dto/models';
@Injectable({
providedIn: 'root',
})
export class AppointmentService {
apiName = 'Default';
createAppointment = (input: CreateOrUpdateAppointmentDto, config?: Partial<Rest.Config>) =>
this.restService.request<any, AppointmentDto>({
method: 'POST',
url: '/api/app/appointment/appointment',
body: input,
},
{ apiName: this.apiName,...config });
deleteAppointmentRecord = (id: string, config?: Partial<Rest.Config>) =>
this.restService.request<any, void>({
method: 'DELETE',
url: `/api/app/appointment/${id}/appointment-record`,
},
{ apiName: this.apiName,...config });
get = (config?: Partial<Rest.Config>) =>
this.restService.request<any, string>({
method: 'GET',
responseType: 'text',
url: '/api/app/appointment',
},
{ apiName: this.apiName,...config });
getAppointmentById = (id: string, config?: Partial<Rest.Config>) =>
this.restService.request<any, AppointmentDto>({
method: 'GET',
url: `/api/app/appointment/${id}/appointment-by-id`,
},
{ apiName: this.apiName,...config });
getAppointmentList = (input: PagingSortResultDto, config?: Partial<Rest.Config>) =>
this.restService.request<any, PagedResultDto<AppointmentDto>>({
method: 'GET',
url: '/api/app/appointment/appointment-list',
params: { search: input.search, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount },
},
{ apiName: this.apiName,...config });
updateAppointment = (input: CreateOrUpdateAppointmentDto, config?: Partial<Rest.Config>) =>
this.restService.request<any, AppointmentDto>({
method: 'PUT',
url: '/api/app/appointment/appointment',
body: input,
},
{ apiName: this.apiName,...config });
constructor(private restService: RestService) {}
}