From c9d3c3b4abf9cafb314ed3688f9f50c326250e4a Mon Sep 17 00:00:00 2001 From: Jan Cizmar Date: Thu, 14 Dec 2023 18:31:55 +0100 Subject: [PATCH] fix: Demo project creation --- .../quickStart/QuickStartModelAssembler.kt | 2 +- .../tolgee/component/CurrentDateProvider.kt | 21 ++++++++++++------- .../main/kotlin/io/tolgee/model/QuickStart.kt | 2 +- .../io/tolgee/service/QuickStartService.kt | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/backend/api/src/main/kotlin/io/tolgee/hateoas/quickStart/QuickStartModelAssembler.kt b/backend/api/src/main/kotlin/io/tolgee/hateoas/quickStart/QuickStartModelAssembler.kt index 375f7d14a7..ca60f5666c 100644 --- a/backend/api/src/main/kotlin/io/tolgee/hateoas/quickStart/QuickStartModelAssembler.kt +++ b/backend/api/src/main/kotlin/io/tolgee/hateoas/quickStart/QuickStartModelAssembler.kt @@ -11,7 +11,7 @@ class QuickStartModelAssembler() : RepresentationModelAssemblerSupport { return Optional.of(date.toInstant()) } + + private fun getServerTimeEntity(): ForcedServerDateTime? = + entityManager.createQuery( + "select st from ForcedServerDateTime st where st.id = 1", + ForcedServerDateTime::class.java + ).resultList.singleOrNull() + + private fun getForcedTime(): Date? = + entityManager.createNativeQuery( + "select st from forced_server_date_time st where st.id = 1", + Date::class.java + ).resultList.singleOrNull() as Date? } diff --git a/backend/data/src/main/kotlin/io/tolgee/model/QuickStart.kt b/backend/data/src/main/kotlin/io/tolgee/model/QuickStart.kt index 2f36c2aded..3d39f31f36 100644 --- a/backend/data/src/main/kotlin/io/tolgee/model/QuickStart.kt +++ b/backend/data/src/main/kotlin/io/tolgee/model/QuickStart.kt @@ -31,5 +31,5 @@ data class QuickStart( @Type(StringArrayType::class) @Column(columnDefinition = "text[]") - var completedSteps: MutableList = mutableListOf() + var completedSteps: Array = arrayOf() } diff --git a/backend/data/src/main/kotlin/io/tolgee/service/QuickStartService.kt b/backend/data/src/main/kotlin/io/tolgee/service/QuickStartService.kt index a4358994af..ad93917f00 100644 --- a/backend/data/src/main/kotlin/io/tolgee/service/QuickStartService.kt +++ b/backend/data/src/main/kotlin/io/tolgee/service/QuickStartService.kt @@ -25,7 +25,7 @@ class QuickStartService( fun completeStep(userAccount: UserAccountDto, step: String): QuickStart? { val quickStart = quickStartRepository.findByUserAccountId(userAccount.id) if (quickStart?.completedSteps?.let { !it.contains(step) } == true) { - quickStart.completedSteps.add(step) + quickStart.completedSteps = quickStart.completedSteps.plus(step) quickStartRepository.save(quickStart) } return quickStart