Browse Source

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

* Remove ITEM from Type enum

* Update changelog
pull/5584/head^2
Thomas Kaul 3 weeks ago
committed by GitHub
parent
commit
364b2f020e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 6
      apps/api/src/app/import/import.service.ts
  3. 8
      prisma/migrations/20250926182138_removed_item_from_type/migration.sql
  4. 1
      prisma/schema.prisma
  5. 20
      test/import/not-ok/invalid-type-deprecated.json

6
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

6
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`

8
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;

1
prisma/schema.prisma

@ -349,7 +349,6 @@ enum Type {
DIVIDEND
FEE
INTEREST
ITEM
LIABILITY
SELL
}

20
test/import/not-ok/invalid-type-deprecated.json

@ -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"
}
]
}
Loading…
Cancel
Save