28 lines
833 B
Dart
28 lines
833 B
Dart
import 'package:drift/drift.dart' show Value;
|
|
|
|
import 'package:timetrack/core/database/app_database.dart' as db;
|
|
import 'package:timetrack/features/entries/domain/time_entry.dart';
|
|
|
|
extension TimeEntryMapper on db.TimeEntry {
|
|
TimeEntry toDomain({List<String> tags = const []}) => TimeEntry(
|
|
id: id,
|
|
projectId: projectId,
|
|
startTime: startTime,
|
|
endTime: endTime,
|
|
durationSeconds: durationSeconds,
|
|
note: note,
|
|
tags: tags,
|
|
createdAt: createdAt,
|
|
);
|
|
}
|
|
|
|
extension TimeEntryDomainMapper on TimeEntry {
|
|
db.TimeEntriesCompanion toInsertCompanion() =>
|
|
db.TimeEntriesCompanion.insert(
|
|
projectId: projectId,
|
|
startTime: startTime,
|
|
endTime: Value(endTime),
|
|
durationSeconds: Value(durationSeconds),
|
|
note: Value(note),
|
|
);
|
|
}
|