Initial commit: Angular PV Pulse App

This commit is contained in:
2026-03-10 11:29:29 +01:00
commit 90d8cb78fd
69 changed files with 11966 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { PvPlant } from '../models/pv-plant.model';
import { ApiResponse } from '../models/api-response.model';
import { SettingsService } from './settings.service';
@Injectable({ providedIn: 'root' })
export class PvPlantService {
private readonly http = inject(HttpClient);
private readonly settingsService = inject(SettingsService);
getAll(): Observable<PvPlant[]> {
const { apiBaseUrl, endpointPlants } = this.settingsService.settings();
return this.http
.get<ApiResponse<PvPlant[]>>(apiBaseUrl + endpointPlants)
.pipe(map((res) => res.data));
}
getById(id: string): Observable<PvPlant> {
const { apiBaseUrl, endpointPlants } = this.settingsService.settings();
return this.http
.get<ApiResponse<PvPlant>>(`${apiBaseUrl}${endpointPlants}/${encodeURIComponent(id)}`)
.pipe(map((res) => res.data));
}
}