As we explained earlier, we will isolate persistence concerns in the service layer. Let's implement the service interface now!
One great thing about functionally decomposing our application like this is that we can focus on specific parts of the system without necessarily thinking about the rest too much. In this case, we will focus on how we can persist and load data, as this will be the main responsibility of our media service.
The following is the service interface that we will later code against:
interface MediaService<T extends Media> { loadMediaCollection(identifier: string):
Promise<MediaCollection<T>>; saveMediaCollection(collection: Readonly<MediaCollection<T>>):
Promise<void>; getMediaCollectionIdentifiersList(): Promise<string[]>; removeMediaCollection(identifier...