// upcoming-events.service.ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from 'src/environments/environment'; export interface UpcomingEvent { id?: number; title: string; description: string; schedule: string; eventDate?: string; isActive: boolean; } @Injectable({ providedIn: 'root' }) export class UpcomingEventsService { private apiUrl = environment.apiUrl + '/api/upcoming-events'; constructor(private http: HttpClient) {} getAllUpcomingEvents(): Observable { return this.http.get(this.apiUrl); } getActiveUpcomingEvents(): Observable { return this.http.get(`${this.apiUrl}/active`); } getUpcomingEvent(id: number): Observable { return this.http.get(`${this.apiUrl}/${id}`); } createUpcomingEvent(event: UpcomingEvent): Observable { return this.http.post(this.apiUrl, event); } updateUpcomingEvent(id: number, event: UpcomingEvent): Observable { return this.http.put(`${this.apiUrl}/${id}`, event); } deleteUpcomingEvent(id: number): Observable { return this.http.delete(`${this.apiUrl}/${id}`); } }