Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement functionality for getPartitioningsEndpointV2 #225

Closed
salamonpavel opened this issue Jul 31, 2024 · 1 comment
Closed

Implement functionality for getPartitioningsEndpointV2 #225

salamonpavel opened this issue Jul 31, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@salamonpavel
Copy link
Collaborator

salamonpavel commented Jul 31, 2024

Implement missing functionality for the endpoint below on all levels - Controller, Service, Repository, Fa-DB, SQL.

case class PartitioningWithIdDTO (
  id: Long,
  partitioning: PartitioningDTO,
  parentPartitioning: Option[PartitioningDTO],
  author: String
)

object PartitioningWithIdDTO {
  implicit val encoderPartitioningWithIdDTO: Encoder[PartitioningWithIdDTO] = deriveEncoder
  implicit val decoderPartitioningWithIdDTO: Decoder[PartitioningWithIdDTO] = deriveDecoder
}

// Endpoints
protected val getPartitioningsEndpointV2: PublicEndpoint[
    (Option[String], Option[String], Option[String]),
    ErrorResponse,
    PaginatedResponse[PartitioningWithIdDTO],
    Any
  ] = {
    apiV2.get
      .in(V2Paths.Partitionings)
      .in(query[Option[String]]("partitions"))
      .in(query[Option[String]]("limit"))
      .in(query[Option[String]]("offset"))
      .out(statusCode(StatusCode.Ok))
      .out(jsonBody[PaginatedResponse[PartitioningWithIdDTO]])
  }

// Routes
createServerEndpoint[
        (Option[String], Option[String], Option[String]),
        ErrorResponse,
        PaginatedResponse[PartitioningWithIdDTO]
      ](
        getPartitioningsEndpointV2,
        { case (partitions: Option[String], limit: Option[String], offset: Option[String]) =>
          PartitioningController.getPartitioningsV2(partitions, limit, offset)
        }
      )

// Controller
override def getPartitioningsV2(
    partitions: Option[String],
    limit: Option[String],
    offset: Option[String]
  ): IO[ErrorResponse, PaginatedResponse[PartitioningWithIdDTO]]

// Service
override def getPartitionings(
    partitions: Option[String],
    limit: Option[String],
    offset: Option[String]
  ): IO[ServiceError, PaginatedResult[PartitioningWithIdDTO]]

// Repository
def getPartitionings(
    partitions: Option[String],
    limit: Option[String],
    offset: Option[String]
  ): IO[DatabaseError, PaginatedResult[PartitioningWithIdDTO]]
@salamonpavel salamonpavel added the enhancement New feature or request label Jul 31, 2024
@zakera786 zakera786 moved this from 🆕 To groom to 🔖 Sprint in CPS small repos project Aug 16, 2024
@benedeki
Copy link
Contributor

Duplicate of #268

@benedeki benedeki marked this as a duplicate of #268 Sep 17, 2024
@github-project-automation github-project-automation bot moved this from 🔖 Sprint to ✅ Done in CPS small repos project Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

3 participants