Vorbereitung Release 0.2.0 #83
@@ -6,6 +6,23 @@
|
||||
@if (publisher()) {
|
||||
<section>
|
||||
<h2>{{ publisher().name }}</h2>
|
||||
@if (publisher().parent_publisher) {
|
||||
<app-comic-publisher [publisher]="publisher().parent_publisher" />
|
||||
}
|
||||
</section>
|
||||
<section>
|
||||
@for (imprint of publisher().imprints; track imprint.id) {
|
||||
<article>
|
||||
<app-comic-publisher [publisher]="imprint" />
|
||||
</article>
|
||||
}
|
||||
</section>
|
||||
<section>
|
||||
@for (comic of publisher().comics; track comic.id) {
|
||||
<article>
|
||||
<app-comic-comic [comic]="comic" />
|
||||
</article>
|
||||
}
|
||||
</section>
|
||||
} @else {
|
||||
<h2>Publisher Details</h2>
|
||||
|
||||
@@ -3,15 +3,17 @@ import { Publisher, PublisherDetails } from '../comic.model';
|
||||
import { ComicPublishersListComponent } from '../comic-publishers-list/comic-publishers-list.component';
|
||||
import { ActivatedRouteSnapshot, ResolveFn, RouterStateSnapshot } from '@angular/router';
|
||||
import { PublisherService } from './publisher.service';
|
||||
import { ComicPublisherComponent } from "../comic-publisher/comic-publisher.component";
|
||||
import { ComicComicComponent } from "../comic-comic/comic-comic.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-comic-publishers',
|
||||
imports: [ComicPublishersListComponent],
|
||||
imports: [ComicPublishersListComponent, ComicPublisherComponent, ComicComicComponent],
|
||||
templateUrl: './comic-publishers.component.html',
|
||||
styleUrl: './comic-publishers.component.css'
|
||||
})
|
||||
export class ComicPublishersComponent {
|
||||
publisher = input.required<Publisher>();
|
||||
publisher = input.required<PublisherDetails>();
|
||||
}
|
||||
|
||||
export const publisherResolver: ResolveFn<PublisherDetails> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
|
||||
|
||||
@@ -13,11 +13,6 @@ export interface Publisher {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PublisherDetails {
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
}
|
||||
export interface Comic {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -47,6 +42,14 @@ export interface ComicWorktypeArtists {
|
||||
artists: Artist[];
|
||||
}
|
||||
|
||||
export interface PublisherDetails {
|
||||
id: string;
|
||||
name: string;
|
||||
parent_publisher: Publisher;
|
||||
imprints: Publisher[];
|
||||
comics: Comic[];
|
||||
}
|
||||
|
||||
export interface ComicDetails {
|
||||
id: string;
|
||||
created: string;
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
from typing import List
|
||||
|
||||
from src.db.models.comic import Publisher
|
||||
from src.schema.comics.comic import ComicResponse
|
||||
from src.schema.comics.publisher import PublisherResponse
|
||||
from src.schema.comics.publisher_details import PublisherDetailsResponse
|
||||
|
||||
|
||||
def get_publisher_details(publisher: Publisher):
|
||||
response: PublisherDetailsResponse = PublisherDetailsResponse(id=publisher.id, name=str(publisher.name))
|
||||
def get_publisher_details(publisher: Publisher) -> PublisherDetailsResponse:
|
||||
imprints: List[PublisherResponse] = []
|
||||
for imprint in publisher.imprints:
|
||||
imprints.append(PublisherResponse(id=imprint.id, name=str(imprint.name)))
|
||||
comics: List[ComicResponse] = []
|
||||
for comic in publisher.comics:
|
||||
comics.append(
|
||||
ComicResponse(id=comic.id, title=comic.title, completed=comic.completed)
|
||||
)
|
||||
parent_publisher: PublisherResponse | None = None
|
||||
if publisher.parent_publisher:
|
||||
parent_publisher = PublisherResponse(id=publisher.parent_publisher.id, name=str(publisher.parent_publisher.name))
|
||||
response: PublisherDetailsResponse = PublisherDetailsResponse(
|
||||
id=publisher.id, name=str(publisher.name), parent_publisher=parent_publisher, imprints=imprints, comics=comics
|
||||
)
|
||||
return response
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.schema.comics.comic import ComicResponse
|
||||
from src.schema.comics.publisher import PublisherResponse
|
||||
|
||||
|
||||
class PublisherDetailsResponse(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
parent_publisher: PublisherResponse | None
|
||||
imprints: List[PublisherResponse]
|
||||
comics: List[ComicResponse]
|
||||
|
||||
Reference in New Issue
Block a user