56 lines
1.5 KiB
Dart
56 lines
1.5 KiB
Dart
const String transactionTableName = 'transactions';
|
|
const String transactionColumnId = 'id';
|
|
const String transactionColumnUuid = 'uuid';
|
|
const String transactionColumnType = 'type';
|
|
const String transactionColumnStatus = 'status';
|
|
const String transactionColumnData = 'data';
|
|
const String transactionColumnAppCompanyId = 'appCompanyId';
|
|
const String transactionColumnCreatedAt = 'createdAt';
|
|
|
|
const int transactionTypeSell = 1;
|
|
const int transactionTypeBuy = 2;
|
|
|
|
const int transactionStatusPrepare = 0;
|
|
|
|
|
|
class Transaction {
|
|
|
|
Transaction();
|
|
|
|
Transaction.fromMap(Map<String, dynamic> map) {
|
|
id = map[transactionColumnId] as int;
|
|
uuid = map[transactionColumnUuid] as String;
|
|
type = map[transactionColumnType] as int;
|
|
status = map[transactionColumnStatus] as int;
|
|
appCompanyId = map[transactionColumnAppCompanyId] as int;
|
|
data = map[transactionColumnData] as String;
|
|
createdAt = map[transactionColumnCreatedAt] as String;
|
|
}
|
|
|
|
int? id;
|
|
String? uuid;
|
|
int? type;
|
|
int? status;
|
|
String? data;
|
|
int? appCompanyId;
|
|
String? createdAt;
|
|
|
|
Map<String, dynamic> toMap() {
|
|
final Map<String, dynamic> map = <String, dynamic>{
|
|
transactionColumnUuid: uuid,
|
|
transactionColumnType: type,
|
|
transactionColumnStatus: status,
|
|
transactionColumnData: data,
|
|
transactionColumnAppCompanyId: appCompanyId,
|
|
transactionColumnCreatedAt: createdAt,
|
|
};
|
|
if (id != null) {
|
|
map[transactionColumnId] = id;
|
|
}
|
|
return map;
|
|
}
|
|
|
|
|
|
}
|
|
|