diff --git a/src/main/kotlin/com/piashcse/models/user/body/LoginBody.kt b/src/main/kotlin/com/piashcse/models/user/body/LoginBody.kt index c925713..fa3034f 100644 --- a/src/main/kotlin/com/piashcse/models/user/body/LoginBody.kt +++ b/src/main/kotlin/com/piashcse/models/user/body/LoginBody.kt @@ -12,7 +12,7 @@ data class LoginBody( val password: String, val userType: String ) { - fun validate() { + fun validation() { validate(this) { validate(LoginBody::email).isNotNull().isEmail() validate(LoginBody::password).isNotNull().hasSize(4, 10) diff --git a/src/main/kotlin/com/piashcse/plugins/ConfigureRequestValidation.kt b/src/main/kotlin/com/piashcse/plugins/ConfigureRequestValidation.kt index ede6c3b..9942183 100644 --- a/src/main/kotlin/com/piashcse/plugins/ConfigureRequestValidation.kt +++ b/src/main/kotlin/com/piashcse/plugins/ConfigureRequestValidation.kt @@ -18,7 +18,7 @@ import io.ktor.server.plugins.requestvalidation.* fun Application.configureRequestValidation() { install(RequestValidation) { validate { login -> - login.validate() + login.validation() ValidationResult.Valid } validate { productCategory -> diff --git a/src/main/kotlin/com/piashcse/route/ProductRoute.kt b/src/main/kotlin/com/piashcse/route/ProductRoute.kt index 84d50f3..694d9a7 100644 --- a/src/main/kotlin/com/piashcse/route/ProductRoute.kt +++ b/src/main/kotlin/com/piashcse/route/ProductRoute.kt @@ -197,7 +197,7 @@ fun Route.productRoute(productController: ProductController) { ) ) } - post("photo-upload", { + post("image-upload", { tags("Product") request { queryParameter("id") { diff --git a/src/main/kotlin/com/piashcse/route/UserProfileRoute.kt b/src/main/kotlin/com/piashcse/route/UserProfileRoute.kt index c0b99f9..f5fcc15 100644 --- a/src/main/kotlin/com/piashcse/route/UserProfileRoute.kt +++ b/src/main/kotlin/com/piashcse/route/UserProfileRoute.kt @@ -75,7 +75,7 @@ fun Route.userProfileRoute(userProfileController: UserProfileController) { ) } - post("photo-upload",{ + post("image-upload",{ tags("User") request { multipartBody { diff --git a/src/main/kotlin/com/piashcse/route/UserRoute.kt b/src/main/kotlin/com/piashcse/route/UserRoute.kt index 4606b32..c452f6f 100644 --- a/src/main/kotlin/com/piashcse/route/UserRoute.kt +++ b/src/main/kotlin/com/piashcse/route/UserRoute.kt @@ -30,7 +30,7 @@ fun Route.userRoute(userController: UserController) { val requestBody = call.receive() call.respond( ApiResponse.success( - userController.login(LoginBody(requestBody.email, requestBody.password, requestBody.userType)), + userController.login(requestBody), HttpStatusCode.OK ) )