Artikel DB struktur geändert von CODEX

This commit is contained in:
Marco_205 committed 2026-10-12 14:42:28 +00:00
1 parent 0c0a678eaa
commit 9c18234efe
95 files changed
+3872 -2316

No files matched your search

+50 -87
View File
@@ -1,93 +1,56 @@
import { Category } from "./category.types";
import {Manufacturer,emptyManufacturer} from "./manufacturer.types"
import { Category } from './category.types';
import { Manufacturer } from './manufacturer.types';
export interface Article {
_id: string,
name: string,
category: Category;
attributes?: Record<string, any>;
variants: Variant[],
export type TrackingMode = 'quantity' | 'batch' | 'individual';
export type ArticleAttributes = Record<string, string | number | boolean>;
export interface ArticleGroup {
_id: string;
name: string;
description?: string;
}
export interface ArticlePackaging {
name: string;
quantityInBaseUnits: number;
barcode?: string;
}
export interface ArticleCreate {
name: string;
categoryId: string;
attributes?: Record<string, any>;
variants: Variant[],
articleNumber: string;
name: string;
description?: string;
categoryId?: string | null;
groupId?: string | null;
manufacturerId?: string | null;
manufacturerArticleNumber?: string;
barcode?: string;
baseUnit: string;
isConsumable: boolean;
trackingMode: TrackingMode;
tracksExpiryDate: boolean;
attributes?: ArticleAttributes;
packaging?: ArticlePackaging[];
}
//--- Artikel Variante
export interface ArticleVariant {
_id: string;
article: Article;
manufacturer: Manufacturer;
supplierArticleNumber?: string;
packagingUnit?: string;
extra?: Record<string, any>;
export type ArticleUpsert = ArticleCreate;
export interface Article extends ArticleCreate {
_id: string;
category?: Category;
manufacturer?: Manufacturer;
group?: ArticleGroup;
archivedAt?: string | null;
}
export interface ArticleVariantCreate {
articleId: string;
manufacturerId: string;
supplierArticleNumber?: string;
packagingUnit?: string;
extra?: Record<string, any>;
}
export interface Variant {
_id?: string;
manufacturerId: string;
supplierArticleNumber?: string;
packagingUnit?: string;
extra?: Record<string, any>;
}
export interface VariantCreate {
manufacturerId: string;
supplierArticleNumber?: string;
packagingUnit?: string;
extra?: Record<string, any>;
}
export const emptyArticle = {
name: '',
}
export const emptyArticleVariant = {
article: emptyArticle,
manufacturer: emptyManufacturer
}
export const emptyArticleDto:ArticleCreate = {
name:'',
categoryId:'',
variants:[]
}
//Upsert
export interface ArticleUpsert {
_id:string,
name: string;
categoryId?: string;
attributes?: Record<string, any>;
variants: VariantUpsert[],
}
export interface VariantUpsert {
_id?:string
manufacturerId: string;
supplierArticleNumber?: string;
packagingUnit?: string;
extra?: Record<string, any>;
deleted?:boolean;
}
export const emptyArticleDto: ArticleCreate = {
articleNumber: '',
name: '',
description: '',
categoryId: null,
groupId: null,
manufacturerId: null,
manufacturerArticleNumber: '',
barcode: '',
baseUnit: 'Stück',
isConsumable: false,
trackingMode: 'quantity',
tracksExpiryDate: false,
attributes: {},
packaging: [],
};
+11 -15
View File
@@ -1,20 +1,16 @@
import { Location } from "./location.types";
export interface StockCreate {
name: string;
locationId: string;
areas?:string[]
name: string;
locationId: string;
areas?: string[];
}
export interface StockUpdate {
name?: string;
locationId?: string;
areas?:string[]
name?: string;
locationId?: string;
areas?: string[];
}
export interface Stock {
id: string
name: string;
location: Location;
areas?:string[]
}
_id: string;
name: string;
locationId: string;
areas?: string[];
}
@@ -1,36 +1,25 @@
import { Article } from '../catalog';
import { Stock } from './stock.types';
export interface Stock {
id: string
articleVariantId: string
locationId: string
quantity: number
expiryDate?: Date
batchNumber: string
export interface Batch {
_id: string;
batchNumber: string;
expiryDate?: string;
}
export interface StockCreate {
articleVariantId: string
locationId: string
quantity: number
expiryDate?: Date
batchNumber: string
export interface Asset {
_id: string;
inventoryNumber: string;
serialNumber?: string;
condition?: string;
purpose?: string;
acquiredAt?: string;
}
export interface StockUpdate {
articleVariantId?: string
locationId?: string
quantity?: number
expiryDate?: Date
batchNumber?: string
export interface StockContent {
_id: string;
articleId: Article;
stockId: Stock;
quantity: number;
area: string;
batchId?: Batch | null;
assetId?: Asset | null;
}
export const emptyStock:StockCreate = {
articleVariantId: '',
locationId: '',
quantity: 0,
expiryDate: new Date(),
batchNumber: '1'
}
@@ -1,28 +1,21 @@
export interface StockMovementIn {
stockId: string;
articleVariantId: string;
articleId: string;
quantity: number;
batchNumber?: string;
expiryDate?: Date;
expiryDate?: string;
area?: string;
inventoryNumber?: string;
serialNumber?: string;
condition?: string;
purpose?: string;
acquiredAt?: string;
}
export interface StockMovementOut {
stockContentId: string;
quantity: number;
}
export interface StockMovementTransfer {
articleVariantId: string;
fromStockId: string;
export interface StockMovementTransfer extends StockMovementOut {
toStockId: string;
toArea?: string;
quantity: number;
batchNumber?: string;
}