From 00a837e6f874810df50dc36968005b664a0ed0e7 Mon Sep 17 00:00:00 2001 From: Cristian Date: Sat, 10 Dec 2022 21:04:13 +0100 Subject: [PATCH] Format code with ktlint --- .../src/main/kotlin/com/example/data/entity/TempAuth.kt | 1 - .../src/main/kotlin/com/example/data/entity/UserEntity.kt | 1 - .../kotlin/com/example/data/repository/MailRepository.kt | 7 +++---- .../com/example/data/repository/TempAuthRepository.kt | 2 -- backend/src/main/kotlin/com/example/di/DatabaseModule.kt | 2 +- backend/src/main/kotlin/com/example/di/RepositoryModule.kt | 4 ++-- .../src/main/kotlin/com/example/domain/model/UserModel.kt | 4 ++-- .../kotlin/com/example/domain/usecase/RegisterUseCase.kt | 1 - .../com/example/server/environment/EnvironmentVar.kt | 1 - .../src/main/kotlin/com/example/server/route/UserRoute.kt | 1 - backend/src/test/kotlin/com/example/utils/StringExt.kt | 3 +-- 11 files changed, 9 insertions(+), 18 deletions(-) diff --git a/backend/src/main/kotlin/com/example/data/entity/TempAuth.kt b/backend/src/main/kotlin/com/example/data/entity/TempAuth.kt index 12f0b2c..35a63b8 100644 --- a/backend/src/main/kotlin/com/example/data/entity/TempAuth.kt +++ b/backend/src/main/kotlin/com/example/data/entity/TempAuth.kt @@ -38,5 +38,4 @@ class TempAuthEntity(id: EntityID) : UUIDEntity(id) { fun toModel(): TempAuthModel = TempAuthModel(id.toString(), expiration, user.toModel()) - } diff --git a/backend/src/main/kotlin/com/example/data/entity/UserEntity.kt b/backend/src/main/kotlin/com/example/data/entity/UserEntity.kt index 02f2f75..f6d1a77 100644 --- a/backend/src/main/kotlin/com/example/data/entity/UserEntity.kt +++ b/backend/src/main/kotlin/com/example/data/entity/UserEntity.kt @@ -23,7 +23,6 @@ import org.jetbrains.exposed.dao.UUIDEntity import org.jetbrains.exposed.dao.UUIDEntityClass import org.jetbrains.exposed.dao.id.EntityID import org.jetbrains.exposed.dao.id.UUIDTable -import org.jetbrains.exposed.sql.booleanParam import org.jetbrains.exposed.sql.javatime.date import org.jetbrains.exposed.sql.javatime.timestamp import java.util.* diff --git a/backend/src/main/kotlin/com/example/data/repository/MailRepository.kt b/backend/src/main/kotlin/com/example/data/repository/MailRepository.kt index a9ebeed..1bd8bcb 100644 --- a/backend/src/main/kotlin/com/example/data/repository/MailRepository.kt +++ b/backend/src/main/kotlin/com/example/data/repository/MailRepository.kt @@ -26,9 +26,9 @@ class MailRepository( private val mainGunMessagesApi: com.mailgun.api.v3.MailgunMessagesApi ) { - - fun sendMessageConfirmMail(tempAuth:TempAuthModel){ - mainGunMessagesApi.sendMessage(environmentVar.emailApi, + fun sendMessageConfirmMail(tempAuth: TempAuthModel) { + mainGunMessagesApi.sendMessage( + environmentVar.emailApi, Message.builder() .from("Test <${environmentVar.emailApi}>") .to(tempAuth.user.email) @@ -46,5 +46,4 @@ class MailRepository( .build() ) } - } diff --git a/backend/src/main/kotlin/com/example/data/repository/TempAuthRepository.kt b/backend/src/main/kotlin/com/example/data/repository/TempAuthRepository.kt index 52547fa..9c0bb9f 100644 --- a/backend/src/main/kotlin/com/example/data/repository/TempAuthRepository.kt +++ b/backend/src/main/kotlin/com/example/data/repository/TempAuthRepository.kt @@ -21,7 +21,6 @@ import com.example.data.entity.TempAuthEntity import com.example.data.entity.UserEntity import com.example.domain.model.UserModel import com.example.server.environment.EnvironmentVar -import com.mailgun.model.message.Message import org.jetbrains.exposed.sql.transactions.transaction import java.time.Instant import java.util.* @@ -42,5 +41,4 @@ class TempAuthRepository( transaction { TempAuthEntity.findById(UUID.fromString(id))?.toModel() } - } diff --git a/backend/src/main/kotlin/com/example/di/DatabaseModule.kt b/backend/src/main/kotlin/com/example/di/DatabaseModule.kt index 4a00612..0351121 100644 --- a/backend/src/main/kotlin/com/example/di/DatabaseModule.kt +++ b/backend/src/main/kotlin/com/example/di/DatabaseModule.kt @@ -45,6 +45,6 @@ val databaseModule = module { single { val environmentVar = get() MailgunClient.config(environmentVar.mailgunApi) - .createAsyncApi( com.mailgun.api.v3.MailgunMessagesApi::class.java) + .createAsyncApi(com.mailgun.api.v3.MailgunMessagesApi::class.java) } } diff --git a/backend/src/main/kotlin/com/example/di/RepositoryModule.kt b/backend/src/main/kotlin/com/example/di/RepositoryModule.kt index e5e7426..fb5e0fb 100644 --- a/backend/src/main/kotlin/com/example/di/RepositoryModule.kt +++ b/backend/src/main/kotlin/com/example/di/RepositoryModule.kt @@ -17,10 +17,10 @@ package com.example.di -import com.example.data.repository.StorageRepository -import com.example.data.repository.UserRepository import com.example.data.repository.MailRepository +import com.example.data.repository.StorageRepository import com.example.data.repository.TempAuthRepository +import com.example.data.repository.UserRepository import org.koin.core.module.dsl.singleOf import org.koin.dsl.module diff --git a/backend/src/main/kotlin/com/example/domain/model/UserModel.kt b/backend/src/main/kotlin/com/example/domain/model/UserModel.kt index 1584424..6ac90fb 100644 --- a/backend/src/main/kotlin/com/example/domain/model/UserModel.kt +++ b/backend/src/main/kotlin/com/example/domain/model/UserModel.kt @@ -34,9 +34,9 @@ data class UserModel( val height: Int, val birthday: LocalDate, val country: String, - val role:RoleType, + val role: RoleType, val refreshToken: String, val expirationRefreshToken: Instant, - val isEmailValidated:Boolean, + val isEmailValidated: Boolean, var profileImage: MultimediaModel? ) : Principal diff --git a/backend/src/main/kotlin/com/example/domain/usecase/RegisterUseCase.kt b/backend/src/main/kotlin/com/example/domain/usecase/RegisterUseCase.kt index 4ac9f4c..81b0aa5 100644 --- a/backend/src/main/kotlin/com/example/domain/usecase/RegisterUseCase.kt +++ b/backend/src/main/kotlin/com/example/domain/usecase/RegisterUseCase.kt @@ -27,7 +27,6 @@ import com.example.data.repository.UserRepository import com.example.domain.exception.EmailRegisteredException import com.example.domain.model.GenderModel import com.example.domain.model.SessionModel -import com.example.domain.model.TempAuthModel import com.example.server.dto.request.RegisterRequestDTO import com.example.server.environment.EnvironmentVar import java.time.LocalDate diff --git a/backend/src/main/kotlin/com/example/server/environment/EnvironmentVar.kt b/backend/src/main/kotlin/com/example/server/environment/EnvironmentVar.kt index d5ba51b..538b797 100644 --- a/backend/src/main/kotlin/com/example/server/environment/EnvironmentVar.kt +++ b/backend/src/main/kotlin/com/example/server/environment/EnvironmentVar.kt @@ -78,7 +78,6 @@ class EnvironmentVar { val mailgunApi: String get() = getString("MAIL_GUN_API") - /* This email will be used to send the confirmation email to the user. */ val emailApi: String get() = getString("EMAIL_API") diff --git a/backend/src/main/kotlin/com/example/server/route/UserRoute.kt b/backend/src/main/kotlin/com/example/server/route/UserRoute.kt index 2cde323..dc53424 100644 --- a/backend/src/main/kotlin/com/example/server/route/UserRoute.kt +++ b/backend/src/main/kotlin/com/example/server/route/UserRoute.kt @@ -71,7 +71,6 @@ class UserRoute( } } } - } companion object { diff --git a/backend/src/test/kotlin/com/example/utils/StringExt.kt b/backend/src/test/kotlin/com/example/utils/StringExt.kt index 3680516..ee2edb9 100644 --- a/backend/src/test/kotlin/com/example/utils/StringExt.kt +++ b/backend/src/test/kotlin/com/example/utils/StringExt.kt @@ -3,7 +3,6 @@ package com.example.utils import java.util.regex.Matcher import java.util.regex.Pattern - fun String.extractUrls(): List? { val containedUrls: MutableList = ArrayList() val urlRegex = "((https?|ftp|gopher|telnet|file):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*)" @@ -18,4 +17,4 @@ fun String.extractUrls(): List? { ) } return containedUrls -} \ No newline at end of file +}