- 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.
21 lines
535 B
JavaScript
21 lines
535 B
JavaScript
import mongoose from 'mongoose';
|
|
|
|
const userSchema = new mongoose.Schema(
|
|
{
|
|
username: { required: true, type: String },
|
|
name: { required: true, type: String },
|
|
firstName: { required: false, type: String },
|
|
lastName: { required: false, type: String },
|
|
email: { required: true, type: String },
|
|
},
|
|
{ timestamps: true }
|
|
);
|
|
|
|
userSchema.virtual('id').get(function () {
|
|
return this._id.toHexString();
|
|
});
|
|
|
|
userSchema.set('toJSON', { virtuals: true });
|
|
|
|
export const userModel = mongoose.model('user', userSchema);
|