selfprivacy.org.app/lib/logic/models/server_details.dart

60 lines
1 KiB
Dart
Raw Normal View History

2021-01-06 17:35:57 +00:00
import 'package:hive/hive.dart';
part 'server_details.g.dart';
@HiveType(typeId: 2)
class HetznerServerDetails {
HetznerServerDetails({
2021-03-15 15:39:44 +00:00
required this.ip4,
required this.id,
required this.createTime,
2021-03-30 17:38:40 +00:00
required this.dataBase,
2021-11-18 19:10:40 +00:00
required this.apiToken,
2021-01-19 12:05:40 +00:00
this.startTime,
2021-01-06 17:35:57 +00:00
});
@HiveField(0)
2021-03-30 17:38:40 +00:00
final String ip4;
2021-01-06 17:35:57 +00:00
@HiveField(1)
2021-03-30 17:38:40 +00:00
final int id;
2021-01-06 17:35:57 +00:00
2021-01-19 12:05:40 +00:00
@HiveField(3)
2021-03-15 15:39:44 +00:00
final DateTime? createTime;
2021-01-19 12:05:40 +00:00
2021-01-21 21:01:42 +00:00
@HiveField(2)
2021-03-15 15:39:44 +00:00
final DateTime? startTime;
2021-01-21 21:01:42 +00:00
2021-03-30 17:38:40 +00:00
@HiveField(4)
final HetznerDataBase dataBase;
2021-11-18 19:10:40 +00:00
@HiveField(5)
final String apiToken;
2021-03-15 15:39:44 +00:00
HetznerServerDetails copyWith({DateTime? startTime}) {
2021-01-19 12:05:40 +00:00
return HetznerServerDetails(
startTime: startTime ?? this.startTime,
createTime: createTime,
id: id,
ip4: ip4,
2021-03-30 17:38:40 +00:00
dataBase: dataBase,
2021-11-18 19:10:40 +00:00
apiToken: apiToken,
2021-01-19 12:05:40 +00:00
);
}
2021-01-06 17:35:57 +00:00
String toString() => id.toString();
}
2021-03-30 17:38:40 +00:00
@HiveType(typeId: 5)
class HetznerDataBase {
HetznerDataBase({
required this.id,
required this.name,
});
@HiveField(1)
int id;
@HiveField(2)
String name;
}