mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-10 19:03:12 +00:00
fix: Make dropletIds field for DigitalOceanVolume optional
This commit is contained in:
parent
f6424200e2
commit
65283306a9
|
@ -15,7 +15,7 @@ class DigitalOceanVolume {
|
|||
final String name;
|
||||
|
||||
@JsonKey(name: 'droplet_ids')
|
||||
final List<int> dropletIds;
|
||||
final List<int>? dropletIds;
|
||||
|
||||
@JsonKey(name: 'size_gigabytes')
|
||||
final int sizeGigabytes;
|
||||
|
|
|
@ -11,7 +11,7 @@ DigitalOceanVolume _$DigitalOceanVolumeFromJson(Map<String, dynamic> json) =>
|
|||
json['id'] as String,
|
||||
json['name'] as String,
|
||||
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) =>
|
||||
|
|
|
@ -647,7 +647,9 @@ class DigitalOceanServerProvider extends ServerProvider {
|
|||
name: volumeName,
|
||||
sizeByte: rawVolume.sizeGigabytes * 1024 * 1024 * 1024,
|
||||
serverId:
|
||||
rawVolume.dropletIds.isNotEmpty ? rawVolume.dropletIds[0] : null,
|
||||
(rawVolume.dropletIds != null && rawVolume.dropletIds!.isNotEmpty)
|
||||
? rawVolume.dropletIds![0]
|
||||
: null,
|
||||
linuxDevice: 'scsi-0DO_Volume_$volumeName',
|
||||
uuid: rawVolume.id,
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue