Adds the capability of adding a Book via API

This commit is contained in:
BinaryAlley committed 2024-08-24 22:11:55 +03:00
1 parent 6459b6f2c2
commit 0eb7b453f6
61 files changed
+1276 -255

No files matched your search

@@ -0,0 +1,51 @@
- [Lumina Domain](#lumina-domain)
- [File Management Aggregate](#file-management-aggregate)
- [File Info](#file-info)
- [Stream Info](#stream-info)
# [Lumina Domain](#lumina-domain)
## [File Management Aggregate](#file-management-aggregate)
### [File Info](#file-info)
```csharp
class FileInfo
{
ErrorOr<FileInfo> Create(string path, string fileExtension, long sizeInBytes, DateTime lastModified, Optional<string> mimeType);
}
```
```json
{
"path": "/media/movies/The Lord of the Rings - The Fellowship of the Ring.mkw",
"fileExtension": "mkv",
"sizeInBytes": 15797942704,
"lastModified": "2024-08-18",
"mimeType": "video/x-matroska"
}
```
### [Stream Info](#stream-info)
```csharp
class StreamInfo
{
ErrorOr<StreamInfo> Create(string streamId, string mimeType, int bitrate, string codec,
Optional<string> resolution = default, Optional<float> frameRate = default,
Optional<int> sampleRate = default, Optional<int> channels = default);
}
```
```json
{
"streamId": "stream_001",
"mimeType": "video/mp4",
"bitrate": 5000000,
"codec": "h264",
"resolution": "1920x1080",
"frameRate": 29.97,
"sampleRate": 48000,
"channels": 2
}
```
@@ -0,0 +1,71 @@
- [Lumina Domain](#lumina-domain)
- [Video Library Aggregate](#video-library-aggregate)
- [Movie](#movie)
# [Lumina Domain](#lumina-domain)
## [Video Library Aggregate](#video-library-aggregate)
### [Movie](#movie)
```csharp
class Movie
{
ErrorOr<Movie> Create(MovieId id, VideoMetadata metadata, List<MediaContributorId> contributors);
}
```
```json
{
"id": { "value": "00000000-0000-0000-0000-000000000000" },
"metadata": {
"title": "The Lord of the Rings - The Fellowship of the Ring",
"originalTitle": "The Lord of the Rings - The Fellowship of the Ring",
"description": "The greatest fantasy movie ever made",
"releaseInfo": {
"originalReleaseDate": "2001-12-19",
"originalReleaseYear": 2001,
"reReleaseDate": "2024-06-08",
"reReleaseYear": 2024,
"releaseCountry": "us",
"releaseVersion": "Director's Cut"
},
"language": {
"languageCode": "en",
"languageName": "English",
"nativeName": "English"
},
"originalLanguage": {
"languageCode": "en",
"languageName": "English",
"nativeName": "English"
},
"tags": [
{ "name": "epic quest" },
{ "name": "friendship" },
{ "name": "middle-earth" }
],
"genres": [
{ "name": "fantasy" },
{ "name": "adventure" },
{ "name": "action" }
],
"durationInSeconds": 10680,
"resolution": "3840x2160",
"frameRate": 29.97,
"videoCodec": "h.265/hevc",
"audioCodec": "FLAC"
},
"contributors": [
{ "value": "00000000-0000-0000-0000-000000000000" }
],
"ratings": [
{
"value": 9.8,
"maxValue": 10.0,
"source": "TheMovieDb",
"voteCount": 1547036
}
]
}
```
@@ -0,0 +1,122 @@
- [Lumina Domain](#lumina-domain)
- [Written Content Library Aggregate](#written-content-library-aggregate)
- [Book](#book)
# [Lumina Domain](#lumina-domain)
## [Written Content Library Aggregate](#written-content-library-aggregate)
### [Book](#book)
```csharp
class Book
{
ErrorOr<Book> Create(
WrittenContentMetadata metadata,
BookFormat format,
Optional<string> edition,
Optional<int> volumeNumber,
Optional<string> series,
Optional<string> asin,
Optional<string> goodreadsId,
Optional<string> lccn,
Optional<string> oclcNumber,
Optional<string> openLibraryId,
Optional<string> libraryThingId,
Optional<string> googleBooksId,
Optional<string> barnesAndNobleId,
Optional<string> koboId,
Optional<string> appleBooksId,
List<Isbn> isbns,
List<MediaContributorId> contributors,
List<Rating> ratings);
}
```
```json
{
"id": {
"value": "00000000-0000-0000-0000-000000000000"
},
"metadata": {
"title": "The Lord of the Rings: The Fellowship of the Ring",
"originalTitle": "The Fellowship of the Ring",
"description": "The first part of J.R.R. Tolkien's epic adventure The Lord of the Rings. In a sleepy village in the Shire, young Frodo Baggins finds himself faced with an immense task, as his elderly cousin Bilbo entrusts the Ring to his care. Frodo must leave his home and make a perilous journey across Middle-earth to the Cracks of Doom, there to destroy the Ring and foil the Dark Lord in his evil purpose.",
"releaseInfo": {
"originalReleaseDate": "1954-07-29",
"originalReleaseYear": 1954,
"reReleaseDate": "2001-09-06",
"reReleaseYear": 2001,
"releaseCountry": "uk",
"releaseVersion": "50th Anniversary Edition"
},
"genres": [
{ "name": "fantasy" },
{ "name": "adventure" },
{ "name": "classic" }
],
"tags": [
{ "name": "epic fantasy" },
{ "name": "quest" },
{ "name": "middle-earth" }
],
"language": {
"languageCode": "en",
"languageName": "English",
"nativeName": "English"
},
"originalLanguage": {
"languageCode": "en",
"languageName": "English",
"nativeName": "English"
},
"publisher": "Houghton Mifflin",
"pageCount": 398
},
"format": "Paperback",
"edition": "50th Anniversary Edition",
"volumeNumber": 1,
"series": "The Lord of the Rings",
"asin": "B007978NPG",
"goodreadsId": "3",
"lccn": "2001025199",
"oclcNumber": "48494995",
"openLibraryId": "OL7603910M",
"libraryThingId": "3203347",
"googleBooksId": "aWZzLPhY4o0C",
"barnesAndNobleId": "1100307790",
"koboId": "the-fellowship-of-the-ring",
"appleBooksId": "id395211",
"isbns": [
{
{
"value": "0395272238",
"format": "Isbn10"
},
{
"value": "9780395272237",
"format": "Isbn13"
}
}
],
"contributors": [
{
"value": "00000000-0000-0000-0000-000000000000",
}
],
"ratings": [
{
"source": "Goodreads",
"value": 4.36,
"maxValue": 5,
"voteCount": 2345678
},
{
"source": "Amazon",
"value": 4.7,
"maxValue": 5,
"voteCount": 87654
}
]
}
```
+100
View File
@@ -0,0 +1,100 @@
- [Lumina Domain](#lumina-domain)
- [Common](#common)
- [Metadata](#metadata)
- [Genre](#genre)
- [Tag](#tag)
- [Rating](#rating)
- [Release Info](#release-info)
- [Language Info](#language-info)
# [Lumina Domain](#lumina-domain)
## [Common](#common)
### [Metadata](#metadata)
#### [Genre](#genre)
```csharp
class Genre
{
ErrorOr<Genre> Create(string name);
}
```
```json
{
"name": "SF"
}
```
#### [Tag](#tag)
```csharp
class Tag
{
ErrorOr<Tag> Create(string name);
}
```
```json
{
"name": "artificial intelligence"
}
```
#### [Rating](#rating)
```csharp
class Rating
{
ErrorOr<Rating> Create(decimal value, decimal maxValue, Optional<RatingSource> source = default, Optional<int> voteCount = default);
}
```
```json
{
"value": 9.3,
"maxValue": 10.0,
"source": "Imdb",
"voteCount": 84
}
```
#### [Release Info](#release-info)
```csharp
class ReleaseInfo
{
ErrorOr<ReleaseInfo> Create(Optional<DateOnly> originalReleaseDate, Optional<int> originalReleaseYear,
Optional<DateOnly> reReleaseDate, Optional<int> reReleaseYear, Optional<string> releaseCountry, Optional<string> releaseVersion);
}
```
```json
{
"originalReleaseDate": "2024-08-18",
"originalReleaseYear": 2024,
"reReleaseDate": "2024-08-18",
"reReleaseYear": 2024,
"releaseCountry": "JP",
"releaseVersion": "director's cut"
}
```
#### [Language Info](#language-info)
```csharp
class LanguageInfo
{
ErrorOr<LanguageInfo> Create(string languageCode, string languageName, Optional<string> nativeName);
}
```
```json
{
"languageCode": "FR",
"languageName": "French",
"nativeName": "Française",
}
```
+236
View File
@@ -0,0 +1,236 @@
# Ubiquitous Language
## General Concepts
- _**Media Library**_: The overall collection of various media types
- _**Metadata**_: Information describing a media item
- _**User**_: A person who interacts with the media library
- _**Playlist**_: A curated list of media items, potentially cross-media-type
- _**Tag**_: A label for categorizing and organizing media items
- _**Collection**_: A user-defined group of any media items
- _**File**_: The actual digital file of a media item
- _**Stream**_: A media item accessed via streaming rather than local storage
- _**Language Track**_: An audio or text track in a specific language
## Video Content
- _**TV Show**_: A series of episodes typically organized into seasons
- _**Season**_: A grouping of episodes within a TV show
- _**Episode**_: An individual installment of a TV show
- _**Movie**_: A standalone film
- _**Film Series**_: A collection of related movies (e.g., The Lord of the Rings trilogy)
- _**Film Franchise**_: A broader collection of related movies (e.g., James Bond films)
- _**Concert Video**_: Recording of a live music performance
- _**Documentary**_: Non-fiction film or series
- _**Tutorial/Instructional Video**_: Educational content
- _**Home Video**_: Personal recordings
- _**Anime**_: Japanese animation, which may have different categorization needs
- _**YouTube Video**_: A video hosted on YouTube, with its own metadata structure
- _**Music Video**_: A video representation of a song
## Audio Content
- _**Song**_: An individual music track
- _**Album**_: A collection of songs
- _**Artist**_: The creator of music content
- _**Audiobook**_: A narrated version of a book
- _**Live Recording**_: Audio or video of a live performance
- _**Interview**_: Audio or video recording of a conversation
- _**Cover Song**_: A rendition of a song performed by an artist other than the original
- _**Remix**_: A modified version of an original song
- _**Sound Effect**_: A short audio clip used for specific purposes
- _**Podcast**_: A series of audio episodes
- _**Podcast Episode**_: An individual installment of a podcast
## Written Content
- _**Book**_: A standalone written work
- _**E-book**_: A digital version of a book
- _**Book Series**_: A collection of related books
- _**Comic Book**_: A single issue of a comic
- _**Comic Series**_: A collection of related comic books
- _**Magazine**_: A periodical publication
- _**Magazine Issue**_: A single edition of a magazine
- _**Manga**_: Japanese comics with specific formatting and reading direction
- _**Graphic Novel**_: Long-form comic book
- _**Academic Paper**_: Scholarly article
- _**Sheet Music**_: Musical notation for songs
## Visual Content
- _**Photo**_: An individual image
- _**Photo Album**_: A collection of related photos
## Miscellaneous Media
- _**Subtitle File**_: Text file synchronized with video content
- _**Lyrics**_: Text of a song, potentially time-synced
- _**Album Artwork**_: Visual representation of an album
- _**Movie Poster**_: Promotional image for a film
- _**Screenplay**_: Script for a film or TV show
## Entities
- TVShow
- Season
- Episode
- Movie
- FilmSeries
- ConcertVideo
- Documentary
- TutorialVideo
- HomeVideo
- Anime
- YouTubeVideo
- MusicVideo
- Song
- Album
- Artist
- Audiobook
- LiveRecording
- Interview
- CoverSong
- Remix
- SoundEffect
- Podcast
- PodcastEpisode
- Book
- BookSeries
- ComicBook
- ComicSeries
- Magazine
- MagazineIssue
- Manga
- GraphicNovel
- AcademicPaper
- SheetMusic
- Photo
- PhotoAlbum
- User
- Playlist
- Collection
- SubtitleFile
- Lyrics
- AlbumArtwork
- MoviePoster
- Screenplay
- File
- Stream
- LanguageTrack
## Aggregates
- VideoLibrary (root: VideoLibrary, entities: TVShow, Season, Episode, Movie, FilmSeries, ConcertVideo, Documentary, TutorialVideo, HomeVideo, Anime, YouTubeVideo, MusicVideo)
- AudioLibrary (root: AudioLibrary, entities: Song, Album, Artist, Audiobook, LiveRecording, Interview, CoverSong, Remix, SoundEffect)
- PodcastLibrary (root: PodcastLibrary, entities: Podcast, PodcastEpisode)
- WrittenContentLibrary (root: WrittenContentLibrary, entities: Book, BookSeries, ComicBook, ComicSeries, Magazine, MagazineIssue, Manga, GraphicNovel, AcademicPaper, SheetMusic, Screenplay)
- PhotoLibrary (root: PhotoLibrary, entities: Photo, PhotoAlbum, AlbumArtwork, MoviePoster)
- UserProfile (root: User, entities: Playlist, Collection)
- SupplementaryContentLibrary (root: SupplementaryContentLibrary, entities: SubtitleFile, Lyrics, LanguageTrack)
- FileManagement (root: File, entities: Stream)
- WrittenContentLibrary
- BookLibrary (root: BookLibrary)
- Entities: Book, BookSeries
- Value Objects: BookMetadata, SeriesInfo
- ComicLibrary (root: ComicLibrary)
- Entities: ComicBook, ComicSeries, Manga, GraphicNovel
- Value Objects: ComicMetadata, SeriesInfo
- PeriodicalLibrary (root: PeriodicalLibrary)
- Entities: Magazine, MagazineIssue
- Value Objects: PeriodicalMetadata, IssueInfo
- AcademicLibrary (root: AcademicLibrary)
- Entities: AcademicPaper
- Value Objects: AcademicMetadata, CitationInfo
- MiscWrittenContentLibrary (root: MiscWrittenContentLibrary)
- Entities: SheetMusic, Screenplay
- Value Objects: SheetMusicMetadata, ScreenplayMetadata
## Value Objects
- BaseMetadata
- VideoMetadata
- MovieMetadata
- TVShowMetadata
- DocumentaryMetadata
- TutorialMetadata
- AnimeMetadata
- AudioMetadata
- PodcastMetadata
- AudiobookMetadata
- LiveRecordingMetadata
- InterviewMetadata
- RemixInfo
- BookMetadata
- ComicMetadata
- MagazineMetadata
- MangaMetadata
- AcademicMetadata
- PhotoMetadata
- SheetMusicInfo
- SubtitleInfo
- LyricsInfo
- ArtworkInfo
- FileInfo
- StreamInfo
- StreamingQuality
- UserPreferences
- Rating
- Genre
- ReleaseInfo
- LanguageInfo
## Domain Services
- MediaScanner (with specialized scanners for each media type)
- MetadataFetcher (with different strategies for various media types and sources)
- TranscodingService
- StreamingService
- AudiobookPlaybackService
- LiveContentManager
- RemixDetectionService
- AnimeCategorizationService
- AcademicContentIndexer
- LyricsMatchingService
- ArtworkManagementService
- SearchService
- RecommendationEngine
- FileManagementService
- LanguageTrackManager
- CrossMediaRelationshipManager
- ContentCurationService
- UserActivityTrackingService
- ContentSynchronizationService
## Domain Events
- MediaItemAdded
- MediaItemRemoved
- PlaylistCreated
- PlaylistUpdated
- UserPreferencesChanged
- MetadataUpdated
- FileTranscoded
- StreamStarted
- StreamEnded
## Bounded Contexts
- MediaManagement
- Aggregates: VideoLibrary, AudioLibrary, PodcastLibrary, WrittenContentLibrary, PhotoLibrary
- Services: MediaScanner, MetadataFetcher, TranscodingService
- UserExperience
- Aggregates: UserProfile
- Services: RecommendationEngine, ContentCurationService, UserActivityTrackingService
- ContentDelivery
- Aggregates: FileManagement
- Services: StreamingService, ContentSynchronizationService
- MetadataManagement
- Aggregates: SupplementaryContentLibrary
- Services: LyricsMatchingService, ArtworkManagementService
## Repositories
- VideoRepository
- AudioRepository
- PodcastRepository
- WrittenContentRepository
- PhotoRepository
- UserRepository
- PlaylistRepository
- CollectionRepository
- FileRepository
- StreamRepository