Files
trainhub-flutter/lib/data/mappers/exercise_mapper.dart
Kazimierz Ciołek 782986a632 Initial commit
2026-02-19 02:49:29 +01:00

40 lines
1.1 KiB
Dart

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),
);
}
}