- Introduced new schemas for managing inventory, including filamentStock, partStock, stockAudit, stockEvent, and their respective models. - Added management schemas for user, vendor, material, and various document types to enhance data structure and organization. - Implemented necessary fields and relationships to support inventory tracking and management functionalities.
17 lines
449 B
JavaScript
17 lines
449 B
JavaScript
import mongoose from 'mongoose';
|
|
|
|
const materialSchema = new mongoose.Schema({
|
|
name: { required: true, type: String },
|
|
url: { required: false, type: String },
|
|
image: { required: false, type: Buffer },
|
|
tags: [{ type: String }],
|
|
});
|
|
|
|
materialSchema.virtual('id').get(function () {
|
|
return this._id.toHexString();
|
|
});
|
|
|
|
materialSchema.set('toJSON', { virtuals: true });
|
|
|
|
export const materialModel = mongoose.model('material', materialSchema);
|