-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
24 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import mongoose from 'mongoose'; | ||
import mongoose from 'mongoose' | ||
|
||
import config from './config'; | ||
import config from './config' | ||
|
||
const MongoConnect = async () => { | ||
if (mongoose.connections[0].readyState) return; | ||
const MongoConnect = async (): Promise<void> => { | ||
if (mongoose.connections[0].readyState) return | ||
|
||
await mongoose | ||
.connect(config.db.url, { | ||
...config.db.options, | ||
dbName: config.db.name, | ||
}) | ||
.catch((error) => { | ||
console.error('Database connection failed. 👇🏼'); | ||
console.error(' > ' + error); | ||
console.error('Database connection failed. 👇🏼') | ||
console.error(' > ' + error) | ||
|
||
throw error; | ||
}); | ||
}; | ||
throw error | ||
}) | ||
} | ||
|
||
export default MongoConnect; | ||
export default MongoConnect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import mongoose, { Schema, Document } from 'mongoose'; | ||
import mongoose, { Schema, Document } from 'mongoose' | ||
|
||
const MessageResponseSchema : Schema = new Schema({ | ||
const MessageResponseSchema: Schema = new Schema({ | ||
accountID: { type: String, required: true }, | ||
chatBotMessageID: { type: String, required: true }, | ||
response: { type: String, required: true }, | ||
}); | ||
}) | ||
|
||
export interface IMessageResponse extends Document { | ||
accountID: string; | ||
chatBotMessageID: string; | ||
response: string; | ||
accountID: string | ||
chatBotMessageID: string | ||
response: string | ||
} | ||
|
||
export default mongoose.model<IMessageResponse>('MessageResponse', MessageResponseSchema); | ||
export default mongoose.model<IMessageResponse>('MessageResponse', MessageResponseSchema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters