list events

This commit is contained in:
Peter Maquiran
2024-05-29 15:45:34 +01:00
parent caa11d6be7
commit 38d36a6e49
22 changed files with 629 additions and 198 deletions
@@ -0,0 +1,44 @@
import { Injectable } from '@angular/core';
import { AgendaDataService } from './agenda-data.service';
import { map } from 'rxjs/operators';
import { ListEventMapper } from './mapper/EventListMapper';
import { EventMapper } from './mapper/EventDetailsMapper';
@Injectable({
providedIn: 'root'
})
export class AgendaDataRepositoryService {
constructor(
private agendaDataService: AgendaDataService
) {}
createEvent(eventData: any) {
return this.agendaDataService.createEvent(eventData).pipe(map(EventMapper.toDomain))
}
getEventById(id: string) {
return this.agendaDataService.getEvent(id).pipe(
map((response) => {
return EventMapper.toDomain(response.data)
})
)
}
EventList({userId = null, startDate = null, endDate = null, status= 2, category= null, type= null, calendarOwnerName = ''}) {
return this.agendaDataService.getEvents(userId, startDate, endDate, status, category, type).pipe(
map((response) => {
return ListEventMapper.toDomain(response.data, calendarOwnerName, userId)
}
))
}
eventToApprove({userId, startDate = null, endDate = null, status = 0, category= null, type= null, calendarOwnerName = ''}) {
return this.agendaDataService.getEvents(userId, startDate = null, endDate = null, status, category= null, type= null).pipe(
map((response) => {
return ListEventMapper.toDomain(response.data, calendarOwnerName, userId)
}
))
}
}