Skip to content

Commit b98cb49

Browse files
committed
Merge branch 'feat/shopinbit' into vacay
2 parents 98d8136 + a1088fb commit b98cb49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+17284
-252
lines changed

lib/db/isar/main_db.dart

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class MainDB {
7373
TokenWalletInfoSchema,
7474
FrostWalletInfoSchema,
7575
WalletSolanaTokenInfoSchema,
76+
ShopInBitTicketSchema,
7677
],
7778
directory: (await StackFileSystem.applicationIsarDirectory()).path,
7879
// inspector: kDebugMode,
@@ -645,4 +646,30 @@ class MainDB {
645646
isar.writeTxn(() async {
646647
await isar.solContracts.putAll(tokens);
647648
});
649+
650+
// ========== ShopInBit tickets ===============================================
651+
652+
List<ShopInBitTicket> getShopInBitTickets() {
653+
return isar.shopInBitTickets.where().sortByCreatedAtDesc().findAllSync();
654+
}
655+
656+
Future<int> putShopInBitTicket(ShopInBitTicket ticket) async {
657+
try {
658+
return await isar.writeTxn(() async {
659+
return await isar.shopInBitTickets.put(ticket);
660+
});
661+
} catch (e) {
662+
throw MainDBException("failed putShopInBitTicket", e);
663+
}
664+
}
665+
666+
Future<bool> deleteShopInBitTicket(String ticketId) async {
667+
try {
668+
return await isar.writeTxn(() async {
669+
return await isar.shopInBitTickets.deleteByTicketId(ticketId);
670+
});
671+
} catch (e) {
672+
throw MainDBException("failed deleteShopInBitTicket: $ticketId", e);
673+
}
674+
}
648675
}

lib/models/isar/models/isar_models.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ export 'blockchain_data/utxo.dart';
1717
export 'ethereum/eth_contract.dart';
1818
export 'log.dart';
1919
export 'solana/sol_contract.dart';
20+
export 'shopinbit_ticket.dart';
2021
export 'transaction_note.dart';
2122
export '../../../wallets/isar/models/wallet_solana_token_info.dart';
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:isar_community/isar.dart';
2+
3+
import '../../shopinbit/shopinbit_order_model.dart';
4+
5+
part 'shopinbit_ticket.g.dart';
6+
7+
@collection
8+
class ShopInBitTicket {
9+
Id id = Isar.autoIncrement;
10+
11+
@Index(unique: true, replace: true)
12+
late String ticketId;
13+
14+
late String displayName;
15+
@enumerated
16+
late ShopInBitCategory category;
17+
@enumerated
18+
late ShopInBitOrderStatus status;
19+
late String requestDescription;
20+
late String deliveryCountry;
21+
late String? offerProductName;
22+
late String? offerPrice;
23+
late String shippingName;
24+
late String shippingStreet;
25+
late String shippingCity;
26+
late String shippingPostalCode;
27+
late String shippingCountry;
28+
late String? paymentMethod;
29+
late List<ShopInBitTicketMessage> messages;
30+
late DateTime createdAt;
31+
late int apiTicketId;
32+
}
33+
34+
@embedded
35+
class ShopInBitTicketMessage {
36+
late String text;
37+
late DateTime timestamp;
38+
late bool isFromUser;
39+
40+
ShopInBitTicketMessage();
41+
}

0 commit comments

Comments
 (0)