Initial commit
This commit is contained in:
39
lib/data/mappers/exercise_mapper.dart
Normal file
39
lib/data/mappers/exercise_mapper.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:trainhub_flutter/data/database/app_database.dart';
|
||||
import 'package:trainhub_flutter/domain/entities/exercise.dart';
|
||||
|
||||
class ExerciseMapper {
|
||||
ExerciseMapper._();
|
||||
|
||||
static ExerciseEntity toEntity(Exercise row) {
|
||||
return ExerciseEntity(
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
instructions: row.instructions,
|
||||
enrichment: row.enrichment,
|
||||
tags: row.tags,
|
||||
videoUrl: row.videoUrl,
|
||||
);
|
||||
}
|
||||
|
||||
static ExercisesCompanion toCompanion(ExerciseEntity entity) {
|
||||
return ExercisesCompanion(
|
||||
id: Value(entity.id),
|
||||
name: Value(entity.name),
|
||||
instructions: Value(entity.instructions),
|
||||
enrichment: Value(entity.enrichment),
|
||||
tags: Value(entity.tags),
|
||||
videoUrl: Value(entity.videoUrl),
|
||||
);
|
||||
}
|
||||
|
||||
static ExercisesCompanion toUpdateCompanion(ExerciseEntity entity) {
|
||||
return ExercisesCompanion(
|
||||
name: Value(entity.name),
|
||||
instructions: Value(entity.instructions),
|
||||
enrichment: Value(entity.enrichment),
|
||||
tags: Value(entity.tags),
|
||||
videoUrl: Value(entity.videoUrl),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user