Skip to content

Commit 8f8a7e3

Browse files
committed
Fix: Fix?
1 parent 7dcb2a5 commit 8f8a7e3

1 file changed

Lines changed: 1 addition & 60 deletions

File tree

src/api/models.py

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,13 @@
11
from typing import List, Dict, TypedDict, Any, Optional, Literal
22
from pydantic import BaseModel, field_validator, Field
33
import json
4-
5-
# class CreateCamera(BaseModel):
6-
# title: str
7-
# source: str
8-
# image_width: int
9-
# image_height: int
10-
# calib: Any
11-
# latitude: float
12-
# longitude: float
13-
14-
# @field_validator('title')
15-
# @classmethod
16-
# def validate_title(cls, title):
17-
# if len(title) < 1 or len(title) > 200:
18-
# raise ValueError(f"Invalid camera title: {title}")
19-
# return title
20-
21-
# @field_validator('source')
22-
# @classmethod
23-
# def validate_source(cls, source):
24-
# return source
25-
26-
# @field_validator('latitude')
27-
# @classmethod
28-
# def validate_latitude(cls, latitude):
29-
# if latitude > 90 or latitude < -90:
30-
# raise ValueError(f"Invalid latitude value: {latitude}")
31-
# return latitude
32-
33-
# @field_validator('longitude')
34-
# @classmethod
35-
# def validate_longitude(cls, longitude):
36-
# if longitude > 180 or longitude < -180:
37-
# raise ValueError(f"Invalid longitude value: {longitude}")
38-
# return longitude
39-
40-
# @field_validator('image_width')
41-
# @classmethod
42-
# def validate_image_width(cls, image_width):
43-
# if image_width <= 0:
44-
# raise ValueError(f"Invalid image_width value: {image_width}")
45-
# return image_width
46-
47-
# @field_validator('image_height')
48-
# @classmethod
49-
# def validate_image_height(cls, image_height):
50-
# if image_height <= 0:
51-
# raise ValueError(f"Invalid image_height value: {image_height}")
52-
# return image_height
53-
54-
# @field_validator('calib')
55-
# @classmethod
56-
# def validate_calib(cls, calib):
57-
# if calib is not None:
58-
# try:
59-
# json.dumps(calib)
60-
# except:
61-
# raise ValueError(f"Invalid calibration data")
62-
# return calib
634

645
class CameraBase(BaseModel):
656
title: Optional[str] = Field(None, min_length=3, max_length=120)
667
source: Optional[str] = Field(None, max_length=250)
678
image_width: Optional[int] = Field(None, gt=0)
689
image_height: Optional[int] = Field(None, gt=0)
69-
calib: Any
10+
calib: Optional[Any] = None
7011
latitude: Optional[float] = Field(None, ge=-90, le=90)
7112
longitude: Optional[float] = Field(None, ge=-180, le=180)
7213

0 commit comments

Comments
 (0)