add endpoint to get sharedCalendar

This commit is contained in:
Peter Maquiran
2024-06-06 10:26:34 +01:00
parent b041ae73f5
commit 74a365b3cf
9 changed files with 169 additions and 38 deletions
@@ -1,8 +1,11 @@
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { EventOutputDTO } from './model/eventDTOOutput';
import { EventInputDTO } from './model/eventInputDTO';
import { SessionStore } from 'src/app/store/session.service';
import { SharedCalendarListOutputDTO, SharedCalendarListOutputDTOSchema } from './model/sharedCalendarOutputDTO';
import { HttpService } from '../../http.service';
import { APIReturn } from '../../decorator/api-validate-schema.decorator';
@Injectable({
providedIn: 'root'
@@ -11,7 +14,10 @@ import { EventInputDTO } from './model/eventInputDTO';
export class AgendaDataService {
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
constructor(private http: HttpClient) { }
constructor(
private http: HttpClient,
private httpService: HttpService
) { }
getContacts(value: string): Observable<any> {
const params = new HttpParams().set('value', value);
@@ -115,4 +121,10 @@ export class AgendaDataService {
.set('PageSize', PageSize);
return this.http.get<any>(`${this.baseUrl}/Documents/Attachments${aplicationId}`, {params});
}
@APIReturn(SharedCalendarListOutputDTOSchema)
async getSharedCalendar() {
return await this.httpService.get<SharedCalendarListOutputDTO>(`${this.baseUrl}/Users/id/ShareCalendar?id=${SessionStore.user.UserId}`);
}
}