42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
// import { getModelForClass, mongoose } from '@typegoose/typegoose'
|
|
// import { config } from 'dotenv'
|
|
// import { ConnectionBase } from 'mongoose'
|
|
// import * as APP from '../src/app.config.mjs'
|
|
// import { CategoryModel } from '../src/modules/category/category.model'
|
|
// import { NoteModel } from '../src/modules/note/note.model'
|
|
// import { PostModel } from '../src/modules/post/post.model'
|
|
// const env = config().parsed || {}
|
|
// const url = APP.MONGO_DB.uri
|
|
|
|
// const opt = {
|
|
// useCreateIndex: true,
|
|
// useFindAndModify: false,
|
|
// useNewUrlParser: true,
|
|
// useUnifiedTopology: true,
|
|
// autoIndex: true,
|
|
// }
|
|
// mongoose.connect(url, opt)
|
|
// const post = getModelForClass(PostModel)
|
|
// const note = getModelForClass(NoteModel)
|
|
// const category = getModelForClass(CategoryModel)
|
|
|
|
// const Config = {
|
|
// env,
|
|
// db: (mongoose.connection as any).client.db(
|
|
// APP.MONGO_DB.collectionName,
|
|
// ) as ConnectionBase,
|
|
// models: {
|
|
// post,
|
|
// note,
|
|
// category,
|
|
// },
|
|
// }
|
|
// async function bootstrap(cb: (config: typeof Config) => any) {
|
|
// await cb.call(this, Config)
|
|
|
|
// mongoose.disconnect()
|
|
// process.exit()
|
|
// }
|
|
|
|
// export { bootstrap as patch }
|