44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
import 'package:pshared/data/dto/ledger/account.dart';
|
|
import 'package:pshared/data/mapper/describable.dart';
|
|
import 'package:pshared/data/mapper/ledger/balance.dart';
|
|
import 'package:pshared/models/ledger/account.dart';
|
|
|
|
|
|
extension LedgerAccountDTOMapper on LedgerAccountDTO {
|
|
LedgerAccount toDomain() => LedgerAccount(
|
|
ledgerAccountRef: ledgerAccountRef,
|
|
organizationRef: organizationRef,
|
|
ownerRef: ownerRef,
|
|
accountCode: accountCode,
|
|
accountType: accountType,
|
|
currency: currency,
|
|
status: status,
|
|
allowNegative: allowNegative,
|
|
isSettlement: isSettlement,
|
|
metadata: metadata,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
describable: describable.toDomain(),
|
|
balance: balance?.toDomain(),
|
|
);
|
|
}
|
|
|
|
extension LedgerAccountModelMapper on LedgerAccount {
|
|
LedgerAccountDTO toDTO() => LedgerAccountDTO(
|
|
ledgerAccountRef: ledgerAccountRef,
|
|
organizationRef: organizationRef,
|
|
ownerRef: ownerRef,
|
|
accountCode: accountCode,
|
|
accountType: accountType,
|
|
currency: currency,
|
|
status: status,
|
|
allowNegative: allowNegative,
|
|
isSettlement: isSettlement,
|
|
metadata: metadata,
|
|
createdAt: createdAt,
|
|
updatedAt: updatedAt,
|
|
describable: describable.toDTO(),
|
|
balance: balance?.toDTO(),
|
|
);
|
|
}
|