Add products module #46

This commit is contained in:
2025-11-26 10:05:43 +01:00
parent 914613e3ea
commit c55fc78c36
21 changed files with 607 additions and 50 deletions
+71 -1
View File
@@ -279,4 +279,74 @@ export function newPaymentTerms(): PaymentTerms {
isFixed: false,
days: 14
}
}
}
export interface ProductCategory {
id: number;
name: string;
createdAt: Date;
updatedAt: Date;
}
export function newProductCategory(): ProductCategory {
return {
id: 0,
name: '',
createdAt: new Date(),
updatedAt: new Date()
}
}
export interface Unit {
id: number;
name: string;
symbol: string | null;
createdAt: Date;
updatedAt: Date;
}
export function newUnit(): Unit {
return {
id: 0,
name: '',
symbol: null,
createdAt: new Date(),
updatedAt: new Date()
}
}
export interface Product {
id: number;
title: string;
description: string | null;
notes: string | null;
vendorUrl: string | null;
categoryId: number | null;
category: ProductCategory | null;
price: number | null;
margin: number;
unitId: number | null;
unit: Unit | null;
image: string | null;
createdAt: Date;
updatedAt: Date;
}
export function newProduct(): Product {
return {
id: 0,
title: '',
description: null,
notes: null,
vendorUrl: null,
categoryId: null,
category: null,
price: null,
margin: 0.2,
unitId: null,
unit: null,
image: null,
createdAt: new Date(),
updatedAt: new Date()
}
}