mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
repository code added
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AgendaDataRepositoryService } from './agenda-data-repository.service';
|
||||||
|
|
||||||
|
describe('AgendaDataRepositoryService', () => {
|
||||||
|
let service: AgendaDataRepositoryService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(AgendaDataRepositoryService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { AgendaDataService } from './agenda-data.service';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class AgendaDataRepositoryService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private agendaDataService: AgendaDataService
|
||||||
|
) { }
|
||||||
|
|
||||||
|
createEvent(eventData) {
|
||||||
|
this.agendaDataService.createEvent(eventData);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,102 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AgendaDataService {
|
|
||||||
|
|
||||||
constructor() { }
|
export class AgendaDataService {
|
||||||
|
private baseUrl = '/stage/api/v2'; // Your base URL
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
// Contacts Endpoints
|
||||||
|
getContacts(value: string): Observable<any> {
|
||||||
|
const params = new HttpParams().set('value', value);
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Contacts`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Documents Endpoints
|
||||||
|
getAttachments(subject: string, applicationType: number): Observable<any> {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('Subject', subject)
|
||||||
|
.set('ApplicationType', applicationType.toString());
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Documents/Attachments`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
viewDocument(userId: number, docId: number, applicationId: number): Observable<any> {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('userId', userId.toString())
|
||||||
|
.set('docId', docId.toString())
|
||||||
|
.set('applicationId', applicationId.toString());
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Documents/view`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Events Endpoints
|
||||||
|
createEvent(eventData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events`, eventData);
|
||||||
|
}
|
||||||
|
|
||||||
|
getEvents(userId: number, startDate: string, endDate: string, status: string, category: string, type: string): Observable<any> {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('UserId', userId.toString())
|
||||||
|
.set('StartDate', startDate)
|
||||||
|
.set('EndDate', endDate)
|
||||||
|
.set('Status', status)
|
||||||
|
.set('Category', category)
|
||||||
|
.set('Type', type);
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEvent(id: string, eventData: any): Observable<any> {
|
||||||
|
return this.http.put<any>(`${this.baseUrl}/Events/${id}`, eventData);
|
||||||
|
}
|
||||||
|
|
||||||
|
approveEvent(id: string): Observable<any> {
|
||||||
|
return this.http.patch<any>(`${this.baseUrl}/Events/${id}/Approval`, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
getEvent(id: string): Observable<any> {
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteEvent(id: string, deleteAllEvents: boolean): Observable<any> {
|
||||||
|
const params = new HttpParams().set('DeleteAllEvents', deleteAllEvents.toString());
|
||||||
|
return this.http.delete<any>(`${this.baseUrl}/Events/${id}`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEventStatus(id: string, statusData: any): Observable<any> {
|
||||||
|
return this.http.patch<any>(`${this.baseUrl}/Events/${id}/Status`, statusData);
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventAttendee(id: string, attendeeData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Attendee`, attendeeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEventAttendee(id: string, attendeeData: any): Observable<any> {
|
||||||
|
return this.http.delete<any>(`${this.baseUrl}/Events/${id}/Attendee`, { body: attendeeData });
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventAttachment(id: string, attachmentData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Attachment`, attachmentData);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEventAttachment(id: string, attachmentData: any): Observable<any> {
|
||||||
|
return this.http.delete<any>(`${this.baseUrl}/Events/${id}/Attachment`, { body: attachmentData });
|
||||||
|
}
|
||||||
|
|
||||||
|
communicateEvent(id: string, communicationData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Communicate`, communicationData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Users Endpoints
|
||||||
|
getUsers(value: string): Observable<any> {
|
||||||
|
const params = new HttpParams().set('value', value);
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Users`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
getToken(): Observable<any> {
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Users/token`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,103 +1,105 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
const AttachCommunicationInputModel = z.object({
|
export const AttachCommunicationInputDTOSchema = z.object({
|
||||||
attachmentId: z.string().uuid(),
|
attachmentId: z.string().uuid(),
|
||||||
description: z.string().nullable().optional(),
|
description: z.string().nullable().optional(),
|
||||||
typeSharing: z.number().int(),
|
typeSharing: z.number().int(),
|
||||||
dateViewExpire: z.string().datetime().nullable().optional(),
|
dateViewExpire: z.string().datetime().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttachmentInputModel = z.object({
|
|
||||||
|
export const AttachmentInputDTOSchema = z.object({
|
||||||
sourceId: z.string().nullable().optional(),
|
sourceId: z.string().nullable().optional(),
|
||||||
sourceName: z.string().nullable().optional(),
|
sourceName: z.string().nullable().optional(),
|
||||||
description: z.string().nullable().optional(),
|
description: z.string().nullable().optional(),
|
||||||
applicationId: z.number().int(),
|
applicationId: z.number().int(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttendeeCommunicationInputModel = z.object({
|
|
||||||
|
export const AttendeeCommunicationInputDTOSchema = z.object({
|
||||||
attendeeId: z.string().uuid(),
|
attendeeId: z.string().uuid(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttendeeExternalInputModel = z.object({
|
export const AttendeeExternalInputDTOSchema = z.object({
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
emailAddress: z.string().email().nullable().optional(),
|
emailAddress: z.string().email().nullable().optional(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttendeeInputModel = z.object({
|
export const AttendeeInputDTOSchema = z.object({
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
emailAddress: z.string().nullable().optional(),
|
emailAddress: z.string().nullable().optional(),
|
||||||
attendeeType: z.enum(["0", "1", "2"]),
|
attendeeType: z.enum(["0", "1", "2"]),
|
||||||
wxUserId: z.number().int(),
|
wxUserId: z.number().int(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EAttendeeType = z.enum(["0", "1", "2"]);
|
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
|
||||||
|
|
||||||
const EEventCategory = z.enum(["1", "2"]);
|
const EEventCategoryDTO = z.enum(["1", "2"]);
|
||||||
|
|
||||||
const EEventFilterCategory = z.enum(["1", "2", "3"]);
|
const EEventFilterCategoryDTO = z.enum(["1", "2", "3"]);
|
||||||
|
|
||||||
const EEventFilterStatus = z.enum(["0", "1", "2", "3", "4", "5"]);
|
const EEventFilterStatusDTO = z.enum(["0", "1", "2", "3", "4", "5"]);
|
||||||
|
|
||||||
const EEventFilterType = z.enum(["1", "2", "3", "4"]);
|
const EEventFilterTypeDTO = z.enum(["1", "2", "3", "4"]);
|
||||||
|
|
||||||
const EEventOwnerType = z.enum(["1", "2", "3"]);
|
const EEventOwnerTypeDTO = z.enum(["1", "2", "3"]);
|
||||||
|
|
||||||
const EEventStatus = z.enum(["0", "1", "2", "3", "4"]);
|
const EEventStatusDTO = z.enum(["0", "1", "2", "3", "4"]);
|
||||||
|
|
||||||
const EEventType = z.enum(["1", "2", "3"]);
|
const EEventTypeDTO = z.enum(["1", "2", "3"]);
|
||||||
|
|
||||||
const ERecurringType = z.enum(["0", "1", "2", "3", "4"]);
|
const ERecurringTypeDTO = z.enum(["0", "1", "2", "3", "4"]);
|
||||||
|
|
||||||
const EventAddAttachmentModel = z.object({
|
const EventAddAttachmentDTOSchema = z.object({
|
||||||
attachments: z.array(AttachmentInputModel),
|
attachments: z.array(AttachmentInputDTOSchema),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventAddAttendeeModel = z.object({
|
const EventAddAttendeeDTOSchema = z.object({
|
||||||
attendees: z.array(AttendeeInputModel),
|
attendees: z.array(AttendeeInputDTOSchema),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventCommunicationInputModel = z.object({
|
export const EventCommunicationInputDTOSchema = z.object({
|
||||||
attachs: z.array(AttachCommunicationInputModel).nullable().optional(),
|
attachs: z.array(AttachCommunicationInputDTOSchema).nullable().optional(),
|
||||||
attendees: z.array(AttendeeCommunicationInputModel).nullable().optional(),
|
attendees: z.array(AttendeeCommunicationInputDTOSchema).nullable().optional(),
|
||||||
externalAttendees: z.array(AttendeeExternalInputModel).nullable().optional(),
|
externalAttendees: z.array(AttendeeExternalInputDTOSchema).nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventInputModel = z.object({
|
export const EventInputDTOSchema = z.object({
|
||||||
userId: z.number().int(),
|
userId: z.number().int(),
|
||||||
ownerType: EEventOwnerType,
|
ownerType: EEventOwnerTypeDTO,
|
||||||
subject: z.string().min(1),
|
subject: z.string().min(1),
|
||||||
body: z.string().min(1),
|
body: z.string().min(1),
|
||||||
location: z.string().nullable().optional(),
|
location: z.string().nullable().optional(),
|
||||||
startDate: z.string().datetime(),
|
startDate: z.string().datetime(),
|
||||||
endDate: z.string().datetime(),
|
endDate: z.string().datetime(),
|
||||||
type: EEventType,
|
type: EEventTypeDTO,
|
||||||
category: EEventCategory,
|
category: EEventCategoryDTO,
|
||||||
attendees: z.array(AttendeeInputModel).nullable().optional(),
|
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
|
||||||
attachments: z.array(AttachmentInputModel).nullable().optional(),
|
attachments: z.array(AttachmentInputDTOSchema).nullable().optional(),
|
||||||
recurrence: z.object({
|
recurrence: z.object({
|
||||||
frequency: ERecurringType,
|
frequency: ERecurringTypeDTO,
|
||||||
occurrences: z.number().int(),
|
occurrences: z.number().int(),
|
||||||
}),
|
}),
|
||||||
organizerId: z.number().int(),
|
organizerId: z.number().int(),
|
||||||
isAllDayEvent: z.boolean(),
|
isAllDayEvent: z.boolean(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventRecurrenceInputModel = z.object({
|
export const EventRecurrenceInputDTOSchema = z.object({
|
||||||
frequency: ERecurringType,
|
frequency: ERecurringTypeDTO,
|
||||||
occurrences: z.number().int(),
|
occurrences: z.number().int(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventRemoveAttachmentModel = z.object({
|
export const EventRemoveAttachmentDTOSchema = z.object({
|
||||||
attachments: z.array(z.string().uuid()),
|
attachments: z.array(z.string().uuid()),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventRemoveAttendeeModel = z.object({
|
export const EventRemoveAttendeeDTOSchema = z.object({
|
||||||
attendees: z.array(z.string().uuid()),
|
attendees: z.array(z.string().uuid()),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventUpdateModel = z.object({
|
export const EventUpdateDTOSchema = z.object({
|
||||||
subject: z.string().min(1),
|
subject: z.string().min(1),
|
||||||
body: z.string().min(1),
|
body: z.string().min(1),
|
||||||
location: z.string().min(1),
|
location: z.string().min(1),
|
||||||
@@ -106,17 +108,17 @@ const EventUpdateModel = z.object({
|
|||||||
isAllDayEvent: z.boolean(),
|
isAllDayEvent: z.boolean(),
|
||||||
updateAllEvents: z.boolean(),
|
updateAllEvents: z.boolean(),
|
||||||
recurrence: z.object({
|
recurrence: z.object({
|
||||||
frequency: ERecurringType,
|
frequency: ERecurringTypeDTO,
|
||||||
occurrences: z.number().int(),
|
occurrences: z.number().int(),
|
||||||
}),
|
}),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventUpdateStatusModel = z.object({
|
export const EventUpdateStatusDTOSchema = z.object({
|
||||||
status: EEventStatus,
|
status: EEventStatusDTO,
|
||||||
comment: z.string().nullable().optional(),
|
comment: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const ProblemDetails = z.object({
|
export const ProblemDetailsDTOSchema = z.object({
|
||||||
type: z.string().nullable().optional(),
|
type: z.string().nullable().optional(),
|
||||||
title: z.string().nullable().optional(),
|
title: z.string().nullable().optional(),
|
||||||
status: z.number().int().nullable().optional(),
|
status: z.number().int().nullable().optional(),
|
||||||
@@ -124,43 +126,26 @@ const ProblemDetails = z.object({
|
|||||||
instance: z.string().nullable().optional(),
|
instance: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const ResponseSimpleModel = z.object({
|
export const ResponseSimpleDTOSchema = z.object({
|
||||||
success: z.boolean(),
|
success: z.boolean(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
data: z.any().nullable().optional(),
|
data: z.any().nullable().optional(),
|
||||||
}).strict();
|
})
|
||||||
|
|
||||||
const Bearer = z.object({
|
|
||||||
type: z.literal('http'),
|
|
||||||
description: z.string().optional(),
|
|
||||||
scheme: z.literal('bearer'),
|
|
||||||
}).strict();
|
|
||||||
|
|
||||||
export {
|
export type AttachCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
AttachCommunicationInputModel,
|
export type AttachmentInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
AttachmentInputModel,
|
export type AttendeeCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
AttendeeCommunicationInputModel,
|
export type AttendeeExternalInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
AttendeeExternalInputModel,
|
export type AttendeeInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
AttendeeInputModel,
|
export type EventAddAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EAttendeeType,
|
export type EventAddAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EEventCategory,
|
export type EventCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EEventFilterCategory,
|
export type EventInputDTO = z.infer<typeof EventInputDTOSchema>;
|
||||||
EEventFilterStatus,
|
export type EventRecurrenceInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EEventFilterType,
|
export type EventRemoveAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EEventOwnerType,
|
export type EventRemoveAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EEventStatus,
|
export type EventUpdateDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EEventType,
|
export type EventUpdateStatusDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
ERecurringType,
|
export type ProblemDetailsDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EventAddAttachmentModel,
|
export type ResponseSimpleDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
EventAddAttendeeModel,
|
|
||||||
EventCommunicationInputModel,
|
|
||||||
EventInputModel,
|
|
||||||
EventRecurrenceInputModel,
|
|
||||||
EventRemoveAttachmentModel,
|
|
||||||
EventRemoveAttendeeModel,
|
|
||||||
EventUpdateModel,
|
|
||||||
EventUpdateStatusModel,
|
|
||||||
ProblemDetails,
|
|
||||||
ResponseSimpleModel,
|
|
||||||
Bearer,
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user