import { HttpClient } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { IEventType , IEventTypeFindInput , IEventTypeCreateInput , IEventTypeUpdateInput } from '@gauzy/contracts' ; import { firstValueFrom } from 'rxjs' ; import { API_PREFIX } from '../constants/app.constants' ; @ Injectable ( ) export class EventTypeService { EVENT_TYPE_BASE_URI = `${ API_PREFIX }/event-type` ; constructor ( private http ) { } create ( createInput ) { return firstValueFrom ( this . http . post < IEventType > ( this . EVENT_TYPE_BASE_URI , createInput ) ) ; } getEventTypeById ( id , relations ? ) { const data = JSON . stringify ( { relations } ) ; return firstValueFrom ( this . http . get < IEventType > ( `${ this . EVENT_TYPE_BASE_URI }/${ id }` , { params : { data } } ) ) ; } getAll ( relations ? , findInput ? ) { const data = JSON . stringify ( { relations , findInput } ) ; return firstValueFrom ( this . http . get < { items : IEventType [ ] ; total : number ; } > ( this . EVENT_TYPE_BASE_URI , { params : { data } } ) ) ; } update ( id , updateInput ) { return firstValueFrom ( this . http . put ( `${ this . EVENT_TYPE_BASE_URI }/${ id }` , updateInput ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ this . EVENT_TYPE_BASE_URI }/${ id }` ) ) ; } }