feat: add unit mapping functionality
Test Suite / test (24.15.0) (push) Has been cancelled

- Added new API path for unit mappings in `api_paths.dart`.
- Implemented `upsertUnitMapping` method in `ImportRepository` to handle unit mapping creation.
- Updated `ReceiptImportTab` to learn and save unit mappings during receipt import.
- Created DTO for unit mapping with validation in `create-unit-mapping.dto.ts`.
- Added SQL migration for `UnitMapping` table creation with necessary constraints.
This commit is contained in:
Nils-Johan Gynther
2026-05-07 10:00:42 +02:00
parent 26823fbf35
commit a68a0ca86f
35 changed files with 558 additions and 24 deletions
+73
View File
@@ -10,11 +10,30 @@ type InventoryQuery = {
export declare class InventoryService {
private prisma;
constructor(prisma: PrismaService);
private readonly productWithCategoryInclude;
private throwInventoryItemNotFound;
private findInventoryItemByIdOrThrow;
private ensureProductExists;
findAll(query?: InventoryQuery): Promise<({
product: {
categoryRef: ({
parent: ({
parent: {
name: string;
id: number;
parentId: number | null;
} | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
category: string | null;
status: string;
@@ -48,6 +67,24 @@ export declare class InventoryService {
})[]>;
consume(id: number, data: ConsumeInventoryDto): Promise<{
product: {
categoryRef: ({
parent: ({
parent: {
name: string;
id: number;
parentId: number | null;
} | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
category: string | null;
status: string;
@@ -124,6 +161,24 @@ export declare class InventoryService {
})[]>;
create(data: CreateInventoryDto): Promise<{
product: {
categoryRef: ({
parent: ({
parent: {
name: string;
id: number;
parentId: number | null;
} | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
category: string | null;
status: string;
@@ -157,6 +212,24 @@ export declare class InventoryService {
}>;
update(id: number, data: UpdateInventoryDto): Promise<{
product: {
categoryRef: ({
parent: ({
parent: {
name: string;
id: number;
parentId: number | null;
} | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
id: number;
parentId: number | null;
}) | null;
} & {
name: string;
category: string | null;
status: string;