refactor: reorganize component files and update import paths; add PsItem and PsProduct interfaces

This commit is contained in:
Vincent Guillet
2025-11-12 12:34:58 +01:00
parent f063a245b9
commit bcc71b965b
92 changed files with 1694 additions and 2815 deletions

View File

@@ -0,0 +1,32 @@
import {inject, Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {Platform} from '../interfaces/platform';
import {CrudService} from './crud.service';
@Injectable({
providedIn: 'root'
})
export class PlatformService implements CrudService<Platform> {
private readonly http = inject(HttpClient);
private readonly BASE_URL = 'http://localhost:3000/api/app/platforms';
getAll(): Observable<Platform[]> {
return this.http.get<Platform[]>(this.BASE_URL, {withCredentials: true});
}
add(item: Platform): Observable<Platform> {
console.log('Adding platform:', item);
return this.http.post<Platform>(this.BASE_URL, item, {withCredentials: true});
}
update(id: string | number, item: Platform): Observable<Platform> {
console.log('Updating platform:', id, item);
return this.http.put<Platform>(`${this.BASE_URL}/${id}`, item, {withCredentials: true});
}
delete(id: string | number): Observable<void> {
console.log('Deleting platform:', id);
return this.http.delete<void>(`${this.BASE_URL}/${id}`, {withCredentials: true});
}
}