-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: Port resourceinfo endpoint to tapir and remove code/zio-ht…
- Loading branch information
Showing
23 changed files
with
366 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
webapi/src/main/scala/org/knora/webapi/core/HttpServerZ.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
webapi/src/main/scala/org/knora/webapi/slice/resourceinfo/ResourceInfoLayers.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.knora.webapi.slice.resourceinfo | ||
|
||
import zio.ZLayer | ||
|
||
import org.knora.webapi.slice.common.api.BaseEndpoints | ||
import org.knora.webapi.slice.common.api.HandlerMapper | ||
import org.knora.webapi.slice.common.api.TapirToPekkoInterpreter | ||
import org.knora.webapi.slice.resourceinfo.api.ResourceInfoEndpoints | ||
import org.knora.webapi.slice.resourceinfo.api.ResourceInfoRoutes | ||
import org.knora.webapi.slice.resourceinfo.api.service.RestResourceInfoService | ||
import org.knora.webapi.slice.resourceinfo.api.service.RestResourceInfoServiceLive | ||
import org.knora.webapi.slice.resourceinfo.domain.IriConverter | ||
import org.knora.webapi.slice.resourceinfo.repo.ResourceInfoRepoLive | ||
import org.knora.webapi.store.triplestore.api.TriplestoreService | ||
|
||
object ResourceInfoLayers { | ||
|
||
val live: ZLayer[ | ||
TriplestoreService with IriConverter with BaseEndpoints with HandlerMapper with TapirToPekkoInterpreter, | ||
Nothing, | ||
RestResourceInfoService with ResourceInfoEndpoints with ResourceInfoRoutes | ||
] = | ||
ResourceInfoRepoLive.layer >>> RestResourceInfoServiceLive.layer >+> ResourceInfoEndpoints.layer >+> ResourceInfoRoutes.layer | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
webapi/src/main/scala/org/knora/webapi/slice/resourceinfo/api/ResourceInfoEndpoints.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright © 2021 - 2023 Swiss National Data and Service Center for the Humanities and/or DaSCH Service Platform contributors. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.knora.webapi.slice.resourceinfo.api | ||
|
||
import sttp.tapir._ | ||
import sttp.tapir.generic.auto._ | ||
import sttp.tapir.json.zio._ | ||
import zio.ZLayer | ||
|
||
import org.knora.webapi.messages.admin.responder.projectsmessages.ProjectIdentifierADM.IriIdentifier | ||
import org.knora.webapi.routing.RouteUtilV2 | ||
import org.knora.webapi.slice.common.api.BaseEndpoints | ||
import org.knora.webapi.slice.resourceinfo.api.model.ListResponseDto | ||
import org.knora.webapi.slice.resourceinfo.api.model.QueryParams.Order | ||
import org.knora.webapi.slice.resourceinfo.api.model.QueryParams.OrderBy | ||
|
||
final case class ResourceInfoEndpoints(baseEndpoints: BaseEndpoints) { | ||
val getResourcesInfo = baseEndpoints.publicEndpoint.get | ||
.in("v2" / "resources" / "info") | ||
.in(header[IriIdentifier](RouteUtilV2.PROJECT_HEADER)) | ||
.in(query[String]("resourceClass")) | ||
.in(query[Option[Order]](Order.queryParamKey)) | ||
.in(query[Option[OrderBy]](OrderBy.queryParamKey)) | ||
.out(jsonBody[ListResponseDto]) | ||
} | ||
|
||
object ResourceInfoEndpoints { | ||
val layer = ZLayer.derive[ResourceInfoEndpoints] | ||
} |
Oops, something went wrong.