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

1644: Add validation to importAcceptingStores mutation in the backend #1928

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ const val EAK_BAYERN_PROJECT = "bayern.ehrenamtskarte.app"
const val NUERNBERG_PASS_PROJECT = "nuernberg.sozialpass.app"
const val KOBLENZ_PASS_PROJECT = "koblenz.sozialpass.app"
const val KOBLENZ_PEPPER_SYS_ENV = "KOBLENZ_PEPPER"
const val SHOWCASE_PROJECT = "showcase.entitlementcard.app"
const val DEFAULT_PROJECT = EAK_BAYERN_PROJECT

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package app.ehrenamtskarte.backend.exception.service

class NotEakProjectException : Exception("This query can only be used for EAK project")
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app.ehrenamtskarte.backend.stores.importer

import app.ehrenamtskarte.backend.stores.importer.bayern.EhrenamtskarteBayern
import app.ehrenamtskarte.backend.stores.importer.nuernberg.SozialpassNuernberg
import app.ehrenamtskarte.backend.stores.importer.pipelines.BerechtigungskarteShowcase
import org.slf4j.LoggerFactory

Expand All @@ -19,7 +18,6 @@ object Importer {
logger.info("== Pipeline ${project.pipelineName} started ==")
when (project.pipelineName) {
"EhrenamtskarteBayern" -> EhrenamtskarteBayern.import(config, logger)
"SozialpassNuernberg" -> SozialpassNuernberg.import(config, logger)
"BerechtigungskarteShowcase" -> BerechtigungskarteShowcase.import(config, logger)
else -> throw Error("Invalid pipeline name '${project.pipelineName}'!")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package app.ehrenamtskarte.backend.stores.importer.bayern.steps

import app.ehrenamtskarte.backend.stores.geocoding.FeatureFetcher
import app.ehrenamtskarte.backend.stores.importer.ImportConfig
import app.ehrenamtskarte.backend.stores.importer.PipelineStep
import app.ehrenamtskarte.backend.stores.importer.common.types.AcceptingStore
Expand All @@ -14,7 +13,6 @@ import org.slf4j.Logger
*/
class PostSanitizeFilter(config: ImportConfig, private val logger: Logger, httpClient: HttpClient) :
PipelineStep<List<AcceptingStore>, List<AcceptingStore>>(config) {
private val featureFetcher = FeatureFetcher(config, httpClient)

override fun execute(input: List<AcceptingStore>): List<AcceptingStore> = runBlocking {
input.filter {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ fun getDiscount(discounts: MutableList<String?>): String {
discounts.removeIf { it.isNullOrEmpty() }
return discounts.joinToString("\n\n")
}

fun mapCsvToStore(csvStore: CSVAcceptingStore): AcceptingStore {
val discount = getDiscount(mutableListOf(csvStore.discountDE, csvStore.discountEN))
return AcceptingStore(
csvStore.name!!, COUNTRY_CODE, csvStore.location!!, csvStore.postalCode!!, csvStore.street!!, csvStore.houseNumber!!, "", csvStore.longitude!!.toDouble(), csvStore.latitude!!.toDouble(), csvStore.categoryId!!.toInt(), csvStore.email.clean(false), csvStore.telephone.clean(false),
csvStore.homepage.clean(false), discount.clean(false), null, null
csvStore.name.clean()!!,
COUNTRY_CODE,
csvStore.location.clean()!!,
csvStore.postalCode.clean(),
csvStore.street.clean(),
csvStore.houseNumber.clean(),
additionalAddressInformation = "",
csvStore.longitude,
csvStore.latitude,
csvStore.categoryId,
csvStore.email.clean(false),
csvStore.telephone.clean(false),
csvStore.homepage.clean(false),
discount.clean(false),
freinetId = null,
districtName = null
)
}
Loading