-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
38 lines (30 loc) · 711 Bytes
/
schemas.py
File metadata and controls
38 lines (30 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from pydantic import BaseModel
from datetime import datetime
from typing import List, Optional
class VideoBase(BaseModel):
title: str
url: str
video_id: str
description: str
upload_date: datetime
class VideoCreate(VideoBase):
channel_id: int
class Video(VideoBase):
id: int
channel_id: int
created_at: datetime
channel_name: str # Add this field
class Config:
orm_mode = True
from_attributes = True
class ChannelBase(BaseModel):
name: str
channel_id: str
class ChannelCreate(ChannelBase):
pass
class Channel(ChannelBase):
id: int
created_at: datetime
videos: List[Video] = []
class Config:
orm_mode = True