Repository navigation
Expand file tree
/
Copy pathdata.py
More file actions
58 lines (55 loc) · 1.54 KB
/
Copy pathdata.py
File metadata and controls
58 lines (55 loc) · 1.54 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from models import Course
from typing import Optional
COURSES: list[Course] = [
Course(
id="modern-frontend",
title="Modern Frontend: React & Next.js",
description="React 19, Server Components, and the App Router.",
credits=5,
likes=24,
),
Course(
id="backend-fastapi",
title="Backend Foundations: FastAPI",
description="Async REST APIs in Python with FastAPI and Pydantic.",
credits=5,
likes=19,
),
Course(
id="databases-postgresql",
title="Relational Databases: PostgreSQL",
description="Schemas, SQLAlchemy, and migrations with Alembic.",
credits=5,
likes=15,
),
Course(
id="api-design",
title="API Design: REST vs GraphQL",
description="Comparing REST and GraphQL in one hands-on project.",
credits=4,
is_elective=True,
likes=11,
),
Course(
id="web-security",
title="Web Security Essentials",
description="JWT/OAuth2, XSS, CSRF, and SQL injection defense.",
credits=4,
likes=21,
),
Course(
id="ai-integration",
title="AI/LLM Integration",
description="LLM features in an app via the OpenAI API.",
credits=5,
is_elective=True,
likes=32,
),
]
def get_all_courses() -> list[Course]:
return list(COURSES)
def find_course(course_id: str) -> Optional[Course]:
for course in COURSES:
if course.id == course_id:
return course
return None