Coverage for models\events.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-02-05 19:00 +0800

1from typing import Optional, List 

2 

3from beanie import Document 

4from pydantic import BaseModel 

5 

6 

7class Event(Document): 

8 creator: Optional[str] 

9 title: str 

10 image: str 

11 description: str 

12 tags: List[str] 

13 location: str 

14 

15 class Config: 

16 schema_extra = { 

17 "example": { 

18 "title": "FastAPI Book Launch", 

19 "image": "https://linktomyimage.com/image.png", 

20 "description": "We will be discussing the contents of the FastAPI book in this event.Ensure to come with your own copy to win gifts!", 

21 "tags": ["python", "fastapi", "book", "launch"], 

22 "location": "Google Meet" 

23 } 

24 } 

25 

26 class Settings: 

27 name = "events" 

28 

29 

30class EventUpdate(BaseModel): 

31 title: Optional[str] 

32 image: Optional[str] 

33 description: Optional[str] 

34 tags: Optional[List[str]] 

35 location: Optional[str] 

36 

37 class Config: 

38 schema_extra = { 

39 "example": { 

40 "title": "FastAPI BookLaunch", 

41 "image": "https://linktomyimage.com/image.png", 

42 "description": "We will be discussing the contents of the FastAPI book in this event.Ensure to come with your own copy to win gifts!", 

43 "tags": ["python", "fastapi", "book", "launch"], 

44 "location": "Google Meet" 

45 } 

46 }