-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into #62-MakeBackendRunViaDockerfile
- Loading branch information
Showing
56 changed files
with
1,269 additions
and
678 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
10 changes: 10 additions & 0 deletions
10
backend/src/main/kotlin/xyz/elitese/ehrenamtskarte/database/repos/AddressRepository.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,10 @@ | ||
package xyz.elitese.ehrenamtskarte.database.repos | ||
|
||
import xyz.elitese.ehrenamtskarte.database.AddressEntity | ||
import xyz.elitese.ehrenamtskarte.database.Addresses | ||
|
||
object AddressRepository { | ||
fun findByIds(ids: List<Int>) = AddressEntity.find { | ||
Addresses.id inList ids | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...nd/src/main/kotlin/xyz/elitese/ehrenamtskarte/database/repos/PhysicalStoresRespository.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,14 @@ | ||
package xyz.elitese.ehrenamtskarte.database.repos | ||
|
||
import xyz.elitese.ehrenamtskarte.database.PhysicalStoreEntity | ||
import xyz.elitese.ehrenamtskarte.database.PhysicalStores | ||
|
||
object PhysicalStoresRepository { | ||
|
||
fun findAll() = PhysicalStoreEntity.all() | ||
|
||
fun findByIds(ids: List<Int>) = PhysicalStoreEntity.find { | ||
PhysicalStores.id inList ids | ||
} | ||
|
||
} |
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
22 changes: 22 additions & 0 deletions
22
...end/src/main/kotlin/xyz/elitese/ehrenamtskarte/webservice/dataloader/AddressDataLoader.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,22 @@ | ||
package xyz.elitese.ehrenamtskarte.webservice.dataloader | ||
|
||
import kotlinx.coroutines.runBlocking | ||
import org.dataloader.DataLoader | ||
import org.jetbrains.exposed.sql.transactions.transaction | ||
import xyz.elitese.ehrenamtskarte.database.repos.AddressRepository | ||
import xyz.elitese.ehrenamtskarte.webservice.schema.types.Address | ||
import java.util.concurrent.CompletableFuture | ||
|
||
const val ADDRESS_LOADER_NAME = "ADDRESS_LOADER" | ||
|
||
val batchAddressLoader = DataLoader<Int, Address?> { ids -> | ||
CompletableFuture.supplyAsync { | ||
runBlocking { | ||
transaction { | ||
AddressRepository.findByIds(ids).map { | ||
Address(it.street, it.houseNumber, it.postalCode, it.locaction, it.state) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
backend/src/main/kotlin/xyz/elitese/ehrenamtskarte/webservice/schema/types/Address.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,9 @@ | ||
package xyz.elitese.ehrenamtskarte.webservice.schema.types | ||
|
||
data class Address( | ||
val street: String, | ||
val houseNumber: String, | ||
val postalCode: String, | ||
val location: String, | ||
val state: String | ||
) |
Oops, something went wrong.