From 364b2f020ed49181170589dab3b1520aa233e8e2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 27 Sep 2025 09:51:44 +0200 Subject: [PATCH] Feature/remove ITEM as order type enum (#5583) * Remove ITEM from Type enum * Update changelog --- CHANGELOG.md | 6 ++++++ apps/api/src/app/import/import.service.ts | 6 ------ .../migration.sql | 8 ++++++++ prisma/schema.prisma | 1 - .../not-ok/invalid-type-deprecated.json | 20 ------------------- 5 files changed, 14 insertions(+), 27 deletions(-) create mode 100644 prisma/migrations/20250926182138_removed_item_from_type/migration.sql delete mode 100644 test/import/not-ok/invalid-type-deprecated.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 45159a312..bdb7ea502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Removed the deprecated `ITEM` activity type + ## 2.202.0 - 2025-09-26 ### Added diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index a96200261..82231d237 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -718,12 +718,6 @@ export class ImportService { index, { currency, dataSource, symbol, type } ] of activitiesDto.entries()) { - if (type === 'ITEM') { - throw new Error( - `activities.${index}.type ("${type}") is deprecated, please use "BUY" instead` - ); - } - if (!dataSources.includes(dataSource)) { throw new Error( `activities.${index}.dataSource ("${dataSource}") is not valid` diff --git a/prisma/migrations/20250926182138_removed_item_from_type/migration.sql b/prisma/migrations/20250926182138_removed_item_from_type/migration.sql new file mode 100644 index 000000000..756158973 --- /dev/null +++ b/prisma/migrations/20250926182138_removed_item_from_type/migration.sql @@ -0,0 +1,8 @@ +-- AlterEnum +BEGIN; +CREATE TYPE "public"."Type_new" AS ENUM ('BUY', 'DIVIDEND', 'FEE', 'INTEREST', 'LIABILITY', 'SELL'); +ALTER TABLE "public"."Order" ALTER COLUMN "type" TYPE "public"."Type_new" USING ("type"::text::"public"."Type_new"); +ALTER TYPE "public"."Type" RENAME TO "Type_old"; +ALTER TYPE "public"."Type_new" RENAME TO "Type"; +DROP TYPE "public"."Type_old"; +COMMIT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 7a3c613ca..72ec79008 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -349,7 +349,6 @@ enum Type { DIVIDEND FEE INTEREST - ITEM LIABILITY SELL } diff --git a/test/import/not-ok/invalid-type-deprecated.json b/test/import/not-ok/invalid-type-deprecated.json deleted file mode 100644 index 77572df85..000000000 --- a/test/import/not-ok/invalid-type-deprecated.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "meta": { - "date": "2023-02-05T00:00:00.000Z", - "version": "dev" - }, - "activities": [ - { - "accountId": null, - "comment": null, - "fee": 0, - "quantity": 1, - "type": "ITEM", - "unitPrice": 500000, - "currency": "USD", - "dataSource": "MANUAL", - "date": "2022-01-01T00:00:00.000Z", - "symbol": "Penthouse Apartment" - } - ] -}