Establish consistency in the terminology used for updation timestamp

This commit is contained in:
Vishnu Mohandas 2020-07-14 03:33:58 +05:30
parent e7a1e93e90
commit da94f954a5
3 changed files with 12 additions and 13 deletions

View file

@ -183,12 +183,11 @@ class FileDB {
} }
} }
Future<int> update( Future<int> update(int generatedId, int uploadedId, int updationTime) async {
int generatedId, int uploadedId, int updateTimestamp) async {
final db = await instance.database; final db = await instance.database;
final values = new Map<String, dynamic>(); final values = new Map<String, dynamic>();
values[columnUploadedFileId] = uploadedId; values[columnUploadedFileId] = uploadedId;
values[columnUpdationTime] = updateTimestamp; values[columnUpdationTime] = updationTime;
return await db.update( return await db.update(
table, table,
values, values,

View file

@ -18,7 +18,7 @@ class FolderDB {
static final columnOwner = 'owner'; static final columnOwner = 'owner';
static final columnDeviceFolder = 'device_folder'; static final columnDeviceFolder = 'device_folder';
static final columnSharedWith = 'shared_with'; static final columnSharedWith = 'shared_with';
static final columnUpdateTimestamp = 'update_timestamp'; static final columnUpdationTime = 'updation_time';
FolderDB._privateConstructor(); FolderDB._privateConstructor();
static final FolderDB instance = FolderDB._privateConstructor(); static final FolderDB instance = FolderDB._privateConstructor();
@ -45,7 +45,7 @@ class FolderDB {
$columnOwner TEXT NOT NULL, $columnOwner TEXT NOT NULL,
$columnDeviceFolder TEXT NOT NULL, $columnDeviceFolder TEXT NOT NULL,
$columnSharedWith TEXT NOT NULL, $columnSharedWith TEXT NOT NULL,
$columnUpdateTimestamp INTEGER NOT NULL, $columnUpdationTime INTEGER NOT NULL,
UNIQUE($columnOwner, $columnDeviceFolder) UNIQUE($columnOwner, $columnDeviceFolder)
) )
'''); ''');
@ -61,7 +61,7 @@ class FolderDB {
final db = await instance.database; final db = await instance.database;
final results = await db.query( final results = await db.query(
table, table,
orderBy: '$columnUpdateTimestamp DESC', orderBy: '$columnUpdationTime DESC',
); );
return _convertToFolders(results); return _convertToFolders(results);
} }
@ -90,7 +90,7 @@ class FolderDB {
row[columnOwner] = folder.owner; row[columnOwner] = folder.owner;
row[columnDeviceFolder] = folder.deviceFolder; row[columnDeviceFolder] = folder.deviceFolder;
row[columnSharedWith] = jsonEncode(folder.sharedWith.toList()); row[columnSharedWith] = jsonEncode(folder.sharedWith.toList());
row[columnUpdateTimestamp] = folder.updateTimestamp; row[columnUpdationTime] = folder.updationTime;
return row; return row;
} }
@ -103,7 +103,7 @@ class FolderDB {
(jsonDecode(row[columnSharedWith]) as List<dynamic>) (jsonDecode(row[columnSharedWith]) as List<dynamic>)
.cast<String>() .cast<String>()
.toSet(), .toSet(),
row[columnUpdateTimestamp], row[columnUpdationTime],
); );
} }
} }

View file

@ -8,7 +8,7 @@ class Folder {
final String owner; final String owner;
final String deviceFolder; final String deviceFolder;
final Set<String> sharedWith; final Set<String> sharedWith;
final int updateTimestamp; final int updationTime;
File thumbnailPhoto; File thumbnailPhoto;
Folder( Folder(
@ -17,7 +17,7 @@ class Folder {
this.owner, this.owner,
this.deviceFolder, this.deviceFolder,
this.sharedWith, this.sharedWith,
this.updateTimestamp, this.updationTime,
); );
static Folder fromMap(Map<String, dynamic> map) { static Folder fromMap(Map<String, dynamic> map) {
@ -29,13 +29,13 @@ class Folder {
map['owner'], map['owner'],
map['deviceFolder'], map['deviceFolder'],
Set<String>.from(map['sharedWith']), Set<String>.from(map['sharedWith']),
map['updateTimestamp'], map['updationTime'],
); );
} }
@override @override
String toString() { String toString() {
return 'Folder(id: $id, name: $name, owner: $owner, deviceFolder: $deviceFolder, sharedWith: $sharedWith, updateTimestamp: $updateTimestamp)'; return 'Folder(id: $id, name: $name, owner: $owner, deviceFolder: $deviceFolder, sharedWith: $sharedWith, updationTime: $updationTime)';
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
@ -45,7 +45,7 @@ class Folder {
'owner': owner, 'owner': owner,
'deviceFolder': deviceFolder, 'deviceFolder': deviceFolder,
'sharedWith': sharedWith.toList(), 'sharedWith': sharedWith.toList(),
'updateTimestamp': updateTimestamp, 'updationTime': updationTime,
}; };
} }