feat(inventory): support line-based assignments and movements

This commit is contained in:
2026-06-19 01:05:33 +02:00
parent 8e6a00c2a9
commit 6d34a2f74f
17 changed files with 713 additions and 189 deletions
+10
View File
@@ -37,6 +37,14 @@ function isUniqueConstraintError(error: unknown) {
)
}
function buildSkuFromName(name: string) {
return name
.trim()
.toUpperCase()
.replace(/[^A-Z0-9]+/g, "-")
.replace(/^-|-$/g, "")
}
export async function createItemUseCase(
input: CreateItemUseCaseInput,
): Promise<ItemUseCaseResult> {
@@ -58,7 +66,9 @@ export async function createItemUseCase(
const item = await ItemService.create(
{
sku: buildSkuFromName(name),
name,
trackingType: "QUANTITY",
category: { connect: { id: categoryId } },
stock: stock || 0,
},