a68a0ca86f
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.
273 lines
8.3 KiB
TypeScript
273 lines
8.3 KiB
TypeScript
import { CreateInventoryDto } from './dto/create-inventory.dto';
|
|
import { UpdateInventoryDto } from './dto/update-inventory.dto';
|
|
import { InventoryService } from './inventory.service';
|
|
import { ConsumeInventoryDto } from './dto/consume-inventory.dto';
|
|
export declare class InventoryController {
|
|
private readonly inventoryService;
|
|
constructor(inventoryService: InventoryService);
|
|
consume(id: number, body: 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;
|
|
id: number;
|
|
categoryId: number | null;
|
|
normalizedName: string;
|
|
canonicalName: string | null;
|
|
isActive: boolean;
|
|
deletedAt: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
ownerId: number;
|
|
isPrivate: boolean;
|
|
};
|
|
} & {
|
|
origin: string | null;
|
|
id: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
productId: number;
|
|
quantity: import("@prisma/client/runtime/library").Decimal;
|
|
unit: string;
|
|
brand: string | null;
|
|
receiptName: string | null;
|
|
location: string | null;
|
|
purchaseDate: Date | null;
|
|
opened: boolean | null;
|
|
suitableFor: string | null;
|
|
bestBeforeDate: Date | null;
|
|
comment: string | null;
|
|
}>;
|
|
findConsumptionHistory(id: number): Promise<{
|
|
inventoryItem: {
|
|
unit: string;
|
|
};
|
|
id: number;
|
|
createdAt: Date;
|
|
comment: string | null;
|
|
inventoryItemId: number;
|
|
amountUsed: import("@prisma/client/runtime/library").Decimal;
|
|
}[]>;
|
|
findAll(location?: string, sort?: string): 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;
|
|
id: number;
|
|
categoryId: number | null;
|
|
normalizedName: string;
|
|
canonicalName: string | null;
|
|
isActive: boolean;
|
|
deletedAt: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
ownerId: number;
|
|
isPrivate: boolean;
|
|
};
|
|
} & {
|
|
origin: string | null;
|
|
id: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
productId: number;
|
|
quantity: import("@prisma/client/runtime/library").Decimal;
|
|
unit: string;
|
|
brand: string | null;
|
|
receiptName: string | null;
|
|
location: string | null;
|
|
purchaseDate: Date | null;
|
|
opened: boolean | null;
|
|
suitableFor: string | null;
|
|
bestBeforeDate: Date | null;
|
|
comment: string | null;
|
|
})[]>;
|
|
findExpiring(): Promise<({
|
|
product: {
|
|
name: string;
|
|
category: string | null;
|
|
status: string;
|
|
id: number;
|
|
categoryId: number | null;
|
|
normalizedName: string;
|
|
canonicalName: string | null;
|
|
isActive: boolean;
|
|
deletedAt: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
ownerId: number;
|
|
isPrivate: boolean;
|
|
};
|
|
} & {
|
|
origin: string | null;
|
|
id: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
productId: number;
|
|
quantity: import("@prisma/client/runtime/library").Decimal;
|
|
unit: string;
|
|
brand: string | null;
|
|
receiptName: string | null;
|
|
location: string | null;
|
|
purchaseDate: Date | null;
|
|
opened: boolean | null;
|
|
suitableFor: string | null;
|
|
bestBeforeDate: Date | null;
|
|
comment: string | null;
|
|
})[]>;
|
|
create(body: 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;
|
|
id: number;
|
|
categoryId: number | null;
|
|
normalizedName: string;
|
|
canonicalName: string | null;
|
|
isActive: boolean;
|
|
deletedAt: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
ownerId: number;
|
|
isPrivate: boolean;
|
|
};
|
|
} & {
|
|
origin: string | null;
|
|
id: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
productId: number;
|
|
quantity: import("@prisma/client/runtime/library").Decimal;
|
|
unit: string;
|
|
brand: string | null;
|
|
receiptName: string | null;
|
|
location: string | null;
|
|
purchaseDate: Date | null;
|
|
opened: boolean | null;
|
|
suitableFor: string | null;
|
|
bestBeforeDate: Date | null;
|
|
comment: string | null;
|
|
}>;
|
|
update(id: number, body: 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;
|
|
id: number;
|
|
categoryId: number | null;
|
|
normalizedName: string;
|
|
canonicalName: string | null;
|
|
isActive: boolean;
|
|
deletedAt: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
ownerId: number;
|
|
isPrivate: boolean;
|
|
};
|
|
} & {
|
|
origin: string | null;
|
|
id: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
productId: number;
|
|
quantity: import("@prisma/client/runtime/library").Decimal;
|
|
unit: string;
|
|
brand: string | null;
|
|
receiptName: string | null;
|
|
location: string | null;
|
|
purchaseDate: Date | null;
|
|
opened: boolean | null;
|
|
suitableFor: string | null;
|
|
bestBeforeDate: Date | null;
|
|
comment: string | null;
|
|
}>;
|
|
remove(id: number): Promise<{
|
|
origin: string | null;
|
|
id: number;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
productId: number;
|
|
quantity: import("@prisma/client/runtime/library").Decimal;
|
|
unit: string;
|
|
brand: string | null;
|
|
receiptName: string | null;
|
|
location: string | null;
|
|
purchaseDate: Date | null;
|
|
opened: boolean | null;
|
|
suitableFor: string | null;
|
|
bestBeforeDate: Date | null;
|
|
comment: string | null;
|
|
}>;
|
|
}
|