-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
611 additions
and
136 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
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
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/fr/shikkanime/controllers/api/SimulcastController.kt
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,34 @@ | ||
package fr.shikkanime.controllers.api | ||
|
||
import com.google.inject.Inject | ||
import fr.shikkanime.converters.AbstractConverter | ||
import fr.shikkanime.dtos.SimulcastDto | ||
import fr.shikkanime.services.SimulcastService | ||
import fr.shikkanime.utils.routes.* | ||
import fr.shikkanime.utils.routes.method.Get | ||
import fr.shikkanime.utils.routes.openapi.OpenAPI | ||
import fr.shikkanime.utils.routes.openapi.OpenAPIResponse | ||
import io.ktor.http.* | ||
import java.util.* | ||
|
||
@Controller("/api/v1/simulcasts") | ||
class SimulcastController { | ||
@Inject | ||
private lateinit var simulcastService: SimulcastService | ||
|
||
@Path | ||
@Get | ||
@OpenAPI( | ||
"Get simulcasts", | ||
[ | ||
OpenAPIResponse( | ||
200, | ||
"Simulcasts found", | ||
Array<SimulcastDto>::class, | ||
), | ||
] | ||
) | ||
private fun getAll(): Response { | ||
return Response.ok(AbstractConverter.convert(simulcastService.findAll(), SimulcastDto::class.java)) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package fr.shikkanime.dtos | ||
|
||
import java.io.Serializable | ||
|
||
data class MessageDto( | ||
val type: Type, | ||
val message: String, | ||
val data: Any? = null, | ||
) : Serializable { | ||
enum class Type { | ||
INFO, | ||
SUCCESS, | ||
WARNING, | ||
ERROR | ||
} | ||
} |
Oops, something went wrong.