const mongoose = require('mongoose'); // Define schema for position data const positionSchema = new mongoose.Schema({ X: Number, Y: Number, Z: Number }, { _id: false }); // Define schema for AutoCAD events const autocadEventSchema = new mongoose.Schema({ EventType: { type: String, required: true, enum: ['Added', 'Modified', 'Deleted', 'Stretched'] }, ObjectId: { type: String, required: true }, ObjectType: { type: String, required: true }, Position: positionSchema, OldPosition: positionSchema, NewPosition: positionSchema, Command: String, // Store command information Timestamp: { type: Date, required: true }, receivedAt: { type: Date, default: Date.now } }); module.exports = mongoose.model('AutocadEvent', autocadEventSchema);