mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
99 lines
3.6 KiB
TypeScript
99 lines
3.6 KiB
TypeScript
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { EventOutputDTO } from './model/eventDTOOutput';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class AgendaDataService {
|
|
private baseUrl = 'https://gdapi-dev.dyndns.info/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: number, category: string, type: string): Observable<any> {
|
|
const params = new HttpParams()
|
|
.set('UserId', userId)
|
|
.set('Status', status)
|
|
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`);
|
|
}
|
|
}
|