Skip to content

Commit a606c49

Browse files
committed
common modules update
1 parent 5bf2498 commit a606c49

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

  • examples_new/microservices/auth/src/models
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
import { DbConnectionError,errorHandler } from "@chronosrx/common";
1+
import { DbConnectionError, errorHandler } from '@chronosrx/common';
22
const mongoose = require('mongoose');
33
require('dotenv').config();
44

55
const MONGO_URI = process.env.MONGO_URI;
66

77
mongoose
8-
.connect(MONGO_URI,{
8+
.connect(MONGO_URI, {
99
useNewUrlParser: true,
1010
useUnifiedTopology: true,
11-
})
12-
.then(()=>console.log(`Connected to MongoDB Database`))
13-
.catch((err)=> {throw new DbConnectionError()} );
11+
})
12+
.then(() => console.log(`Connected to MongoDB Database`))
13+
.catch(err => {
14+
throw new DbConnectionError();
15+
});
1416

1517
const Schema = mongoose.Schema;
16-
const
18+
const UserSchema = new Schema({
19+
username: { type: String, require: true },
20+
password: { type: String, require: true },
21+
});
22+
23+
const User = mongoose.model('User', UserSchema);
24+
25+
module.exports = { User };

0 commit comments

Comments
 (0)