feat(mobile): edit date time action
This commit is contained in:
@@ -53,6 +53,7 @@ extension RemoteAssetEntityDataDomainEx on RemoteAssetEntityData {
|
||||
isFavorite: isFavorite,
|
||||
height: height,
|
||||
width: width,
|
||||
localDateTime: localDateTime,
|
||||
thumbHash: thumbHash,
|
||||
visibility: visibility,
|
||||
livePhotoVideoId: livePhotoVideoId,
|
||||
|
||||
@@ -100,6 +100,13 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
||||
.getSingleOrNull();
|
||||
}
|
||||
|
||||
Future<RemoteAsset?> getAsset(String id) {
|
||||
return _db.managers.remoteAssetEntity
|
||||
.filter((row) => row.id.equals(id))
|
||||
.map((row) => row.toDto())
|
||||
.getSingleOrNull();
|
||||
}
|
||||
|
||||
Future<List<(String, String)>> getPlaces() {
|
||||
final asset = Subquery(
|
||||
_db.remoteAssetEntity.select()
|
||||
@@ -203,6 +210,29 @@ class RemoteAssetRepository extends DriftDatabaseRepository {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> updateDateTime(List<String> ids, String dateTime) {
|
||||
final localDateTime =
|
||||
dateTime.replaceAll(RegExp(r'[\+|-][0-9]{2}:[0-9]{2}'), '');
|
||||
return _db.batch((batch) async {
|
||||
for (final id in ids) {
|
||||
batch.update(
|
||||
_db.remoteAssetEntity,
|
||||
RemoteAssetEntityCompanion(
|
||||
localDateTime: Value(DateTime.parse(localDateTime).toUtc()),
|
||||
),
|
||||
where: (e) => e.id.equals(id),
|
||||
);
|
||||
batch.update(
|
||||
_db.remoteExifEntity,
|
||||
RemoteExifEntityCompanion(
|
||||
dateTimeOriginal: Value(DateTime.parse(dateTime)),
|
||||
),
|
||||
where: (e) => e.assetId.equals(id),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> stack(String userId, StackResponse stack) {
|
||||
return _db.transaction(() async {
|
||||
final stackIds = await _db.managers.stackEntity
|
||||
|
||||
Reference in New Issue
Block a user