mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
add either pattern
This commit is contained in:
@@ -11,6 +11,7 @@ import { EventListToApproveMapper } from './mapper/eventToApproveListMapper';
|
||||
import { err, ok } from 'neverthrow';
|
||||
import { of } from 'rxjs';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { EventToApproveDetailsMapper } from './mapper/EventToApproveDetailsMapper';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -22,20 +23,45 @@ export class AgendaDataRepositoryService {
|
||||
private utils: Utils
|
||||
) { }
|
||||
|
||||
getEventById(id: string) {
|
||||
return this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
return EventMapper.toDomain(response.data)
|
||||
})
|
||||
)
|
||||
async getEventById(id: string) {
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
return EventMapper.toDomain(response.data)
|
||||
})
|
||||
).toPromise()
|
||||
return ok (result)
|
||||
} catch (e) {
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
))
|
||||
async getEventToApproveById(id: string) {
|
||||
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||
map((response) => {
|
||||
return EventToApproveDetailsMapper.toDomain(response.data)
|
||||
})
|
||||
).toPromise()
|
||||
return ok (result)
|
||||
} catch (e) {
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async EventList({userId = null, startDate = null, endDate = null, status= 2, category= null, type= null, calendarOwnerName = ''}) {
|
||||
try {
|
||||
const result = await this.agendaDataService.getEvents(userId, startDate, endDate, status, category, type).pipe(
|
||||
map((response) => {
|
||||
return ListEventMapper.toDomain(response.data, calendarOwnerName, userId)
|
||||
}
|
||||
)).toPromise()
|
||||
return ok (result)
|
||||
} catch (e) {
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
}
|
||||
|
||||
eventToApproveList({userId, startDate = null, endDate = null, status = 0, category= null, type= null, calendarOwnerName = ''}) {
|
||||
|
||||
Reference in New Issue
Block a user