basic-python-project 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- basic_python_project-0.0.0.dist-info/METADATA +124 -0
- basic_python_project-0.0.0.dist-info/RECORD +23 -0
- basic_python_project-0.0.0.dist-info/WHEEL +5 -0
- basic_python_project-0.0.0.dist-info/licenses/LICENSE +21 -0
- basic_python_project-0.0.0.dist-info/top_level.txt +1 -0
- meinewaldki_citizen_rest_service/__init__.py +0 -0
- meinewaldki_citizen_rest_service/constants.py +55 -0
- meinewaldki_citizen_rest_service/database/__init__.py +0 -0
- meinewaldki_citizen_rest_service/database/engine.py +35 -0
- meinewaldki_citizen_rest_service/database/models.py +276 -0
- meinewaldki_citizen_rest_service/dependencies.py +133 -0
- meinewaldki_citizen_rest_service/keycloak_clients.py +55 -0
- meinewaldki_citizen_rest_service/main.py +63 -0
- meinewaldki_citizen_rest_service/minio_client.py +52 -0
- meinewaldki_citizen_rest_service/routers/__init__.py +0 -0
- meinewaldki_citizen_rest_service/routers/guest_user_access.py +44 -0
- meinewaldki_citizen_rest_service/routers/records.py +268 -0
- meinewaldki_citizen_rest_service/routers/users.py +92 -0
- meinewaldki_citizen_rest_service/schemas/__init__.py +49 -0
- meinewaldki_citizen_rest_service/schemas/citizen_science.py +61 -0
- meinewaldki_citizen_rest_service/schemas/image.py +48 -0
- meinewaldki_citizen_rest_service/schemas/record.py +59 -0
- meinewaldki_citizen_rest_service/schemas/user.py +25 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Shared Image schemas.
|
|
2
|
+
|
|
3
|
+
ImageBase is inherited by both the SQLModel table model and future Pydantic
|
|
4
|
+
request / response schemas, keeping field definitions in one place.
|
|
5
|
+
|
|
6
|
+
Fields intentionally excluded from the base:
|
|
7
|
+
record_id — server-side FK set after the parent record is inserted.
|
|
8
|
+
minio_path — generated by the server after MinIO upload; returned in the
|
|
9
|
+
response but never sent by the client.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import enum
|
|
13
|
+
from typing import Optional
|
|
14
|
+
|
|
15
|
+
from sqlmodel import SQLModel
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ImageSyncStatus(str, enum.Enum):
|
|
19
|
+
"""Maps to the core.image_sync_status PostgreSQL enum."""
|
|
20
|
+
|
|
21
|
+
pending = "pending"
|
|
22
|
+
synced = "synced"
|
|
23
|
+
failed = "failed"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ImageOrientation(str, enum.Enum):
|
|
27
|
+
"""Maps to the core.image_orientation PostgreSQL enum."""
|
|
28
|
+
|
|
29
|
+
up = "up"
|
|
30
|
+
front = "front"
|
|
31
|
+
down = "down"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ImageBase(SQLModel):
|
|
35
|
+
"""Shared fields for Image Pydantic schemas and the DB table model."""
|
|
36
|
+
|
|
37
|
+
client_image_id: int
|
|
38
|
+
image_orientation: ImageOrientation
|
|
39
|
+
exif_metadata: Optional[dict] = None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ImageRead(SQLModel):
|
|
43
|
+
"""Response schema returned per image after record creation."""
|
|
44
|
+
|
|
45
|
+
id: int
|
|
46
|
+
client_image_id: int
|
|
47
|
+
image_orientation: ImageOrientation
|
|
48
|
+
sync_status: ImageSyncStatus
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Shared Record schemas.
|
|
2
|
+
|
|
3
|
+
RecordBase is inherited by both the SQLModel table model and future Pydantic
|
|
4
|
+
request / response schemas, keeping field definitions in one place.
|
|
5
|
+
|
|
6
|
+
Fields intentionally excluded from the base:
|
|
7
|
+
user_id — derived from the JWT token server-side, not sent by client.
|
|
8
|
+
original_location
|
|
9
|
+
updated_location — the API represents these as a LocationSchema (lat/lon)
|
|
10
|
+
while the DB uses Geography(POINT); handled separately.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import enum
|
|
14
|
+
import uuid
|
|
15
|
+
from datetime import datetime
|
|
16
|
+
from typing import Optional
|
|
17
|
+
|
|
18
|
+
from sqlmodel import SQLModel
|
|
19
|
+
|
|
20
|
+
from meinewaldki_citizen_rest_service.schemas.image import ImageBase, ImageRead
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RecordSyncStatus(str, enum.Enum):
|
|
24
|
+
"""Maps to the core.record_sync_status PostgreSQL enum."""
|
|
25
|
+
|
|
26
|
+
pending = "pending"
|
|
27
|
+
partial = "partial"
|
|
28
|
+
synced = "synced"
|
|
29
|
+
failed = "failed"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class RecordBase(SQLModel):
|
|
33
|
+
"""Shared fields for Record Pydantic schemas and the DB table model."""
|
|
34
|
+
|
|
35
|
+
client_record_id: uuid.UUID
|
|
36
|
+
created_at: datetime
|
|
37
|
+
hardware_data: Optional[dict] = None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class LocationSchema(SQLModel):
|
|
41
|
+
"""Lat/lon representation of a geographic point."""
|
|
42
|
+
|
|
43
|
+
lat: float
|
|
44
|
+
lon: float
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class RecordCreate(RecordBase):
|
|
48
|
+
"""Request body for POST /records. Images declared here, user_id comes from JWT."""
|
|
49
|
+
|
|
50
|
+
original_location: Optional[LocationSchema] = None
|
|
51
|
+
images: list[ImageBase]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class RecordRead(SQLModel):
|
|
55
|
+
"""Response body for POST /records."""
|
|
56
|
+
|
|
57
|
+
id: int
|
|
58
|
+
client_record_id: uuid.UUID
|
|
59
|
+
images: list[ImageRead]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Shared User schemas.
|
|
2
|
+
|
|
3
|
+
UserBase is inherited by both the SQLModel table model and future Pydantic
|
|
4
|
+
request / response schemas, keeping field definitions in one place.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import enum
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from sqlmodel import SQLModel
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class UserStatus(str, enum.Enum):
|
|
14
|
+
"""Maps to the core.user_status PostgreSQL enum."""
|
|
15
|
+
|
|
16
|
+
guest = "guest"
|
|
17
|
+
registered = "registered"
|
|
18
|
+
deleted = "deleted"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class UserBase(SQLModel):
|
|
22
|
+
"""Shared fields for User Pydantic schemas and the DB table model."""
|
|
23
|
+
|
|
24
|
+
email: Optional[str] = None
|
|
25
|
+
status: UserStatus = UserStatus.guest
|