refactor(inventory): remove unused fields from InventoryItem and update related DTOs

This commit is contained in:
Nils-Johan Gynther
2026-04-18 09:01:14 +02:00
parent 6cec7ca6dd
commit fd188a3f95
9 changed files with 69 additions and 143 deletions
@@ -1,6 +1,5 @@
import {
IsBoolean,
IsInt,
IsNumber,
IsOptional,
IsString,
@@ -22,10 +21,6 @@ export class CreateInventoryDto {
@IsString()
location?: string;
@IsOptional()
@IsInt()
priority?: number;
@IsOptional()
purchaseDate?: string;
@@ -44,30 +39,10 @@ export class CreateInventoryDto {
@IsBoolean()
opened?: boolean;
@IsOptional()
@IsString()
shelfNote?: string;
@IsOptional()
@IsString()
suitableFor?: string;
@IsOptional()
@IsBoolean()
isOnSale?: boolean;
@IsOptional()
@IsInt()
priceLevel?: number;
@IsOptional()
@IsString()
proteinType?: string;
@IsOptional()
@IsBoolean()
isLeftover?: boolean;
@IsOptional()
@IsString()
comment?: string;
@@ -1,6 +1,5 @@
import {
IsBoolean,
IsInt,
IsNumber,
IsOptional,
IsString,
@@ -25,10 +24,6 @@ export class UpdateInventoryDto {
@IsString()
location?: string;
@IsOptional()
@IsInt()
priority?: number;
@IsOptional()
purchaseDate?: string;
@@ -47,30 +42,10 @@ export class UpdateInventoryDto {
@IsBoolean()
opened?: boolean;
@IsOptional()
@IsString()
shelfNote?: string;
@IsOptional()
@IsString()
suitableFor?: string;
@IsOptional()
@IsBoolean()
isOnSale?: boolean;
@IsOptional()
@IsInt()
priceLevel?: number;
@IsOptional()
@IsString()
proteinType?: string;
@IsOptional()
@IsBoolean()
isLeftover?: boolean;
@IsOptional()
@IsString()
comment?: string;
@@ -206,10 +206,6 @@ export class InventoryService {
updateData.receiptName = data.receiptName.trim();
}
if (typeof data.priority === 'number') {
updateData.priority = data.priority;
}
if (typeof data.purchaseDate === 'string') {
updateData.purchaseDate = data.purchaseDate
? new Date(data.purchaseDate)
@@ -226,30 +222,10 @@ export class InventoryService {
updateData.opened = data.opened;
}
if (typeof data.shelfNote === 'string') {
updateData.shelfNote = data.shelfNote.trim();
}
if (typeof data.suitableFor === 'string') {
updateData.suitableFor = data.suitableFor.trim();
}
if (typeof data.isOnSale === 'boolean') {
updateData.isOnSale = data.isOnSale;
}
if (typeof data.priceLevel === 'number') {
updateData.priceLevel = data.priceLevel;
}
if (typeof data.proteinType === 'string') {
updateData.proteinType = data.proteinType.trim();
}
if (typeof data.isLeftover === 'boolean') {
updateData.isLeftover = data.isLeftover;
}
if (typeof data.comment === 'string') {
updateData.comment = data.comment.trim();
}