Skip to content

Commit 01330a8

Browse files
authored
Migration to svelte5 (#25)
* bump updates * bump updates, also moved from ping() to exec_command(ping) - typehints * a11y fixes + tailwindcss update bump * moving from js to ts * ruff fix * coderabbit fixes + added doc about frontend build * migration to svelte5; + docs * dockerfile ver update * import list fix * hey-api update * auth fixes * svelte4 style fixes * css file fix
1 parent 4f81caa commit 01330a8

File tree

91 files changed

+26381
-4329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+26381
-4329
lines changed

.github/workflows/docs.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ jobs:
3232
uses: actions/checkout@v6
3333

3434
- name: Set up uv
35-
uses: astral-sh/setup-uv@v5
35+
uses: astral-sh/setup-uv@v7
3636
with:
3737
enable-cache: true
3838

3939
- name: Install MkDocs
4040
run: uv tool install mkdocs --with mkdocs-material --with mkdocs-mermaid2-plugin --with mkdocs-swagger-ui-tag
4141

42-
- name: Download OpenAPI spec
43-
run: |
44-
curl -s https://api.integr8scode.cc/openapi.json | \
45-
jq '. + {servers: [{url: "https://api.integr8scode.cc", description: "Production"}]}' \
46-
> docs/reference/openapi.json
42+
- name: Install backend dependencies
43+
run: cd backend && uv sync --frozen
44+
45+
- name: Generate OpenAPI spec
46+
run: ./deploy.sh openapi
4747

4848
- name: Build documentation
4949
run: uv tool run mkdocs build --strict
5050

5151
- name: Upload artifact
52-
uses: actions/upload-pages-artifact@v3
52+
uses: actions/upload-pages-artifact@v4
5353
with:
5454
path: site/
5555

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v6
1616

1717
- name: Set up uv
18-
uses: astral-sh/setup-uv@v5
18+
uses: astral-sh/setup-uv@v7
1919
with:
2020
enable-cache: true
2121
cache-dependency-glob: "backend/uv.lock"

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v6
1616

1717
- name: Set up uv
18-
uses: astral-sh/setup-uv@v5
18+
uses: astral-sh/setup-uv@v7
1919
with:
2020
enable-cache: true
2121
cache-dependency-glob: "backend/uv.lock"

.github/workflows/security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v6
1616

1717
- name: Set up uv
18-
uses: astral-sh/setup-uv@v5
18+
uses: astral-sh/setup-uv@v7
1919
with:
2020
enable-cache: true
2121
cache-dependency-glob: "backend/uv.lock"

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
run: |
6161
echo "Pre-pulling base images to speed up builds..."
6262
docker pull python:3.12-slim &
63-
docker pull ghcr.io/astral-sh/uv:0.9.17 &
63+
docker pull ghcr.io/astral-sh/uv:0.9.18 &
6464
docker pull alpine:latest &
6565
docker pull confluentinc/cp-kafka:7.5.0 &
6666
docker pull confluentinc/cp-zookeeper:7.5.0 &
@@ -161,7 +161,7 @@ jobs:
161161
kubectl get rolebindings -n default
162162
163163
- name: Set up uv
164-
uses: astral-sh/setup-uv@v5
164+
uses: astral-sh/setup-uv@v7
165165
with:
166166
enable-cache: true
167167
cache-dependency-glob: "backend/uv.lock"
@@ -216,7 +216,7 @@ jobs:
216216
217217
- name: Upload logs
218218
if: always()
219-
uses: actions/upload-artifact@v4
219+
uses: actions/upload-artifact@v6
220220
with:
221221
name: integration-test-logs
222222
path: logs/

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ dist/
1313
downloads/
1414
eggs/
1515
.eggs/
16-
lib/
17-
lib64/
16+
/lib/
17+
/lib64/
1818
parts/
1919
sdist/
2020
var/

backend/app/api/routes/auth.py

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from datetime import datetime, timedelta, timezone
2-
from typing import Dict, Union
32
from uuid import uuid4
43

54
from dishka import FromDishka
@@ -12,7 +11,13 @@
1211
from app.core.utils import get_client_ip
1312
from app.db.repositories import UserRepository
1413
from app.domain.user import User as DomainAdminUser
15-
from app.schemas_pydantic.user import UserCreate, UserResponse
14+
from app.schemas_pydantic.user import (
15+
LoginResponse,
16+
MessageResponse,
17+
TokenValidationResponse,
18+
UserCreate,
19+
UserResponse,
20+
)
1621
from app.services.auth_service import AuthService
1722
from app.settings import get_settings
1823

@@ -21,13 +26,13 @@
2126
route_class=DishkaRoute)
2227

2328

24-
@router.post("/login")
29+
@router.post("/login", response_model=LoginResponse)
2530
async def login(
2631
request: Request,
2732
response: Response,
2833
user_repo: FromDishka[UserRepository],
2934
form_data: OAuth2PasswordRequestForm = Depends(),
30-
) -> Dict[str, str]:
35+
) -> LoginResponse:
3136
logger.info(
3237
"Login attempt",
3338
extra={
@@ -112,14 +117,12 @@ async def login(
112117
response.headers["Cache-Control"] = "no-store"
113118
response.headers["Pragma"] = "no-cache"
114119

115-
# Return minimal authentication response
116-
# Detailed user info should be fetched from GET /me endpoint
117-
return {
118-
"message": "Login successful",
119-
"username": user.username,
120-
"role": "admin" if user.is_superuser else "user", # Coarse-grained role
121-
"csrf_token": csrf_token
122-
}
120+
return LoginResponse(
121+
message="Login successful",
122+
username=user.username,
123+
role="admin" if user.is_superuser else "user",
124+
csrf_token=csrf_token
125+
)
123126

124127

125128
@router.post("/register", response_model=UserResponse)
@@ -224,11 +227,11 @@ async def get_current_user_profile(
224227
return current_user
225228

226229

227-
@router.get("/verify-token")
230+
@router.get("/verify-token", response_model=TokenValidationResponse)
228231
async def verify_token(
229232
request: Request,
230233
auth_service: FromDishka[AuthService],
231-
) -> Dict[str, Union[str, bool]]:
234+
) -> TokenValidationResponse:
232235
current_user = await auth_service.get_current_user(request)
233236
logger.info(
234237
"Token verification attempt",
@@ -249,15 +252,14 @@ async def verify_token(
249252
"user_agent": request.headers.get("user-agent"),
250253
},
251254
)
252-
# Return existing CSRF token from cookie
253255
csrf_token = request.cookies.get("csrf_token", "")
254256

255-
return {
256-
"valid": True,
257-
"username": current_user.username,
258-
"role": "admin" if current_user.is_superuser else "user", # Coarse-grained role
259-
"csrf_token": csrf_token
260-
}
257+
return TokenValidationResponse(
258+
valid=True,
259+
username=current_user.username,
260+
role="admin" if current_user.is_superuser else "user",
261+
csrf_token=csrf_token
262+
)
261263

262264
except Exception as e:
263265
logger.error(
@@ -278,11 +280,11 @@ async def verify_token(
278280

279281

280282

281-
@router.post("/logout")
283+
@router.post("/logout", response_model=MessageResponse)
282284
async def logout(
283285
request: Request,
284286
response: Response,
285-
) -> Dict[str, str]:
287+
) -> MessageResponse:
286288
logger.info(
287289
"Logout attempt",
288290
extra={
@@ -312,4 +314,4 @@ async def logout(
312314
},
313315
)
314316

315-
return {"message": "Logout successful"}
317+
return MessageResponse(message="Logout successful")

backend/app/core/providers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def get_redis_client(self, settings: Settings) -> AsyncIterator[redis.Redi
127127
socket_timeout=5,
128128
)
129129
# Test connection
130-
await client.ping()
130+
await client.execute_command("PING")
131131
logger.info(
132132
f"Redis connected: {settings.REDIS_HOST}:{settings.REDIS_PORT}/{settings.REDIS_DB}"
133133
)

backend/app/schemas_pydantic/user.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,23 @@ class MessageResponse(BaseModel):
130130
model_config = ConfigDict(
131131
from_attributes=True
132132
)
133+
134+
135+
class LoginResponse(BaseModel):
136+
"""Response model for successful login"""
137+
message: str
138+
username: str
139+
role: str
140+
csrf_token: str
141+
142+
model_config = ConfigDict(from_attributes=True)
143+
144+
145+
class TokenValidationResponse(BaseModel):
146+
"""Response model for token validation"""
147+
valid: bool
148+
username: str
149+
role: str
150+
csrf_token: str
151+
152+
model_config = ConfigDict(from_attributes=True)

backend/app/services/idempotency/redis_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ async def aggregate_status_counts(self, key_prefix: str) -> dict[str, int]:
138138
return counts
139139

140140
async def health_check(self) -> None:
141-
await self._r.ping()
141+
await self._r.execute_command("PING")

0 commit comments

Comments
 (0)