mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
edit event to aprove done
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AgendaDataService } from './agenda-data.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { ListEventMapper } from './mapper/EventListMapper';
|
||||
import { EventMapper } from './mapper/EventDetailsMapper';
|
||||
import { Utils } from './utils';
|
||||
import { EventInputDTO } from './agendaDataModels';
|
||||
import { Event } from 'src/app/models/event.model';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
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'
|
||||
@@ -18,26 +23,52 @@ 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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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(
|
||||
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 = ''}) {
|
||||
|
||||
return this.agendaDataService.getEvents(userId, startDate = null, endDate = null, status, category= null, type= null).pipe(
|
||||
map((response) => {
|
||||
return ListEventMapper.toDomain(response.data, calendarOwnerName, userId)
|
||||
return EventListToApproveMapper.toDomain(response.data, calendarOwnerName, userId)
|
||||
}
|
||||
))
|
||||
}
|
||||
@@ -68,13 +99,13 @@ export class AgendaDataRepositoryService {
|
||||
return this.agendaDataService.createEvent(eventInput)
|
||||
}
|
||||
|
||||
updateEvent(eventId, eventData: Event, CalendarName, documents) {
|
||||
updateEvent(eventId, eventData) {
|
||||
console.log(eventData.StartDate)
|
||||
console.log(eventData.EndDate)
|
||||
|
||||
let eventInput = {
|
||||
subject: eventData.Subject,
|
||||
body: eventData.Body.Text,
|
||||
body: eventData.Body.Text || eventData.Body,
|
||||
location: eventData.Location,
|
||||
startDate: eventData.StartDate,
|
||||
endDate: eventData.EndDate,
|
||||
@@ -103,4 +134,19 @@ export class AgendaDataRepositoryService {
|
||||
removeEventAttachment(eventId,attachmentData) {
|
||||
return this.agendaDataService.removeEventAttachment(eventId,attachmentData);
|
||||
}
|
||||
|
||||
async deleteEvent1(eventId) {
|
||||
|
||||
try {
|
||||
const result = await this.agendaDataService.deleteEvent(eventId,false).toPromise()
|
||||
return ok (result)
|
||||
} catch (e) {
|
||||
return err(e as HttpErrorResponse)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
eventToaprovalStatus(eventId, status) {
|
||||
return this.agendaDataService.updateEventStatus(eventId,this.utils.statusEventAproval(status))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user