fixes and modelgen insert

This commit is contained in:
2026-02-04 09:53:48 -03:00
parent b88f75fce0
commit 30b2e1cf44
52 changed files with 5317 additions and 178 deletions

View File

@@ -23,7 +23,7 @@ services:
POSTGRES_USER: mpr_user
POSTGRES_PASSWORD: mpr_pass
ports:
- "5435:5432"
- "5436:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
@@ -33,7 +33,7 @@ services:
redis:
image: redis:7-alpine
ports:
- "6380:6379"
- "6381:6379"
volumes:
- redis-data:/data
healthcheck:
@@ -101,7 +101,7 @@ services:
dockerfile: ctrl/Dockerfile
command: python -m mpr.grpc.server
ports:
- "50051:50051"
- "50052:50051"
environment:
<<: *common-env
GRPC_PORT: 50051

46
ctrl/generate.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
# Model generation script for MPR
# Generates Django, Pydantic, TypeScript, and Protobuf from schema/models
set -e
cd "$(dirname "$0")/.."
echo "Generating models from schema/models..."
# Django ORM models
python -m tools.modelgen from-schema \
--schema schema/models \
--output mpr/media_assets/models.py \
--targets django
# Pydantic schemas for FastAPI
python -m tools.modelgen from-schema \
--schema schema/models \
--output api/schemas/models.py \
--targets pydantic
# TypeScript types for Timeline UI
python -m tools.modelgen from-schema \
--schema schema/models \
--output ui/timeline/src/types.ts \
--targets typescript
# Protobuf for gRPC
python -m tools.modelgen from-schema \
--schema schema/models \
--output mpr/grpc/protos/worker.proto \
--targets proto
# Generate gRPC stubs from proto
echo "Generating gRPC stubs..."
python -m grpc_tools.protoc \
-I mpr/grpc/protos \
--python_out=mpr/grpc \
--grpc_python_out=mpr/grpc \
mpr/grpc/protos/worker.proto
# Fix relative import in generated grpc stub
sed -i 's/^import worker_pb2/from . import worker_pb2/' mpr/grpc/worker_pb2_grpc.py
echo "Done!"

View File

@@ -41,7 +41,7 @@ http {
}
# FastAPI
location /api {
location /api/ {
proxy_pass http://fastapi;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;