mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-03-11 17:24:09 +00:00
fix: Make dropletIds field for DigitalOceanVolume optional
This commit is contained in:
parent
f6424200e2
commit
65283306a9
3 changed files with 5 additions and 3 deletions
lib/logic
models/json
providers/server_providers
|
@ -15,7 +15,7 @@ class DigitalOceanVolume {
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
@JsonKey(name: 'droplet_ids')
|
@JsonKey(name: 'droplet_ids')
|
||||||
final List<int> dropletIds;
|
final List<int>? dropletIds;
|
||||||
|
|
||||||
@JsonKey(name: 'size_gigabytes')
|
@JsonKey(name: 'size_gigabytes')
|
||||||
final int sizeGigabytes;
|
final int sizeGigabytes;
|
||||||
|
|
|
@ -11,7 +11,7 @@ DigitalOceanVolume _$DigitalOceanVolumeFromJson(Map<String, dynamic> json) =>
|
||||||
json['id'] as String,
|
json['id'] as String,
|
||||||
json['name'] as String,
|
json['name'] as String,
|
||||||
json['size_gigabytes'] as int,
|
json['size_gigabytes'] as int,
|
||||||
(json['droplet_ids'] as List<dynamic>).map((e) => e as int).toList(),
|
(json['droplet_ids'] as List<dynamic>?)?.map((e) => e as int).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$DigitalOceanVolumeToJson(DigitalOceanVolume instance) =>
|
Map<String, dynamic> _$DigitalOceanVolumeToJson(DigitalOceanVolume instance) =>
|
||||||
|
|
|
@ -647,7 +647,9 @@ class DigitalOceanServerProvider extends ServerProvider {
|
||||||
name: volumeName,
|
name: volumeName,
|
||||||
sizeByte: rawVolume.sizeGigabytes * 1024 * 1024 * 1024,
|
sizeByte: rawVolume.sizeGigabytes * 1024 * 1024 * 1024,
|
||||||
serverId:
|
serverId:
|
||||||
rawVolume.dropletIds.isNotEmpty ? rawVolume.dropletIds[0] : null,
|
(rawVolume.dropletIds != null && rawVolume.dropletIds!.isNotEmpty)
|
||||||
|
? rawVolume.dropletIds![0]
|
||||||
|
: null,
|
||||||
linuxDevice: 'scsi-0DO_Volume_$volumeName',
|
linuxDevice: 'scsi-0DO_Volume_$volumeName',
|
||||||
uuid: rawVolume.id,
|
uuid: rawVolume.id,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue