Gabung app Android Flutter 'Saat Invest' ke repo saat-app (folder flutter/)

Satu repo untuk backend Odoo (addon saat_invest) + app Android.
- flutter/ berisi project Flutter (lib/, android/, pubspec, test)
- Login Odoo JSON-RPC, tab Portofolio+Equity, tab Transaksi, catat jual/beli otomatis sync
- Build .gitignore nested dipakai sehingga artefak build/.dart_tool tak ter-track
Sejarah: gabung flat (satu sejarah backend+app).
This commit is contained in:
2026-09-02 14:48:32 +07:00
parent b53406791f
commit 5ab72678a3
34 changed files with 1881 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
/// Model Saham master dari saat.saham.
class Saham {
final int id;
final String kode;
final String? perusahaan;
final String? sektor;
Saham({required this.id, required this.kode, this.perusahaan, this.sektor});
factory Saham.fromOdoo(Map<String, dynamic> m) => Saham(
id: (m['id'] as num).toInt(),
kode: (m['name'] as String?) ?? '',
perusahaan: m['perusahaan'] as String?,
sektor: m['sector'] as String?,
);
}
/// Model Transaksi dari saat.transaksi.
class Transaksi {
final int id;
final String tanggal;
final String tipe; // buy | sell
final int sahamId;
final String sahamTicker;
final int volume;
final double harga;
final double fee;
final double total;
Transaksi({
required this.id,
required this.tanggal,
required this.tipe,
required this.sahamId,
required this.sahamTicker,
required this.volume,
required this.harga,
required this.fee,
required this.total,
});
bool get isBuy => tipe == 'buy';
factory Transaksi.fromOdoo(Map<String, dynamic> m) {
String ticker = '';
final s = m['saham_id'];
if (s is List && s.isNotEmpty) {
ticker = s.length > 1 ? s[1].toString() : '${s[0]}';
}
final sid = s is List ? (s.first as num).toInt() : (s as num?)?.toInt() ?? 0;
return Transaksi(
id: (m['id'] as num).toInt(),
tanggal: (m['tanggal'] as String?) ?? '',
tipe: (m['tipe'] as String?) ?? 'buy',
sahamId: sid,
sahamTicker: ticker,
volume: (m['volume'] as num?)?.toInt() ?? 0,
harga: (m['harga'] as num?)?.toDouble() ?? 0,
fee: (m['fee'] as num?)?.toDouble() ?? 0,
total: (m['total'] as num?)?.toDouble() ?? 0,
);
}
}