diff --git a/client/src/app/interfaces/brand.ts b/client/src/app/interfaces/brand.ts deleted file mode 100644 index 0f6d120..0000000 --- a/client/src/app/interfaces/brand.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Brand { - id: string | number; - name: string; -} diff --git a/client/src/app/interfaces/category.ts b/client/src/app/interfaces/category.ts deleted file mode 100644 index e761b1f..0000000 --- a/client/src/app/interfaces/category.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Category { - id: string | number; - name: string; -} diff --git a/client/src/app/interfaces/condition.ts b/client/src/app/interfaces/condition.ts deleted file mode 100644 index 43687b0..0000000 --- a/client/src/app/interfaces/condition.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface Condition { - id: string | number; - name: string; - displayName: string; -} diff --git a/client/src/app/interfaces/image.ts b/client/src/app/interfaces/image.ts deleted file mode 100644 index 9a46186..0000000 --- a/client/src/app/interfaces/image.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface Image { - id: string | number; - name : string; - url: string; -} diff --git a/client/src/app/interfaces/platform.ts b/client/src/app/interfaces/platform.ts deleted file mode 100644 index 9155fcb..0000000 --- a/client/src/app/interfaces/platform.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {Brand} from './brand'; - -export interface Platform { - id: string | number; - name: string; - brand: Brand | undefined; -} diff --git a/client/src/app/interfaces/product.ts b/client/src/app/interfaces/product.ts deleted file mode 100644 index 7138219..0000000 --- a/client/src/app/interfaces/product.ts +++ /dev/null @@ -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; -} diff --git a/client/src/app/services/brand.service.ts b/client/src/app/services/brand.service.ts deleted file mode 100644 index 12df4f8..0000000 --- a/client/src/app/services/brand.service.ts +++ /dev/null @@ -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 { - private readonly http = inject(HttpClient); - private readonly BASE_URL = 'http://localhost:3000/api/app/brands'; - - getAll(): Observable { - return this.http.get(this.BASE_URL, {withCredentials: true}); - } - - add(item: Brand): Observable { - console.log('Adding brand:', item); - return this.http.post(this.BASE_URL, item, {withCredentials: true}); - } - - update(id: string | number, item: Brand): Observable { - console.log('Updating brand:', id, item); - return this.http.put(`${this.BASE_URL}/${id}`, item, {withCredentials: true}); - } - - delete(id: string | number): Observable { - console.log('Deleting brand:', id); - return this.http.delete(`${this.BASE_URL}/${id}`, {withCredentials: true}); - } -} diff --git a/client/src/app/services/category.service.ts b/client/src/app/services/category.service.ts deleted file mode 100644 index 8864a05..0000000 --- a/client/src/app/services/category.service.ts +++ /dev/null @@ -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 { - private readonly http = inject(HttpClient); - private readonly BASE_URL = 'http://localhost:3000/api/app/categories'; - - getAll(): Observable { - return this.http.get(this.BASE_URL, {withCredentials: true}); - } - - add(item: Category): Observable { - console.log('Adding category:', item); - return this.http.post(this.BASE_URL, item, {withCredentials: true}); - } - - update(id: string | number, item: Category): Observable { - console.log('Updating category:', id, item); - return this.http.put(`${this.BASE_URL}/${id}`, item, {withCredentials: true}); - } - - delete(id: string | number): Observable { - console.log('Deleting category:', id); - return this.http.delete(`${this.BASE_URL}/${id}`, {withCredentials: true}); - } -} diff --git a/client/src/app/services/condition.service.ts b/client/src/app/services/condition.service.ts deleted file mode 100644 index baad1c3..0000000 --- a/client/src/app/services/condition.service.ts +++ /dev/null @@ -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 { - private readonly http = inject(HttpClient); - private readonly BASE_URL = 'http://localhost:3000/api/app/conditions'; - - getAll(): Observable { - return this.http.get(this.BASE_URL, {withCredentials: true}); - } - - add(item: Condition): Observable { - console.log('Adding condition:', item); - return this.http.post(this.BASE_URL, item, {withCredentials: true}); - } - - update(id: string | number, item: Condition): Observable { - console.log('Updating condition:', id, item); - return this.http.put(`${this.BASE_URL}/${id}`, item, {withCredentials: true}); - } - - delete(id: string | number): Observable { - console.log('Deleting condition:', id); - return this.http.delete(`${this.BASE_URL}/${id}`, {withCredentials: true}); - } -} diff --git a/client/src/app/services/crud.service.ts b/client/src/app/services/crud.service.ts deleted file mode 100644 index 8f3e81d..0000000 --- a/client/src/app/services/crud.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Observable } from 'rxjs'; - -export interface CrudService { - getAll(): Observable; - add(item: T): Observable; - update(id: string | number, item: T): Observable; - delete(id: string | number): Observable; -} diff --git a/client/src/app/services/image.service.ts b/client/src/app/services/image.service.ts deleted file mode 100644 index 453734c..0000000 --- a/client/src/app/services/image.service.ts +++ /dev/null @@ -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 { - const fd = new FormData(); - fd.append('file', file, file.name); - return this.http.post(this.BASE, fd, {withCredentials: true}); - } -} diff --git a/client/src/app/services/platform.service.ts b/client/src/app/services/platform.service.ts deleted file mode 100644 index 55f86c8..0000000 --- a/client/src/app/services/platform.service.ts +++ /dev/null @@ -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 { - private readonly http = inject(HttpClient); - private readonly BASE_URL = 'http://localhost:3000/api/app/platforms'; - - getAll(): Observable { - return this.http.get(this.BASE_URL, {withCredentials: true}); - } - - add(item: Platform): Observable { - console.log('Adding platform:', item); - return this.http.post(this.BASE_URL, item, {withCredentials: true}); - } - - update(id: string | number, item: Platform): Observable { - console.log('Updating platform:', id, item); - return this.http.put(`${this.BASE_URL}/${id}`, item, {withCredentials: true}); - } - - delete(id: string | number): Observable { - console.log('Deleting platform:', id); - return this.http.delete(`${this.BASE_URL}/${id}`, {withCredentials: true}); - } -} diff --git a/client/src/app/services/product.service.ts b/client/src/app/services/product.service.ts deleted file mode 100644 index a207dcc..0000000 --- a/client/src/app/services/product.service.ts +++ /dev/null @@ -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 { - private readonly http = inject(HttpClient); - private readonly BASE_URL = 'http://localhost:3000/api/app/products'; - - getAll(): Observable { - return this.http.get(this.BASE_URL, {withCredentials: true}); - } - - add(item: Product): Observable { - console.log('Adding product:', item); - return this.http.post(this.BASE_URL, item, {withCredentials: true}); - } - - update(id: string | number, item: Product): Observable { - console.log('Updating product:', id, item); - return this.http.put(`${this.BASE_URL}/${id}`, item, {withCredentials: true}); - } - - delete(id: string | number): Observable { - console.log('Deleting product:', id); - return this.http.delete(`${this.BASE_URL}/${id}`, {withCredentials: true}); - } -} diff --git a/client/src/app/services/product_images.service.ts b/client/src/app/services/product_images.service.ts deleted file mode 100644 index 581687b..0000000 --- a/client/src/app/services/product_images.service.ts +++ /dev/null @@ -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 { - - 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 { - throw new Error("Method not implemented."); - } - - update(id: string | number, item: string | number): Observable { - throw new Error("Method not implemented."); - } - - delete(id: string | number): Observable { - throw new Error("Method not implemented."); - } - - link(productId: string | number, imageId: string | number): Observable { - return this.http.post(`${this.BASE_URL}/link`, {productId, imageId}, {withCredentials: true}); - } -}