20 lines
544 B
Dart
20 lines
544 B
Dart
import 'package:pmu/data/dtos/news_dto.dart';
|
|
import 'package:pmu/domain/models/card.dart';
|
|
import 'package:pmu/domain/models/home.dart';
|
|
|
|
extension NewDataDtoToModel on NewAttributesDataDto {
|
|
CardData toDomain() => CardData(
|
|
text: title ?? 'UNKNOWN',
|
|
imageUrl: imagelink,
|
|
descText: description ?? 'NOTHING',
|
|
id: id,
|
|
);
|
|
}
|
|
|
|
extension NewsDtoToModel on NewsDto {
|
|
HomeData toDomain() => HomeData(
|
|
data: data?.map((e) => e.toDomain()).toList(),
|
|
nextPage: meta?.pagination?.next,
|
|
);
|
|
}
|