diff --git a/build.gradle.kts b/build.gradle.kts index 085857b..a4d4fb2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -54,10 +54,11 @@ dependencies { testImplementation("io.projectreactor:reactor-test") // Detekt plugins detektPlugins ("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.0") - // User Model + // HRV-Mart implementation("com.hrv.mart:user-library:0.0.3") - // API-Call implementation("com.hrv.mart:api-call:0.0.3") + // Mongo-DB + implementation("org.springframework.boot:spring-boot-starter-data-mongodb-reactive") } tasks.withType { diff --git a/src/main/kotlin/com/hrv/mart/authlibrary/model/Auth.kt b/src/main/kotlin/com/hrv/mart/authlibrary/model/AppWriteAuth.kt similarity index 74% rename from src/main/kotlin/com/hrv/mart/authlibrary/model/Auth.kt rename to src/main/kotlin/com/hrv/mart/authlibrary/model/AppWriteAuth.kt index f48df62..7ffb309 100644 --- a/src/main/kotlin/com/hrv/mart/authlibrary/model/Auth.kt +++ b/src/main/kotlin/com/hrv/mart/authlibrary/model/AppWriteAuth.kt @@ -2,17 +2,17 @@ package com.hrv.mart.authlibrary.model import com.hrv.mart.userlibrary.model.User -data class Auth ( +data class AppWriteAuth ( + val userId: String, val createdAt: String, val updatedAt: String, val name: String, val email: String, - val emailVerification: Boolean, - val userType: UserType = UserType.USER + val emailVerification: Boolean ) { fun toUser() = User( emailId = email, name = name ) -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthResponse.kt b/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthResponse.kt index 2a4832c..67443f6 100644 --- a/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthResponse.kt +++ b/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthResponse.kt @@ -3,4 +3,4 @@ package com.hrv.mart.authlibrary.model data class AuthResponse ( val userId: String, val userType: UserType -) \ No newline at end of file +) diff --git a/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthWithUserType.kt b/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthWithUserType.kt new file mode 100644 index 0000000..bf0a52d --- /dev/null +++ b/src/main/kotlin/com/hrv/mart/authlibrary/model/AuthWithUserType.kt @@ -0,0 +1,17 @@ +package com.hrv.mart.authlibrary.model + +import org.springframework.data.mongodb.core.mapping.Document + +@Document +data class AuthWithUserType ( + val userId: String, + val userType: UserType +) { + companion object { + fun parseFrom(auth: AppWriteAuth, userType: UserType) = + AuthWithUserType( + userId = auth.userId, + userType = userType + ) + } +} diff --git a/src/main/kotlin/com/hrv/mart/authlibrary/model/UserType.kt b/src/main/kotlin/com/hrv/mart/authlibrary/model/UserType.kt index 22d84d8..9d0baf7 100644 --- a/src/main/kotlin/com/hrv/mart/authlibrary/model/UserType.kt +++ b/src/main/kotlin/com/hrv/mart/authlibrary/model/UserType.kt @@ -2,4 +2,4 @@ package com.hrv.mart.authlibrary.model enum class UserType { USER, ADMIN -} \ No newline at end of file +}