@drax/identity-back 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,43 +0,0 @@
1
- import {mongoose} from '@drax/common-back';
2
- import { MongoMemoryServer } from 'mongodb-memory-server';
3
-
4
- let mongoServer
5
-
6
- class MongoInMemory{
7
-
8
- static async connect(){
9
- mongoServer = await MongoMemoryServer.create();
10
- if(mongoServer.state == "new"){
11
- await mongoServer.start()
12
- }
13
- if(!mongoose.connection.readyState){
14
- await mongoose.connect(mongoServer.getUri(), { dbName: "verifyMASTER" });
15
- }
16
- return
17
- }
18
- static get mongooseStatus(){
19
- return mongoose.connection.readyState
20
- }
21
-
22
- static get serverStatus(){
23
- return mongoServer.state
24
- }
25
-
26
- static get status(){
27
- return mongoose.connection.readyState
28
- }
29
-
30
- static async disconnect(){
31
- await mongoose.disconnect();
32
- }
33
-
34
- static async DropAndClose(){
35
- if (mongoServer) {
36
- await mongoose.connection.dropDatabase();
37
- await mongoose.connection.close();
38
- await mongoServer.stop();
39
- }
40
- }
41
- }
42
-
43
- export default MongoInMemory