Skip to content

Commit a89a259

Browse files
authored
Merge pull request #590 from lunatech-labs/dependabot/gradle/org.jlleitschuh.gradle-ktlint-gradle-12.1.1
chore(deps): bump org.jlleitschuh.gradle:ktlint-gradle from 11.3.2 to 12.1.1
2 parents eacd564 + 57d9c6d commit a89a259

39 files changed

+379
-269
lines changed

build.gradle

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
// root-level build.gradle
2-
buildscript {
3-
repositories {
4-
maven {
5-
url "https://plugins.gradle.org/m2/"
6-
}
7-
}
8-
dependencies {
9-
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.3.2"
10-
}
11-
}
12-
132
plugins {
14-
id("org.jlleitschuh.gradle.ktlint-idea") version "11.6.1"
3+
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
154
id 'org.jetbrains.kotlin.jvm' version '1.9.10'
165
id 'com.github.autostyle' version '3.2'
176
id 'application'
187
}
198

20-
group 'com.lunatech'
21-
version '0.0.1'
22-
mainClassName = "io.ktor.server.netty.EngineMain"
23-
sourceCompatibility = JavaVersion.VERSION_17
24-
targetCompatibility = JavaVersion.VERSION_17
9+
base {
10+
group 'com.lunatech'
11+
version '0.0.1'
12+
mainClassName = "io.ktor.server.netty.EngineMain"
13+
}
2514

2615
sourceSets {
2716
main.kotlin.srcDirs = main.java.srcDirs = ['src/main']

src/main/com/lunatech/chef/api/Application.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import java.time.format.DateTimeParseException
8181
import java.util.Date
8282

8383
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
84+
8485
private val logger = KotlinLogging.logger {}
8586

8687
@Suppress("unused") // Referenced in application.conf
@@ -148,7 +149,7 @@ fun Application.module() {
148149
is IllegalArgumentException, is DateTimeParseException -> {
149150
call.respond(
150151
HttpStatusCode.BadRequest,
151-
"${throwable.message}"
152+
"${throwable.message}",
152153
)
153154
}
154155
}

src/main/com/lunatech/chef/api/auth/AuthorisedRouteSelector.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/main/com/lunatech/chef/api/auth/RoleAuthorization.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import io.ktor.server.application.ApplicationCall
66
* https://medium.com/@shrikantjagtap99/role-based-authorization-feature-in-ktor-web-framework-in-kotlin-dda88262a86a
77
*/
88
class RoleAuthorization internal constructor(config: Configuration) {
9-
109
constructor(provider: RoleBasedAuthorizer) : this(Configuration(provider))
1110

1211
private var config = config.copy()
@@ -52,5 +51,17 @@ class RoleAuthorization internal constructor(config: Configuration) {
5251

5352
enum class Role(val roleStr: String) {
5453
ADMIN("admin"),
55-
USER("user")
54+
USER("user"),
5655
}
56+
// class AuthorisedRouteSelector() : RouteSelector(RouteSelectorEvaluation.qualityConstant) {
57+
// override fun evaluate(context: RoutingResolveContext, segmentIndex: Int): RouteSelectorEvaluation =
58+
// RouteSelectorEvaluation.Constant
59+
// }
60+
//
61+
// fun Route.rolesAllowed(vararg roles: Role, build: Route.() -> Unit): Route {
62+
// val authorisedRoute = createChild(AuthorisedRouteSelector())
63+
// application.feature(RoleAuthorization).interceptPipeline(this.application, roles.toSet())
64+
//
65+
// authorisedRoute.build()
66+
// return authorisedRoute
67+
// }

src/main/com/lunatech/chef/api/persistence/Database.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import org.ktorm.database.Database
77

88
object Database {
99
fun connect(config: FlywayConfig): Database {
10-
val hikariConfig = HikariConfig().apply {
11-
jdbcUrl = config.url
12-
username = config.user
13-
password = config.password
14-
maximumPoolSize = config.maxPoolSize
15-
}
10+
val hikariConfig =
11+
HikariConfig().apply {
12+
jdbcUrl = config.url
13+
username = config.user
14+
password = config.password
15+
maximumPoolSize = config.maxPoolSize
16+
}
1617
val dataSource = HikariDataSource(hikariConfig)
1718
return Database.connect(dataSource)
1819
}

src/main/com/lunatech/chef/api/persistence/schemas/Attendances.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ object Attendances : BaseTable<Attendance>("attendances") {
1313
val isAttending = boolean("is_attending")
1414
val isDeleted = boolean("is_deleted")
1515

16-
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Attendance(
16+
override fun doCreateEntity(
17+
row: QueryRowSet,
18+
withReferences: Boolean,
19+
) = Attendance(
1720
uuid = row[uuid] ?: DEFAULT_UUID,
1821
scheduleUuid = row[scheduleUuid] ?: DEFAULT_UUID,
1922
userUuid = row[userUuid] ?: DEFAULT_UUID,

src/main/com/lunatech/chef/api/persistence/schemas/Dishes.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ object Dishes : BaseTable<Dish>("dishes") {
2121
val isLactoseFree = boolean("is_lactose_free")
2222
val isDeleted = boolean("is_deleted")
2323

24-
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Dish(
24+
override fun doCreateEntity(
25+
row: QueryRowSet,
26+
withReferences: Boolean,
27+
) = Dish(
2528
uuid = row[uuid] ?: DEFAULT_UUID,
2629
name = row[name] ?: DEFAULT_STRING,
2730
description = row[description] ?: DEFAULT_STRING,

src/main/com/lunatech/chef/api/persistence/schemas/DishesOnMenus.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ object DishesOnMenus : BaseTable<DishOnMenu>("dishes_on_menus") {
99
val menuUuid = uuid("menu_uuid")
1010
val dishUuid = uuid("dish_uuid")
1111

12-
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = DishOnMenu(
12+
override fun doCreateEntity(
13+
row: QueryRowSet,
14+
withReferences: Boolean,
15+
) = DishOnMenu(
1316
menuUuid = row[menuUuid] ?: DEFAULT_UUID,
1417
dishUuid = row[dishUuid] ?: DEFAULT_UUID,
1518
)

src/main/com/lunatech/chef/api/persistence/schemas/MenuNames.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@ object MenuNames : BaseTable<MenuName>("menus") {
1414
val name = varchar("name")
1515
val isDeleted = boolean("is_deleted")
1616

17-
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = MenuName(
17+
override fun doCreateEntity(
18+
row: QueryRowSet,
19+
withReferences: Boolean,
20+
) = MenuName(
1821
uuid = row[uuid] ?: DEFAULT_UUID,
1922
name = row[name] ?: DEFAULT_STRING,
2023
isDeleted = row[isDeleted] ?: DEFAULT_FALSE,
2124
)
2225

23-
fun toMenuWithDishes(menuName: MenuName, dishes: List<Dish>) = MenuWithDishes(
26+
fun toMenuWithDishes(
27+
menuName: MenuName,
28+
dishes: List<Dish>,
29+
) = MenuWithDishes(
2430
uuid = menuName.uuid,
2531
name = menuName.name,
2632
dishes = dishes,

src/main/com/lunatech/chef/api/persistence/schemas/Offices.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ object Offices : BaseTable<Office>("offices") {
1313
val country = varchar("country")
1414
val isDeleted = boolean("is_deleted")
1515

16-
override fun doCreateEntity(row: QueryRowSet, withReferences: Boolean) = Office(
16+
override fun doCreateEntity(
17+
row: QueryRowSet,
18+
withReferences: Boolean,
19+
) = Office(
1720
uuid = row[uuid] ?: DEFAULT_UUID,
1821
city = row[city] ?: DEFAULT_STRING,
1922
country = row[country] ?: DEFAULT_STRING,

0 commit comments

Comments
 (0)