- 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.
34 lines
686 B
JavaScript
34 lines
686 B
JavaScript
import mongoose from 'mongoose';
|
|
const { Schema } = mongoose;
|
|
|
|
const documentSizeSchema = new Schema(
|
|
{
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
unique: true,
|
|
},
|
|
width: {
|
|
type: Number,
|
|
required: true,
|
|
default: 0,
|
|
},
|
|
height: {
|
|
type: Number,
|
|
required: true,
|
|
default: 0,
|
|
},
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
// Add virtual id getter
|
|
documentSizeSchema.virtual('id').get(function () {
|
|
return this._id.toHexString();
|
|
});
|
|
|
|
// Configure JSON serialization to include virtuals
|
|
documentSizeSchema.set('toJSON', { virtuals: true });
|
|
|
|
export const documentSizeModel = mongoose.model('documentSize', documentSizeSchema);
|