21 lines
940 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:pmd_labs/data/dtos/movies_dto.dart';
import 'package:pmd_labs/domain/models/carddata.dart';
import 'package:pmd_labs/presentation/home_page/home_page.dart';
extension MovieDataDtoMapper on MovieDataDto {
CardData toDomain() => CardData(
name ?? 'UNKNOWN', // Исправлено с title на name
imageUrl: poster?.url, // Обратите внимание, что используем правильно поле
id: id?.toString() ?? '0', // Защита от null, если id нет
descriptionText: description ?? 'Нет описания', // Используем реальное описание
);
}
extension MoviesDtoToModel on MoviesDto {
HomeData toDomain() => HomeData(
data: docs?.map((e) => e.toDomain()).toList(), // Изменено с data на docs
nextPage: (pagination?.hasNextPage ?? false)
? ((pagination?.currentPage ?? 0) + 1)
: null
);
}