feat: implement idempotency key for critical API endpoints

This commit is contained in:
Efril
2026-06-04 00:48:50 +07:00
parent 2ab20a1150
commit b228538725
21 changed files with 431 additions and 37 deletions
+9 -2
View File
@@ -17,7 +17,7 @@ class DatabaseHelper {
return await openDatabase(
path,
version: 1, // Updated version for categories table
version: 2,
onCreate: _onCreate,
onUpgrade: _onUpgrade,
);
@@ -38,6 +38,7 @@ class DatabaseHelper {
business_type TEXT,
image_url TEXT,
printer_type TEXT,
print_to_checker INTEGER DEFAULT 0,
metadata TEXT,
is_active INTEGER,
created_at TEXT,
@@ -107,7 +108,13 @@ class DatabaseHelper {
await db.execute('CREATE INDEX idx_printers_type ON printers(type)');
}
Future<void> _onUpgrade(Database db, int oldVersion, int newVersion) async {}
Future<void> _onUpgrade(Database db, int oldVersion, int newVersion) async {
if (oldVersion < 2) {
await db.execute(
'ALTER TABLE products ADD COLUMN print_to_checker INTEGER DEFAULT 0',
);
}
}
Future<void> close() async {
final db = await database;