46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import mongoose, { Document, Schema } from 'mongoose';
|
|
import MainModel from '../../connect/mongoose';
|
|
// Interface for TypeScript with PascalCase
|
|
export interface wallitems extends Document {
|
|
modeluuid: string;
|
|
modelname: string
|
|
type: string
|
|
csgposition: []
|
|
csgscale: []
|
|
position: []
|
|
quaternion: []
|
|
scale: []
|
|
|
|
|
|
}
|
|
|
|
// Define the Mongoose Schema
|
|
const wallItemsSchema: Schema = new Schema({
|
|
modeluuid: { type: String,unique:true },
|
|
modelname: { type: String},
|
|
type: { type: String },
|
|
csgposition: { type: Array},
|
|
csgscale: { type: Array,},
|
|
position: { type: Array },
|
|
quaternion: { type: Array},
|
|
scale: { type: Array}
|
|
});
|
|
|
|
// const wallItenmModel = (db: string) => {
|
|
// const mongoUrl = process.env.MONGO_URI || '';
|
|
// if (!mongoUrl) {
|
|
// throw new Error('MONGO_URI environment variable is not set');
|
|
// }
|
|
// // Connect to the database
|
|
// const dbConnection = mongoose.createConnection(mongoUrl, {
|
|
// dbName: db, // Specify the database name here
|
|
// serverSelectionTimeoutMS: 30000,
|
|
// });
|
|
// return dbConnection.model<wallitenms>('wallitenms', wallItenmsSchema, `wallitenms`);
|
|
// }
|
|
|
|
// export default wallItenmModel;
|
|
const wallItenmModel = (db:string) => {
|
|
return MainModel(db, "wallitems", wallItemsSchema, "wallitems")
|
|
};
|
|
export default wallItenmModel; |