Delete unused files

This commit is contained in:
Vincent Guillet
2025-11-25 21:21:30 +01:00
parent 8317fc24d9
commit 64f00d5b30
14 changed files with 0 additions and 259 deletions

View File

@@ -1,4 +0,0 @@
export interface Brand {
id: string | number;
name: string;
}

View File

@@ -1,4 +0,0 @@
export interface Category {
id: string | number;
name: string;
}

View File

@@ -1,5 +0,0 @@
export interface Condition {
id: string | number;
name: string;
displayName: string;
}

View File

@@ -1,5 +0,0 @@
export interface Image {
id: string | number;
name : string;
url: string;
}

View File

@@ -1,7 +0,0 @@
import {Brand} from './brand';
export interface Platform {
id: string | number;
name: string;
brand: Brand | undefined;
}

View File

@@ -1,16 +0,0 @@
import {Category} from './category';
import {Platform} from './platform';
import {Condition} from './condition';
export interface Product {
id: string | number;
title: string;
description: string;
price: number;
quantity: number;
complete: boolean;
manualIncluded: boolean;
category: Category | undefined;
platform: Platform | undefined;
condition: Condition | undefined;
}

View File

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

View File

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

View File

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

View File

@@ -1,8 +0,0 @@
import { Observable } from 'rxjs';
export interface CrudService<T> {
getAll(): Observable<T[]>;
add(item: T): Observable<T>;
update(id: string | number, item: T): Observable<T>;
delete(id: string | number): Observable<void>;
}

View File

@@ -1,17 +0,0 @@
import {inject, Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {Image} from '../interfaces/image';
@Injectable({providedIn: 'root'})
export class ImageService {
private readonly BASE = 'http://localhost:3000/api/app/images';
private readonly http: HttpClient = inject(HttpClient);
add(file: File): Observable<Image> {
const fd = new FormData();
fd.append('file', file, file.name);
return this.http.post<Image>(this.BASE, fd, {withCredentials: true});
}
}

View File

@@ -1,32 +0,0 @@
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});
}
}

View File

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

View File

@@ -1,33 +0,0 @@
import {inject, Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {CrudService} from './crud.service';
@Injectable({
providedIn: 'root'
})
export class ProductImageService implements CrudService<string | number> {
private readonly http = inject(HttpClient);
private readonly BASE_URL = 'http://localhost:3000/api/app/products_images';
getAll(): Observable<(string | number)[]> {
throw new Error("Method not implemented.");
}
add(item: string | number): Observable<string | number> {
throw new Error("Method not implemented.");
}
update(id: string | number, item: string | number): Observable<string | number> {
throw new Error("Method not implemented.");
}
delete(id: string | number): Observable<void> {
throw new Error("Method not implemented.");
}
link(productId: string | number, imageId: string | number): Observable<any> {
return this.http.post(`${this.BASE_URL}/link`, {productId, imageId}, {withCredentials: true});
}
}