|
|
@ -38,6 +38,8 @@ class ConversationsRepository { |
|
|
|
adminAddMembers: true, |
|
|
|
adminEditInfo: true, |
|
|
|
adminSendMessages: false, |
|
|
|
createdAt: DateTime.now(), |
|
|
|
updatedAt: DateTime.now(), |
|
|
|
); |
|
|
|
|
|
|
|
await db.insert( |
|
|
@ -131,6 +133,8 @@ class ConversationsRepository { |
|
|
|
adminAddMembers: maps[0]['admin_add_members'] == 1, |
|
|
|
adminEditInfo: maps[0]['admin_edit_info'] == 1, |
|
|
|
adminSendMessages: maps[0]['admin_send_messages'] == 1, |
|
|
|
createdAt: DateTime.parse(maps[0]['created_at']), |
|
|
|
updatedAt: DateTime.parse(maps[0]['updated_at']), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@ -163,6 +167,8 @@ class ConversationsRepository { |
|
|
|
adminAddMembers: maps[i]['admin_add_members'] == 1, |
|
|
|
adminEditInfo: maps[i]['admin_edit_info'] == 1, |
|
|
|
adminSendMessages: maps[i]['admin_send_messages'] == 1, |
|
|
|
createdAt: DateTime.parse(maps[i]['created_at']), |
|
|
|
updatedAt: DateTime.parse(maps[i]['updated_at']), |
|
|
|
); |
|
|
|
}); |
|
|
|
} |
|
|
@ -200,7 +206,23 @@ class ConversationsRepository { |
|
|
|
adminAddMembers: maps[0]['admin_add_members'] == 1, |
|
|
|
adminEditInfo: maps[0]['admin_edit_info'] == 1, |
|
|
|
adminSendMessages: maps[0]['admin_send_messages'] == 1, |
|
|
|
createdAt: DateTime.parse(maps[0]['created_at']), |
|
|
|
updatedAt: DateTime.parse(maps[0]['updated_at']), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
static Future<DateTime?> getLatestUpdatedAt() async { |
|
|
|
final db = await getDatabaseConnection(); |
|
|
|
|
|
|
|
final List<Map<String, dynamic>> maps = await db.rawQuery( |
|
|
|
''' |
|
|
|
SELECT conversations.updated_at FROM conversations |
|
|
|
ORDER BY updated_at DESC |
|
|
|
LIMIT 1; |
|
|
|
''' |
|
|
|
); |
|
|
|
|
|
|
|
return maps.isNotEmpty ? DateTime.parse(maps[0]['updated_at']) : null; |
|
|
|
} |
|
|
|
} |
|
|
|
|