pmu_kursach/lib/data/mappers/characters_mapper.dart

18 lines
557 B
Dart
Raw Permalink Normal View History

2024-12-16 19:00:34 +04:00
import 'package:kursach/data/dtos/artists_dto.dart';
import 'package:kursach/domain/models/card_data.dart';
import 'package:kursach/domain/models/home_data.dart';
extension ArtistDataDtoToModel on ArtistDataDto {
CardData toDomain() => CardData(
id: id,
name: name ?? "UNKNOWN",
image: "http://10.0.2.2:8080${image}",
year_streams: year_streams ?? 0);
}
extension ArtistsDtoToModel on ArtistsDto {
HomeData toDomain() => HomeData(
data: data?.map((e) => e.toDomain()).toList(),
nextPage: meta?.pagination?.next);
}