Skip to content

Commit cd58b24

Browse files
style: improve style in mongo client
1 parent a1d9f90 commit cd58b24

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/kotlin/infrastructure/database/MongoClient.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ class MongoClient : UserDatabaseManager, HealthProfessionalDatabaseManager {
2929
}
3030
}
3131

32-
companion object {
33-
/** The name of the database. */
34-
const val databaseName = "user_management"
35-
}
32+
private val client =
33+
KMongo.createClient(System.getenv("USER_MANAGEMENT_MONGODB_URL"))
3634

37-
private val client = KMongo.createClient(System.getenv("USER_MANAGEMENT_MONGODB_URL"))
3835
private val userCollection =
3936
client.getDatabase(databaseName).getCollection<User>("users")
37+
4038
private val healthProfessionalCollection =
4139
client.getDatabase(databaseName).getCollection<HealthProfessional>("health_professionals")
4240

@@ -66,4 +64,9 @@ class MongoClient : UserDatabaseManager, HealthProfessionalDatabaseManager {
6664

6765
override fun getHealthProfessional(healthProfessionalId: String): HealthProfessional? =
6866
healthProfessionalCollection.findOne(HealthProfessional::healthProfessionalId eq healthProfessionalId)
67+
68+
companion object {
69+
/** The name of the database. */
70+
const val databaseName = "user_management"
71+
}
6972
}

0 commit comments

Comments
 (0)