diff --git a/front/components/SongRow.tsx b/front/components/SongRow.tsx index f695ead..4606b12 100644 --- a/front/components/SongRow.tsx +++ b/front/components/SongRow.tsx @@ -1,12 +1,12 @@ import { HStack, IconButton, Image, Text } from 'native-base'; -import Song, { SongWithArtist } from '../models/Song'; +import Song from '../models/Song'; import RowCustom from './RowCustom'; import TextButton from './TextButton'; import { MaterialIcons } from '@expo/vector-icons'; import DurationComponent from './DurationComponent'; type SongRowProps = { - song: Song | SongWithArtist; // TODO: remove Song + song: Song; isLiked: boolean; onPress: () => void; handleLike: (state: boolean, songId: number) => Promise; diff --git a/front/models/List.ts b/front/models/List.ts index 9ac2142..0fd5a75 100644 --- a/front/models/List.ts +++ b/front/models/List.ts @@ -7,5 +7,5 @@ export const ListHandler = ( itemHandler: ResponseHandler ): ResponseHandler => ({ validator: ListValidator(itemHandler.validator), - transformer: (plage) => plage.map((item) => itemHandler.transformer(item)), + transformer: (plage) => plage.map((item) => itemHandler.transformer?.(item) ?? item as unknown as R), }); diff --git a/front/models/Song.ts b/front/models/Song.ts index 67316b6..0e0229e 100644 --- a/front/models/Song.ts +++ b/front/models/Song.ts @@ -18,6 +18,7 @@ export const SongValidator = yup albumId: yup.number().required().nullable(), genreId: yup.number().required().nullable(), difficulties: SongDetailsValidator.required(), + details: SongDetailsValidator.required(), cover: yup.string().required(), artist: yup.lazy(() => ArtistValidator.default(undefined)).optional(), album: yup.lazy(() => AlbumValidator.default(undefined)).optional(), @@ -27,6 +28,7 @@ export const SongValidator = yup .transform((song: Song) => ({ ...song, cover: `${API.baseUrl}/song/${song.id}/illustration`, + details: song.difficulties, })); export type Song = yup.InferType;