-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from cheleb/38-provide-base-controller
38 provide base controller
- Loading branch information
Showing
14 changed files
with
81 additions
and
44 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
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
2 changes: 1 addition & 1 deletion
2
...ziolaminartapir/BackendClientConfig.scala → ...cheleb/ziotapir/BackendClientConfig.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.cheleb.ziolaminartapir | ||
package dev.cheleb.ziotapir | ||
|
||
import sttp.model.Uri | ||
|
||
|
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
2 changes: 1 addition & 1 deletion
2
.../dev/cheleb/ziolaminartapir/Session.scala → ...n/scala/dev/cheleb/ziotapir/Session.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.cheleb.ziolaminartapir | ||
package dev.cheleb.ziotapir | ||
|
||
import scala.scalajs.js.Date | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../dev/cheleb/ziolaminartapir/Storage.scala → ...n/scala/dev/cheleb/ziotapir/Storage.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dev.cheleb.ziolaminartapir | ||
package dev.cheleb.ziotapir | ||
|
||
import zio.json.* | ||
|
||
|
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
12 changes: 12 additions & 0 deletions
12
modules/core/src/main/scala/dev/cheleb/ziotapir/package.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,12 @@ | ||
package dev.cheleb.ziotapir | ||
|
||
import sttp.capabilities.zio.ZioStreams | ||
import sttp.capabilities.WebSockets | ||
|
||
type ZioStreamsWithWebSockets = ZioStreams & WebSockets | ||
|
||
/** Typed exception for restricted endpoints. | ||
* @param message | ||
*/ | ||
case class RestrictedEndpointException(message: String) | ||
extends RuntimeException(message) |
10 changes: 10 additions & 0 deletions
10
modules/server/src/main/scala/dev/cheleb/ziotapir/BaseController.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,10 @@ | ||
package dev.cheleb.ziotapir | ||
|
||
import sttp.tapir.server.ServerEndpoint | ||
import zio.Task | ||
|
||
trait BaseController { | ||
|
||
val routes: List[ServerEndpoint[Any, Task]] | ||
|
||
} |
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
19 changes: 19 additions & 0 deletions
19
modules/shared/src/main/scala/dev/cheleb/ziochimney/package.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,19 @@ | ||
package dev.cheleb.ziochimney | ||
|
||
import zio.Task | ||
import io.scalaland.chimney.dsl.* | ||
import io.scalaland.chimney.Transformer | ||
|
||
/** Extension methods for `Task` that allow to transform the result of the task | ||
* using Chimney. | ||
*/ | ||
extension [A](task: Task[A]) | ||
def mapInto[B](using Transformer[A, B]): Task[B] = | ||
task.map(_.into[B].transform) | ||
|
||
/** Extension methods for `Task[Option[A]]` that allow to transform the result | ||
* of the task using Chimney. | ||
*/ | ||
extension [A](task: Task[Option[A]]) | ||
def mapOption[B](using Transformer[A, B]): Task[Option[B]] = | ||
task.map(_.map(_.into[B].transform)) |