mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
edit and delete
This commit is contained in:
@@ -3,7 +3,7 @@ import { AgendaDataService } from './agenda-data.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ListEventMapper } from './mapper/EventListMapper';
|
||||
import { EventMapper } from './mapper/EventDetailsMapper';
|
||||
import { Utils } from './utils';
|
||||
import { Utils } from './utils';
|
||||
import { EventInputDTO } from './agendaDataModels';
|
||||
import { Event } from 'src/app/models/event.model';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
@@ -26,27 +26,27 @@ export class AgendaDataRepositoryService {
|
||||
)
|
||||
}
|
||||
|
||||
EventList({userId = null, startDate = null, endDate = null, status= 2, category= null, type= null, calendarOwnerName = ''}) {
|
||||
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(
|
||||
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)
|
||||
}
|
||||
))
|
||||
))
|
||||
}
|
||||
|
||||
createEvent(eventData: Event,CalendarName,documents) {
|
||||
createEvent(eventData: Event, CalendarName, documents) {
|
||||
console.log(eventData)
|
||||
|
||||
let eventInput = {
|
||||
userId: this.utils.selectedCalendarUserId(CalendarName,eventData) as any,
|
||||
userId: this.utils.selectedCalendarUserId(CalendarName, eventData) as any,
|
||||
ownerType: this.utils.selectedCalendarOwner(CalendarName),
|
||||
subject: eventData.Subject,
|
||||
body: eventData.Body.Text,
|
||||
@@ -65,48 +65,42 @@ export class AgendaDataRepositoryService {
|
||||
isAllDayEvent: eventData.IsAllDayEvent,
|
||||
}
|
||||
|
||||
this.agendaDataService.createEvent(eventInput).subscribe((value) => {
|
||||
console.log(value)
|
||||
},((error) => {
|
||||
console.log('create event',error)
|
||||
}));
|
||||
return this.agendaDataService.createEvent(eventInput)
|
||||
}
|
||||
|
||||
updateEvent(eventId,eventData: Event,CalendarName,documents) {
|
||||
console.log(this.utils.editeEventCalendarUserId(CalendarName,eventData));
|
||||
updateEvent(eventId, eventData: Event, CalendarName, documents) {
|
||||
console.log(eventData.StartDate)
|
||||
console.log(eventData.EndDate)
|
||||
|
||||
let eventInput = {
|
||||
userId: this.utils.selectedCalendarUserId(CalendarName,eventData),
|
||||
ownerType: this.utils.selectedCalendarOwner(CalendarName),
|
||||
subject: eventData.Subject,
|
||||
body: eventData.Body.Text,
|
||||
location: eventData.Location,
|
||||
startDate: JSON.stringify(eventData.StartDate),
|
||||
endDate: JSON.stringify(eventData.EndDate),
|
||||
type: this.utils.calendarTypeSeleted(eventData.Category),
|
||||
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
|
||||
attendees: this.utils.attendeesAdded(eventData.Attendees),
|
||||
attachments: this.utils.documentAdded(documents),
|
||||
startDate: eventData.StartDate,
|
||||
endDate: eventData.EndDate,
|
||||
isAllDayEvent: eventData.IsAllDayEvent,
|
||||
updateAllEvents: false,
|
||||
recurrence: {
|
||||
frequency: 0,
|
||||
occurrences: 0,
|
||||
},
|
||||
organizerId: SessionStore.user.UserId,
|
||||
isAllDayEvent: eventData.IsAllDayEvent,
|
||||
occurrences: 0
|
||||
}
|
||||
}
|
||||
return this.agendaDataService.updateEvent(eventId, eventInput)
|
||||
}
|
||||
|
||||
this.agendaDataService.updateEvent(eventId, eventInput).subscribe((value) => {
|
||||
console.log(value)
|
||||
},((error) => {
|
||||
console.log(error)
|
||||
}));
|
||||
addEventAttendee(id,attendeeData) {
|
||||
return this.agendaDataService.addEventAttendee(id,attendeeData);
|
||||
}
|
||||
|
||||
addEventAttachment(id,attachmentData) {
|
||||
return this.agendaDataService.addEventAttachment(id,attachmentData);
|
||||
}
|
||||
|
||||
deleteEvent(eventId) {
|
||||
this.agendaDataService.deleteEvent(eventId,false).subscribe(() => {
|
||||
console.log()
|
||||
},((error) => {
|
||||
console.log(error)
|
||||
}))
|
||||
return this.agendaDataService.deleteEvent(eventId, false)
|
||||
}
|
||||
|
||||
removeEventAttachment(eventId,attachmentData) {
|
||||
return this.agendaDataService.removeEventAttachment(eventId,attachmentData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ export class EventMapper {
|
||||
"LastOccurrence": null
|
||||
},
|
||||
"Attachments": dto.attachments.map( e => ({
|
||||
"Id": e.sourceId,
|
||||
"Id": e.id,
|
||||
// "ParentId": "AAMkADVhOGY3ZDQzLTg4ZGEtNDYxMC1iMzc5LTJkMDgwNjMxOWFlZQBGAAAAAABEDW9nKs69TKQcVqQURj8YBwBR2HR2eO7pSpNdD9cc70l+AAAAAAFKAABR2HR2eO7pSpNdD9cc70l+AACK2OeJAAA=",
|
||||
// "Source": 1,
|
||||
"SourceId": e.sourceId,
|
||||
"SourceId": e.docId,
|
||||
// "Description": "teste pp",
|
||||
"SourceName": e.sourceName,
|
||||
// "CreateDate": "2024-05-24 16:41",
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const AttachmentInputDTOSchema = z.object({
|
||||
sourceId: z.string().nullable(),
|
||||
id: z.string().nullable(),
|
||||
docId: z.number().nullable(),
|
||||
sourceName: z.string().nullable(),
|
||||
description: z.string().nullable(),
|
||||
applicationId: z.number().int(),
|
||||
|
||||
@@ -26,24 +26,6 @@ export class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
editeEventCalendarUserId(CalendarName,postEvent) {
|
||||
|
||||
let CalendarNameOwnerName = this.eventService.detectCalendarNameByCalendarId(postEvent.CalendarId)
|
||||
if(this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial'] && this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
|
||||
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial']) {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
}
|
||||
}
|
||||
|
||||
selectedCalendarOwner(CalendarName) {
|
||||
let selectedCalendar = this.eventService.calendarNamesType[CalendarName]?.['RoleId'];
|
||||
|
||||
@@ -79,12 +61,13 @@ export class Utils {
|
||||
}
|
||||
|
||||
documentAdded(documents:any[]) {
|
||||
console.log('added doc create event',documents)
|
||||
return documents.map((e) => {
|
||||
return {
|
||||
sourceId: e.Id,
|
||||
docId: parseInt(e.Id),
|
||||
sourceName: e.Assunto,
|
||||
description: "",
|
||||
applicationId: parseInt(e.ApplicationType.toString())
|
||||
applicationId: parseInt(JSON.stringify(e.ApplicationType))
|
||||
};
|
||||
});
|
||||
|
||||
@@ -93,9 +76,9 @@ export class Utils {
|
||||
|
||||
atendeesSeletedType(type) {
|
||||
var selectedType = {
|
||||
'true': 1,
|
||||
'false':2,
|
||||
'other':3,
|
||||
'true': 0,
|
||||
'false':1,
|
||||
'other':2,
|
||||
}
|
||||
return selectedType[type];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user