From ab0a56c22beefbca7c7870ddd8eb45f558a2f594 Mon Sep 17 00:00:00 2001 From: Kiselev Danil Date: Mon, 14 Aug 2023 18:43:19 +0600 Subject: [PATCH 1/3] [+] add path param to updateUser request --- .../effective/features/user/routes/swagger/UserSwagger.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt index 79c0cdfa..c25d3ff2 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt @@ -153,6 +153,12 @@ fun SwaggerDocument.updateUser(): OpenApiRoute.() -> Unit = { description = "Changes user by id" tags = listOf("users") request { + pathParameter("user_id") { + description = "User id" + example = "87e66ee0-2550-4188-8d79-75560125836a" + required = true + allowEmptyValue = false + } body { example( "User", -- GitLab From 968b7bb92e7bb6900a89a122e8e110f9bf7c46c4 Mon Sep 17 00:00:00 2001 From: Kiselev Danil Date: Mon, 14 Aug 2023 18:50:09 +0600 Subject: [PATCH 2/3] [~] make request budy required in updateUser request --- .../office/effective/features/user/routes/swagger/UserSwagger.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt index c25d3ff2..d4eb7206 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/user/routes/swagger/UserSwagger.kt @@ -160,6 +160,7 @@ fun SwaggerDocument.updateUser(): OpenApiRoute.() -> Unit = { allowEmptyValue = false } body { + required = true example( "User", UserDTO( -- GitLab From 26567d21ec7158f0fb3a6407ab8ab0405b585470 Mon Sep 17 00:00:00 2001 From: Daniil Zavyalov Date: Mon, 14 Aug 2023 20:55:46 +0600 Subject: [PATCH 3/3] [~] hotfix booking and workspaces --- .../effective/features/booking/routes/swagger/BookingSwagger.kt | 2 +- .../office/effective/features/booking/service/BookingService.kt | 1 + .../features/workspace/repository/WorkspaceRepository.kt | 1 - .../effective/features/workspace/routes/WorkspaceRouting.kt | 2 +- .../features/workspace/routes/swagger/WorkspaceSwagger.kt | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/routes/swagger/BookingSwagger.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/routes/swagger/BookingSwagger.kt index a5b37d72..fac4b719 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/routes/swagger/BookingSwagger.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/routes/swagger/BookingSwagger.kt @@ -172,7 +172,7 @@ fun SwaggerDocument.deleteBookingById(): OpenApiRoute.() -> Unit = { description = "Deletes a booking with the given id. If the booking is not found in the database it is silently ignored" tags = listOf("bookings") request { - queryParameter("id") { + pathParameter("id") { description = "Booking id" example = "c48c2a3d-bbfd-4801-b121-973ae3cf4cd9" required = true diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/service/BookingService.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/service/BookingService.kt index d9d41ff5..aeebc99c 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/service/BookingService.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/booking/service/BookingService.kt @@ -97,6 +97,7 @@ class BookingService( else -> bookingRepository.findAll() } + if (bookingList.isEmpty()) return bookingList return findIntegrationsAndUtilities(bookingList) } diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/repository/WorkspaceRepository.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/repository/WorkspaceRepository.kt index c77ed407..dfe4beb1 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/repository/WorkspaceRepository.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/repository/WorkspaceRepository.kt @@ -2,7 +2,6 @@ package office.effective.features.workspace.repository import office.effective.common.exception.InstanceNotFoundException import office.effective.features.booking.repository.WorkspaceBooking -import office.effective.features.user.repository.UserEntity import office.effective.features.workspace.converters.WorkspaceRepositoryConverter import office.effective.model.Utility import office.effective.model.Workspace diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/WorkspaceRouting.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/WorkspaceRouting.kt index e0e0b381..f9be129a 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/WorkspaceRouting.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/WorkspaceRouting.kt @@ -22,7 +22,7 @@ fun Route.workspaceRouting() { call.respond(facade.findById(id)) } get(SwaggerDocument.returnWorkspaceByTag()) { - val tag: String = call.request.queryParameters["tag"] + val tag: String = call.request.queryParameters["workspace_tag"] ?: return@get call.respond(HttpStatusCode.BadRequest) val freeFrom: String? = call.request.queryParameters["free_from"] diff --git a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/swagger/WorkspaceSwagger.kt b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/swagger/WorkspaceSwagger.kt index 10fca709..4f0a9f0a 100644 --- a/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/swagger/WorkspaceSwagger.kt +++ b/effectiveOfficeBackend/src/main/kotlin/office/effective/features/workspace/routes/swagger/WorkspaceSwagger.kt @@ -54,7 +54,7 @@ fun SwaggerDocument.returnWorkspaceByTag(): OpenApiRoute.() -> Unit = { description = "Return all workspaces by tag" tags = listOf("workspaces") request { - queryParameter("tag") { + queryParameter("workspace_tag") { description = "Workspace tag" example = "meeting" required = true -- GitLab