performance/production api

This commit is contained in:
Your Name 2023-06-06 13:21:27 -04:00 committed by Henri Dickson
parent 5b5e0627d0
commit a4177d4833
3 changed files with 66 additions and 1 deletions

View file

@ -140,6 +140,24 @@ def get_game(request, uuid: str, response: HttpResponse):
return _get_item(Game, uuid, response)
@api.get(
"/performance/{uuid}",
response={200: PerformanceSchema, 302: RedirectedResult, 404: Result},
auth=None,
)
def get_performance(request, uuid: str, response: HttpResponse):
return _get_item(Performance, uuid, response)
@api.get(
"/performance/production/{uuid}",
response={200: PerformanceProductionSchema, 302: RedirectedResult, 404: Result},
auth=None,
)
def get_performance_production(request, uuid: str, response: HttpResponse):
return _get_item(PerformanceProduction, uuid, response)
# Legacy API will be removed soon

View file

@ -13,7 +13,12 @@ from .tv.models import (
from .music.models import Album, AlbumSchema, AlbumInSchema
from .game.models import Game, GameSchema, GameInSchema
from .podcast.models import Podcast, PodcastSchema, PodcastInSchema, PodcastEpisode
from .performance.models import Performance, PerformanceProduction
from .performance.models import (
Performance,
PerformanceProduction,
PerformanceSchema,
PerformanceProductionSchema,
)
from .collection.models import Collection as CatalogCollection
from .search.models import Indexer
from django.contrib.contenttypes.models import ContentType

View file

@ -2,7 +2,49 @@ from functools import cached_property
from django.utils.translation import gettext_lazy as _
from django.db import models
from catalog.common import *
from catalog.common.models import ItemSchema
from catalog.common.utils import DEFAULT_ITEM_COVER
from ninja import Schema
class CrewMemberSchema(Schema):
name: str
role: str | None
class PerformanceSchema(ItemSchema):
orig_title: str | None = None
other_title: list[str]
genre: list[str]
language: list[str]
opening_date: str | None = None
closing_date: str | None = None
director: list[str]
playwright: list[str]
orig_creator: list[str]
composer: list[str]
choreographer: list[str]
performer: list[str]
actor: list[CrewMemberSchema]
crew: list[CrewMemberSchema]
official_site: str | None = None
class PerformanceProductionSchema(ItemSchema):
orig_title: str | None = None
other_title: list[str]
language: list[str]
opening_date: str | None = None
closing_date: str | None = None
director: list[str]
playwright: list[str]
orig_creator: list[str]
composer: list[str]
choreographer: list[str]
performer: list[str]
actor: list[CrewMemberSchema]
crew: list[CrewMemberSchema]
official_site: str | None = None
_CREW_SCHEMA = {