Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/remove ITEM as order type enum (#5583)

Thomas Kaul364b2f020ed4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 45159a3126..bdb7ea5020 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 a96200261f..82231d237d 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 0000000000..7561589731
--- /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 7a3c613cac..72ec79008c 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 77572df855..0000000000
--- 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"
- }
- ]
-}