refactor: Projektstruktur in app/ und backend/ aufgeteilt
This commit is contained in:
51
app/lib/models/queued_message.dart
Normal file
51
app/lib/models/queued_message.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
class QueuedMessage {
|
||||
final String id;
|
||||
final String topic;
|
||||
final Map<String, dynamic> payload;
|
||||
final DateTime createdAt;
|
||||
final int retryCount;
|
||||
|
||||
QueuedMessage({
|
||||
required this.id,
|
||||
required this.topic,
|
||||
required this.payload,
|
||||
required this.createdAt,
|
||||
this.retryCount = 0,
|
||||
});
|
||||
|
||||
factory QueuedMessage.fromJson(Map<String, dynamic> json) {
|
||||
return QueuedMessage(
|
||||
id: json['id'],
|
||||
topic: json['topic'],
|
||||
payload: Map<String, dynamic>.from(json['payload']),
|
||||
createdAt: DateTime.parse(json['createdAt']),
|
||||
retryCount: json['retryCount'] ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'topic': topic,
|
||||
'payload': payload,
|
||||
'createdAt': createdAt.toIso8601String(),
|
||||
'retryCount': retryCount,
|
||||
};
|
||||
}
|
||||
|
||||
QueuedMessage copyWith({
|
||||
String? id,
|
||||
String? topic,
|
||||
Map<String, dynamic>? payload,
|
||||
DateTime? createdAt,
|
||||
int? retryCount,
|
||||
}) {
|
||||
return QueuedMessage(
|
||||
id: id ?? this.id,
|
||||
topic: topic ?? this.topic,
|
||||
payload: payload ?? this.payload,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
retryCount: retryCount ?? this.retryCount,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user