feat(main): main
This commit is contained in:
@@ -16,6 +16,7 @@ class ChannelSchema(Schema):
|
||||
scheduling_mode: str
|
||||
library_id: int
|
||||
owner_user_id: int
|
||||
fallback_collection_id: Optional[int] = None
|
||||
|
||||
class ChannelCreateSchema(Schema):
|
||||
name: str
|
||||
@@ -24,6 +25,7 @@ class ChannelCreateSchema(Schema):
|
||||
description: Optional[str] = None
|
||||
library_id: int
|
||||
owner_user_id: int # Mock Auth User
|
||||
fallback_collection_id: Optional[int] = None
|
||||
|
||||
class ChannelUpdateSchema(Schema):
|
||||
name: Optional[str] = None
|
||||
@@ -32,6 +34,7 @@ class ChannelUpdateSchema(Schema):
|
||||
scheduling_mode: Optional[str] = None
|
||||
visibility: Optional[str] = None
|
||||
is_active: Optional[bool] = None
|
||||
fallback_collection_id: Optional[int] = None
|
||||
|
||||
class ChannelSourceRuleSchema(Schema):
|
||||
id: int
|
||||
@@ -103,7 +106,11 @@ class AiringSchema(Schema):
|
||||
|
||||
@router.get("/", response=List[ChannelSchema])
|
||||
def list_channels(request):
|
||||
return Channel.objects.all()
|
||||
from django.db.models import F
|
||||
return Channel.objects.order_by(
|
||||
F('channel_number').asc(nulls_last=True)
|
||||
)
|
||||
|
||||
|
||||
@router.get("/{channel_id}", response=ChannelSchema)
|
||||
def get_channel(request, channel_id: int):
|
||||
@@ -120,7 +127,8 @@ def create_channel(request, payload: ChannelCreateSchema):
|
||||
name=payload.name,
|
||||
slug=payload.slug,
|
||||
channel_number=payload.channel_number,
|
||||
description=payload.description
|
||||
description=payload.description,
|
||||
fallback_collection_id=payload.fallback_collection_id
|
||||
)
|
||||
return 201, channel
|
||||
|
||||
|
||||
Reference in New Issue
Block a user