finito spero

This commit is contained in:
StefanoPutelli 2025-06-28 16:31:34 +02:00
parent 3ea07942c6
commit 54d4faca9d
12 changed files with 7315 additions and 70 deletions

View file

@ -5,6 +5,7 @@ export interface IItem extends Document {
name: string;
description: string;
tags: Types.Array<ITag['_id']>;
quantity: number; // ← nuovo
dateAdded: Date;
addedBy: string;
}
@ -13,8 +14,9 @@ const itemSchema = new Schema<IItem>({
name: { type: String, required: true },
description: { type: String, required: true },
tags: [{ type: Schema.Types.ObjectId, ref: 'Tag' }],
quantity: { type: Number, default: 0, min: 0 }, // default 0, mai negativo
dateAdded: { type: Date, default: Date.now },
addedBy: { type: String }
addedBy: { type: String },
});
export default model<IItem>('Item', itemSchema);