remove compatibility code for migration

This commit is contained in:
MaysWind
2025-02-09 16:51:21 +08:00
parent f2c043a299
commit 0e4cd10376
20 changed files with 171 additions and 214 deletions
+6 -22
View File
@@ -13,9 +13,9 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
public comment: string;
public displayOrder: number;
public visible: boolean;
public secondaryCategories?: TransactionCategory[];
public subCategories?: TransactionCategory[];
private constructor(id: string, name: string, parentId: string, type: CategoryType, icon: string, color: ColorValue, comment: string, displayOrder: number, visible: boolean, secondaryCategories?: TransactionCategory[]) {
private constructor(id: string, name: string, parentId: string, type: CategoryType, icon: string, color: ColorValue, comment: string, displayOrder: number, visible: boolean, subCategories?: TransactionCategory[]) {
this.id = id;
this.name = name;
this.parentId = parentId;
@@ -26,10 +26,10 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
this.displayOrder = displayOrder;
this.visible = visible;
if (secondaryCategories) {
this.secondaryCategories = secondaryCategories;
} else if (!secondaryCategories && (!parentId || parentId === '0')) {
this.secondaryCategories = [];
if (subCategories) {
this.subCategories = subCategories;
} else if (!subCategories && (!parentId || parentId === '0')) {
this.subCategories = [];
}
}
@@ -37,22 +37,6 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
return !this.visible;
}
public get subCategories(): TransactionCategoryInfoResponse[] | undefined {
if (typeof(this.secondaryCategories) === 'undefined') {
return undefined;
}
const ret: TransactionCategoryInfoResponse[] = [];
if (this.secondaryCategories) {
for (const subCategory of this.secondaryCategories) {
ret.push(subCategory);
}
}
return ret;
}
public from(other: TransactionCategory): void {
this.id = other.id;
this.name = other.name;