Commit 23fc5b51 authored by Michal Cikatricis's avatar Michal Cikatricis
Browse files

Feat : added timestamp to postcard

parent d1ba46e7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ class PostcardEntity {
  final String text;
  final String senderId;
  final String? receiverId;
  final String timestamp;

  const PostcardEntity({
    required this.id,
@@ -22,6 +23,7 @@ class PostcardEntity {
    required this.text,
    required this.senderId,
    this.receiverId,
    required this.timestamp
  });

  factory PostcardEntity.fromJson(Map<String, dynamic> json) => _$PostcardEntityFromJson(json);
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ PostcardEntity _$PostcardEntityFromJson(Map<String, dynamic> json) =>
      text: json['text'] as String,
      senderId: json['senderId'] as String,
      receiverId: json['receiverId'] as String?,
      timestamp: json['timestamp'] as String,
    );

Map<String, dynamic> _$PostcardEntityToJson(PostcardEntity instance) =>
@@ -28,4 +29,5 @@ Map<String, dynamic> _$PostcardEntityToJson(PostcardEntity instance) =>
      'text': instance.text,
      'senderId': instance.senderId,
      'receiverId': instance.receiverId,
      'timestamp': instance.timestamp,
    };
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ class Postcard {
  final String text;
  final User sender;
  final User? receiver;
  final DateTime timestamp;

  const Postcard({
    required this.id,
@@ -19,5 +20,6 @@ class Postcard {
    required this.text,
    required this.sender,
    this.receiver,
    required this.timestamp,
  });
}
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class PostcardTile extends StatelessWidget {
          userName: 'userName',
          profilePicture: 'profilePicture',
          lastLocation: 'lastLocation',
          isAdmin: true),
          isAdmin: true), timestamp: DateTime.parse('2023-07-20 20:18:04Z'),
    ); // create a new instance of Postcard
    return PostcardTile(
      postcard: postcard,
+10 −8
Original line number Diff line number Diff line
@@ -46,7 +46,9 @@ class PostcardService {
          destinationLocation: p.destinationLocation,
          text: p.text,
          sender: sender,
            receiver: receiver);
          receiver: receiver,
          timestamp: DateTime.parse(p.timestamp),
        );
      }).toList(),
    );
  }