в процессе

This commit is contained in:
bulatova_karina 2024-11-19 15:41:39 +04:00
parent ce0d99c433
commit 8421f194c6
3 changed files with 4 additions and 0 deletions

View File

@ -17,12 +17,14 @@ class FilmsDto {
@JsonSerializable(createToJson: false) @JsonSerializable(createToJson: false)
class FilmDataDto { class FilmDataDto {
final int? kinopoiskId;
final String nameRu; final String nameRu;
final int year; final int year;
final List<GenreDto> genres; final List<GenreDto> genres;
final String posterUrl; final String posterUrl;
const FilmDataDto({ const FilmDataDto({
required this.kinopoiskId,
required this.nameRu, required this.nameRu,
required this.year, required this.year,
required this.genres, required this.genres,

View File

@ -14,6 +14,7 @@ FilmsDto _$FilmsDtoFromJson(Map<String, dynamic> json) => FilmsDto(
); );
FilmDataDto _$FilmDataDtoFromJson(Map<String, dynamic> json) => FilmDataDto( FilmDataDto _$FilmDataDtoFromJson(Map<String, dynamic> json) => FilmDataDto(
kinopoiskId: (json['kinopoiskId'] as num?)?.toInt(),
nameRu: json['nameRu'] as String, nameRu: json['nameRu'] as String,
year: (json['year'] as num).toInt(), year: (json['year'] as num).toInt(),
genres: (json['genres'] as List<dynamic>) genres: (json['genres'] as List<dynamic>)

View File

@ -17,6 +17,7 @@ extension FilmDataDtoToModel on FilmDataDto {
nameRu, nameRu,
imageUrl: posterUrl ?? _imagePlaceholder, imageUrl: posterUrl ?? _imagePlaceholder,
descriptionText: _makeDescriptionText(year, genres), descriptionText: _makeDescriptionText(year, genres),
id: kinopoiskId.toString(),
); );
String _makeDescriptionText(int? year, List<GenreDto> genres) { String _makeDescriptionText(int? year, List<GenreDto> genres) {