|
2 | 2 | from typing import Annotated |
3 | 3 | from uuid import UUID |
4 | 4 |
|
5 | | -from fastapi import Depends, HTTPException, Request, status, Form |
| 5 | +from fastapi import Depends, Form, HTTPException, Request, status |
6 | 6 |
|
7 | 7 | from core import Scheduler |
8 | 8 | from services import ( |
@@ -103,42 +103,46 @@ def is_valid_uuid(identifier: str) -> bool: |
103 | 103 | return True |
104 | 104 |
|
105 | 105 |
|
106 | | -def get_uuid(identifier: str, name: str = "DIO") -> UUID: |
| 106 | +def get_uuid(identifier: str, name: str) -> UUID: |
107 | 107 | """Initializes and validates a source ID""" |
108 | 108 | if not is_valid_uuid(identifier): |
109 | 109 | raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail=f"Invalid {name} ID") |
110 | 110 | return UUID(identifier) |
111 | 111 |
|
112 | 112 |
|
113 | | -def get_source_id(source_id: str) -> UUID: |
| 113 | +async def get_source_id(source_id: str) -> UUID: |
114 | 114 | """Initializes and validates a source ID""" |
115 | 115 | if not is_valid_uuid(source_id): |
116 | 116 | raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid source ID") |
117 | 117 | return UUID(source_id) |
118 | 118 |
|
119 | 119 |
|
120 | | -def get_sink_id(sink_id: str) -> UUID: |
| 120 | +async def get_sink_id(sink_id: str) -> UUID: |
121 | 121 | """Initializes and validates a sink ID""" |
122 | 122 | if not is_valid_uuid(sink_id): |
123 | 123 | raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid sink ID") |
124 | 124 | return UUID(sink_id) |
125 | 125 |
|
126 | 126 |
|
127 | | -def get_project_id(project_id: str) -> UUID: |
| 127 | +async def get_project_id(project_id: str) -> UUID: |
128 | 128 | """Initializes and validates a project ID""" |
129 | 129 | return get_uuid(project_id, "project") |
130 | 130 |
|
131 | 131 |
|
132 | | -def get_media_id(media_id: str) -> UUID: |
| 132 | +async def get_media_id(media_id: str) -> UUID: |
133 | 133 | """Initializes and validates a media ID""" |
134 | 134 | return get_uuid(media_id, "media") |
135 | 135 |
|
136 | 136 |
|
137 | | -def get_model_id(model_id: str) -> UUID: |
| 137 | +async def get_model_id(model_id: str) -> UUID: |
138 | 138 | """Initializes and validates a media ID""" |
139 | 139 | return get_uuid(model_id, "model") |
140 | 140 |
|
141 | 141 |
|
| 142 | +async def get_job_id(job_id: str) -> UUID: |
| 143 | + """Initializes and validates a job ID""" |
| 144 | + return get_uuid(job_id, "job") |
| 145 | + |
142 | 146 | async def get_webrtc_manager(request: Request) -> WebRTCManager: |
143 | 147 | """Provides the global WebRTCManager instance from FastAPI application's state.""" |
144 | 148 | return request.app.state.webrtc_manager |
|
0 commit comments