init
This commit is contained in:
commit
04267b3886
100 changed files with 16495 additions and 0 deletions
20
backend/src/models/Item.ts
Normal file
20
backend/src/models/Item.ts
Normal 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);
|
Loading…
Add table
Add a link
Reference in a new issue