import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { firstValueFrom } from 'rxjs' ; import { ICandidateInterviewFindInput , ICandidateInterviewCreateInput , ICandidateInterview } from '@gauzy/contracts' ; import { API_PREFIX } from '../constants/app.constants' ; @ Injectable ( { providedIn : 'root' } ) export class CandidateInterviewService { constructor ( private http ) { } create ( createInput ) { return firstValueFrom ( this . http . post < ICandidateInterview > ( `${ API_PREFIX }/candidate-interview` , createInput ) ) ; } getAll ( relations , findInput ? ) { const data = JSON . stringify ( { relations , findInput } ) ; return firstValueFrom ( this . http . get < { items : ICandidateInterview [ ] ; total : number ; } > ( `${ API_PREFIX }/candidate-interview` , { params : { data } } ) ) ; } findById ( id , relations ? ) { const data = JSON . stringify ( { relations } ) ; return firstValueFrom ( this . http . get < ICandidateInterview > ( `${ API_PREFIX }/candidate-interview/${ id }` , { params : { data } } ) ) ; } findByCandidateId ( candidateId ) { return firstValueFrom ( this . http . get < ICandidateInterview [ ] > ( `${ API_PREFIX }/candidate-interview/candidate/${ candidateId }` ) ) ; } update ( id , updateInput ) { return firstValueFrom ( this . http . put ( `${ API_PREFIX }/candidate-interview/${ id }` , updateInput ) ) ; } setInterviewAsArchived ( id ) { return firstValueFrom ( this . http . put < ICandidateInterview > ( `${ API_PREFIX }/candidate-interview/${ id }` , { isArchived : true } ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ API_PREFIX }/candidate-interview/${ id }` ) ) ; } }