Frontend first draft
This commit is contained in:
30
frontend/pshared/lib/models/storable.dart
Normal file
30
frontend/pshared/lib/models/storable.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:pshared/config/constants.dart';
|
||||
|
||||
|
||||
abstract class Storable {
|
||||
String get id;
|
||||
DateTime get createdAt;
|
||||
DateTime get updatedAt;
|
||||
}
|
||||
|
||||
class _StorableImp implements Storable {
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final DateTime createdAt;
|
||||
@override
|
||||
final DateTime updatedAt;
|
||||
|
||||
const _StorableImp({
|
||||
required this.id,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Storable newStorable({String? id, DateTime? createdAt, DateTime? updatedAt}) => _StorableImp(
|
||||
id: id ?? Constants.nilObjectRef,
|
||||
createdAt: createdAt ?? DateTime.now().toUtc(),
|
||||
updatedAt: updatedAt ?? DateTime.now().toUtc(),
|
||||
);
|
||||
Reference in New Issue
Block a user