From 5537b742f2dbc545585d9b05476bea2f6686d966 Mon Sep 17 00:00:00 2001 From: Petri Lehtinen Date: Wed, 13 Nov 2024 09:51:13 +0200 Subject: [PATCH] Remove the `holiday` table and related code --- frontend/src/e2e-test/dev-api/fixtures.ts | 20 ++----- .../src/e2e-test/generated/api-clients.ts | 22 -------- frontend/src/e2e-test/generated/api-types.ts | 16 ------ .../evaka/shared/dev/DataInitializers.kt | 13 ----- .../fi/espoo/evaka/shared/dev/DevApi.kt | 7 --- .../db/migration/V462__drop_table_holiday.sql | 1 + .../src/main/resources/dev-data/holidays.sql | 53 ------------------- service/src/main/resources/migrations.txt | 1 + 8 files changed, 5 insertions(+), 128 deletions(-) create mode 100644 service/src/main/resources/db/migration/V462__drop_table_holiday.sql delete mode 100644 service/src/main/resources/dev-data/holidays.sql diff --git a/frontend/src/e2e-test/dev-api/fixtures.ts b/frontend/src/e2e-test/dev-api/fixtures.ts index 62c2da5595d..2af33df6b9d 100644 --- a/frontend/src/e2e-test/dev-api/fixtures.ts +++ b/frontend/src/e2e-test/dev-api/fixtures.ts @@ -80,7 +80,6 @@ import { createEmployeePins, createFeeThresholds, createFridgeChild, - createHoliday, createHolidayPeriod, createHolidayQuestionnaire, createIncome, @@ -128,7 +127,6 @@ import { DevEmployee, DevEmployeePin, DevFridgeChild, - DevHoliday, DevIncome, DevInvoice, DevParentship, @@ -872,14 +870,6 @@ export class Fixture { }) } - static holiday(initial?: Partial): HolidayBuilder { - return new HolidayBuilder({ - date: LocalDate.todayInHelsinkiTz(), - description: 'Holiday description', - ...initial - }) - } - static guardian(child: DevPerson, guardian: DevPerson) { return new GuardianBuilder({ childId: child.id, @@ -1647,13 +1637,6 @@ export class HolidayQuestionnaireBuilder extends FixtureBuilder { - async save() { - await createHoliday({ body: this.data }) - return this.data - } -} - export class GuardianBuilder extends FixtureBuilder<{ guardianId: string childId: string @@ -3073,6 +3056,9 @@ export const testDaycareGroup: DevDaycareGroup = { jamixCustomerNumber: null } +/** + * @deprecated Use `Fixture.placement()` instead + **/ export function createDaycarePlacementFixture( id: string, childId: string, diff --git a/frontend/src/e2e-test/generated/api-clients.ts b/frontend/src/e2e-test/generated/api-clients.ts index ea666d6a272..dc5472a07c4 100644 --- a/frontend/src/e2e-test/generated/api-clients.ts +++ b/frontend/src/e2e-test/generated/api-clients.ts @@ -52,7 +52,6 @@ import { DevFosterParent } from './api-types' import { DevFridgeChild } from './api-types' import { DevFridgePartner } from './api-types' import { DevGuardian } from './api-types' -import { DevHoliday } from './api-types' import { DevIncome } from './api-types' import { DevInvoice } from './api-types' import { DevMobileDevice } from './api-types' @@ -1044,27 +1043,6 @@ export async function createFridgePartner( } -/** -* Generated from fi.espoo.evaka.shared.dev.DevApi.createHoliday -*/ -export async function createHoliday( - request: { - body: DevHoliday - } -): Promise { - try { - const { data: json } = await devClient.request>({ - url: uri`/holiday`.toString(), - method: 'POST', - data: request.body satisfies JsonCompatible - }) - return json - } catch (e) { - throw new DevApiError(e) - } -} - - /** * Generated from fi.espoo.evaka.shared.dev.DevApi.createHolidayPeriod */ diff --git a/frontend/src/e2e-test/generated/api-types.ts b/frontend/src/e2e-test/generated/api-types.ts index eb8ad6d05de..a353a978bcd 100644 --- a/frontend/src/e2e-test/generated/api-types.ts +++ b/frontend/src/e2e-test/generated/api-types.ts @@ -610,14 +610,6 @@ export interface DevGuardian { guardianId: UUID } -/** -* Generated from fi.espoo.evaka.shared.dev.DevHoliday -*/ -export interface DevHoliday { - date: LocalDate - description: string -} - /** * Generated from fi.espoo.evaka.shared.dev.DevIncome */ @@ -1382,14 +1374,6 @@ export function deserializeJsonDevFridgePartner(json: JsonOf): } -export function deserializeJsonDevHoliday(json: JsonOf): DevHoliday { - return { - ...json, - date: LocalDate.parseIso(json.date) - } -} - - export function deserializeJsonDevIncome(json: JsonOf): DevIncome { return { ...json, diff --git a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt index b8a0860e2d0..27d088d0740 100755 --- a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DataInitializers.kt @@ -132,7 +132,6 @@ fun Database.Transaction.ensureDevData() { "employees.sql", "preschool-terms.sql", "club-terms.sql", - "holidays.sql", ) .forEach { runDevScript(it) } } @@ -151,18 +150,6 @@ RETURNING id .executeAndReturnGeneratedKeys() .exactlyOne() -fun Database.Transaction.insert(holiday: DevHoliday) { - createUpdate { - sql( - """ -INSERT INTO holiday (date, description) -VALUES (${bind(holiday.date)}, ${bind(holiday.description)}) -""" - ) - } - .execute() -} - fun Database.Transaction.insert(holidayPeriod: DevHolidayPeriod) { createUpdate { sql( diff --git a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt index c7e06a72a48..594a7088225 100755 --- a/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/shared/dev/DevApi.kt @@ -952,11 +952,6 @@ UPDATE placement SET end_date = ${bind(req.endDate)}, termination_requested_date } } - @PostMapping("/holiday") - fun createHoliday(db: Database, @RequestBody holiday: DevHoliday) { - db.connect { dbc -> dbc.transaction { tx -> tx.insert(holiday) } } - } - @PostMapping("/holiday-period/questionnaire/{id}") fun createHolidayQuestionnaire( db: Database, @@ -1835,8 +1830,6 @@ data class DevChild( val mealTextureId: Int? = null, ) -data class DevHoliday(val date: LocalDate, val description: String = "Test Holiday") - data class DevHolidayPeriod( val id: HolidayPeriodId = HolidayPeriodId(UUID.randomUUID()), val period: FiniteDateRange = diff --git a/service/src/main/resources/db/migration/V462__drop_table_holiday.sql b/service/src/main/resources/db/migration/V462__drop_table_holiday.sql new file mode 100644 index 00000000000..54fa0483e48 --- /dev/null +++ b/service/src/main/resources/db/migration/V462__drop_table_holiday.sql @@ -0,0 +1 @@ +DROP TABLE holiday; diff --git a/service/src/main/resources/dev-data/holidays.sql b/service/src/main/resources/dev-data/holidays.sql deleted file mode 100644 index 3ff7f2793e3..00000000000 --- a/service/src/main/resources/dev-data/holidays.sql +++ /dev/null @@ -1,53 +0,0 @@ --- SPDX-FileCopyrightText: 2017-2023 City of Espoo --- --- SPDX-License-Identifier: LGPL-2.1-or-later - -INSERT INTO holiday(date, description) -VALUES - ('2023-01-01','uudenvuodenpäivä'), - ('2023-01-06','loppiainen'), - ('2023-04-07','pitkäperjantai'), - ('2023-04-09','pääsiäispäivä'), - ('2023-04-10','2. pääsiäispäivä'), - ('2023-05-01','vappu'), - ('2023-05-18','helatorstai'), - ('2023-05-28','helluntai'), - ('2023-06-23','juhannusaatto'), - ('2023-06-24','juhannuspäivä'), - ('2023-11-04','pyhäinpäivä'), - ('2023-12-06','itsenäisyyspäivä'), - ('2023-12-24','jouluaatto'), - ('2023-12-25','joulupäivä'), - ('2023-12-26','tapaninpäivä'), - - ('2024-01-01','uudenvuodenpäivä'), - ('2024-01-06','loppiainen'), - ('2024-03-29','pitkäperjantai'), - ('2024-03-31','pääsiäispäivä'), - ('2024-04-01','toinen pääsiäispäivä'), - ('2024-05-01','vappu'), - ('2024-05-09','helatorstai'), - ('2024-05-19','helluntai'), - ('2024-06-21','juhannusaatto'), - ('2024-06-22','juhannuspäivä'), - ('2024-11-02','pyhäinpäivä'), - ('2024-12-06','itsenäisyyspäivä'), - ('2024-12-24','jouluaatto'), - ('2024-12-25','joulupäivä'), - ('2024-12-26','tapaninpäivä'), - - ('2025-01-01','uudenvuodenpäivä'), - ('2025-01-06','loppiainen'), - ('2025-04-18','pitkäperjantai'), - ('2025-04-20','pääsiäispäivä'), - ('2025-04-21','toinen pääsiäispäivä'), - ('2025-05-01','vappu'), - ('2025-05-29','helatorstai'), - ('2025-06-8','helluntai'), - ('2025-06-20','juhannusaatto'), - ('2025-06-21','juhannuspäivä'), - ('2025-11-01','pyhäinpäivä'), - ('2025-12-06','itsenäisyyspäivä'), - ('2025-12-24','jouluaatto'), - ('2025-12-25','joulupäivä'), - ('2025-12-26','tapaninpäivä'); diff --git a/service/src/main/resources/migrations.txt b/service/src/main/resources/migrations.txt index a9852b14832..c08401c22e3 100644 --- a/service/src/main/resources/migrations.txt +++ b/service/src/main/resources/migrations.txt @@ -457,3 +457,4 @@ V458__income_adjustments_modified_metadata.sql V459__modified_for_message_draft.sql V460__modification_metadata.sql V461__replacement_invoices.sql +V462__drop_table_holiday.sql