This commit is contained in:
StefanoPutelli 2025-06-28 16:01:31 +02:00
commit 04267b3886
100 changed files with 16495 additions and 0 deletions

View file

@ -0,0 +1,20 @@
import { Schema, model, Document, Types } from 'mongoose';
import { ITag } from './Tag.js';
export interface IItem extends Document {
name: string;
description: string;
tags: Types.Array<ITag['_id']>;
dateAdded: Date;
addedBy: string;
}
const itemSchema = new Schema<IItem>({
name: { type: String, required: true },
description: { type: String, required: true },
tags: [{ type: Schema.Types.ObjectId, ref: 'Tag' }],
dateAdded: { type: Date, default: Date.now },
addedBy: { type: String }
});
export default model<IItem>('Item', itemSchema);