add Brand Management

This commit is contained in:
2025-05-26 20:44:15 +02:00
parent d27871160e
commit 25c09dfecc
11 changed files with 548 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
import { Product, ProductCreate, Shop, ShopCreate, ShoppingEvent, ShoppingEventCreate } from '../types';
import { Product, ProductCreate, Shop, ShopCreate, ShoppingEvent, ShoppingEventCreate, Brand, BrandCreate } from '../types';
const API_BASE_URL = 'http://localhost:8000';
@@ -41,6 +41,16 @@ export const shopApi = {
delete: (id: number) => api.delete(`/shops/${id}`),
};
// Brand API functions
export const brandApi = {
getAll: () => api.get<Brand[]>('/brands/'),
getById: (id: number) => api.get<Brand>(`/brands/${id}`),
create: (brand: BrandCreate) => api.post<Brand>('/brands/', brand),
update: (id: number, brand: Partial<BrandCreate>) =>
api.put<Brand>(`/brands/${id}`, brand),
delete: (id: number) => api.delete(`/brands/${id}`),
};
// Shopping Event API functions
export const shoppingEventApi = {
getAll: () => api.get<ShoppingEvent[]>('/shopping-events/'),