add mongo adapter via mongoose

This commit is contained in:
Thomas Ruoff
2021-10-27 00:43:25 +02:00
committed by Thomas Ruoff
parent c2bd8f8d01
commit 8dd0c7b9b2
2 changed files with 29 additions and 22 deletions

View File

@@ -3,11 +3,11 @@ import BookingModel, { Booking, BookingDocument } from './booking'
import BillModel, { Bill } from './bill'
import { BOOKING_STATUS } from './enums'
let connectedPromise: Promise<typeof mongoose>
let connectedPromise: Promise<mongoose.Mongoose>
function connect(): Promise<typeof mongoose> {
export function connect(): Promise<mongoose.Mongoose> {
if (connectedPromise) {
return
return connectedPromise
}
connectedPromise = mongoose.connect(process.env.MONGO_URI, {