git init v2

This commit is contained in:
2025-03-11 23:13:19 +01:00
parent 4d4c8a362a
commit abae328d8f
62 changed files with 3461 additions and 421 deletions

View File

@@ -0,0 +1,45 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Appointment} from '../models/appointment';
@Injectable({
providedIn: 'root',
})
export class AppointmentService {
baseApi = "http://localhost:8080/api/appointments";
// baseApi = "https://api.melvanveen.nl/api/appointments";
constructor(private http: HttpClient) {
}
getAllAppointments() {
return this.http.get<Appointment[]>(`${this.baseApi}`);
}
getAppointmentsByDate(date: Date) {
const day = date.getDate().toString().padStart(2, '0')
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const year = date.getFullYear();
return this.http.get<Appointment[]>(`${this.baseApi}/date?start=${year}-${month}-${day}`, {});
}
addAppointment(appointment: Appointment) {
return this.http.post(`${this.baseApi}`, appointment);
}
deleteAppointment(appointment: Appointment) {
return this.http.delete(`${this.baseApi}?id=${appointment.id}`)
}
updateAppointment(appointment: Appointment) {
return this.http.put(`${this.baseApi}`, appointment);
}
getAppointment(id: string) {
return this.http.get(`${this.baseApi}/${id}`);
}
getMostRecentAppointment(id: number) {
return this.http.get(`${this.baseApi}/recent/${id}`);
}
}