updated last web service
This commit is contained in:
30
ServicesApi/Builds/TestApi/Dockerfile
Normal file
30
ServicesApi/Builds/TestApi/Dockerfile
Normal file
@@ -0,0 +1,30 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /
|
||||
|
||||
# Install system dependencies and Poetry
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/* && pip install --no-cache-dir poetry
|
||||
|
||||
# Copy Poetry configuration
|
||||
COPY /pyproject.toml ./pyproject.toml
|
||||
|
||||
# Configure Poetry and install dependencies with optimizations
|
||||
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main && pip cache purge && rm -rf ~/.cache/pypoetry
|
||||
|
||||
# Copy application code
|
||||
COPY /ServicesApi/Initializer /Initializer
|
||||
COPY /ServicesApi/Controllers /Controllers
|
||||
COPY /ServicesApi/Validations /Validations
|
||||
COPY /ServicesApi/Schemas /Schemas
|
||||
COPY /ServicesApi/Extensions /Extensions
|
||||
|
||||
COPY /ServicesApi/Builds/TestApi/endpoints /endpoints
|
||||
COPY /ServicesApi/Builds/TestApi/events /events
|
||||
# COPY /api_services/api_builds/test_api/validations /api_initializer/validations
|
||||
# COPY /api_services/api_builds/test_api/index.py /api_initializer/index.py
|
||||
|
||||
# Set Python path to include app directory
|
||||
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
# Run the application using the configured uvicorn server
|
||||
CMD ["poetry", "run", "python", "/Initializer/app.py"]
|
||||
18
ServicesApi/Builds/TestApi/endpoints/routes.py
Normal file
18
ServicesApi/Builds/TestApi/endpoints/routes.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from fastapi import APIRouter
|
||||
from .tester.router import tester_endpoint_route
|
||||
|
||||
|
||||
def get_routes() -> list[APIRouter]:
|
||||
return [tester_endpoint_route]
|
||||
|
||||
|
||||
def get_safe_endpoint_urls() -> list[tuple[str, str]]:
|
||||
return [
|
||||
("/", "GET"),
|
||||
("/docs", "GET"),
|
||||
("/redoc", "GET"),
|
||||
("/openapi.json", "GET"),
|
||||
("/metrics", "GET"),
|
||||
("/tester/list", "POST"),
|
||||
]
|
||||
|
||||
37
ServicesApi/Builds/TestApi/endpoints/tester/router.py
Normal file
37
ServicesApi/Builds/TestApi/endpoints/tester/router.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import datetime
|
||||
|
||||
from typing import Any
|
||||
from fastapi import APIRouter, Depends
|
||||
from pydantic import BaseModel
|
||||
from Validations.response import PaginateOnly, Pagination, PaginationResult, EndpointResponse
|
||||
from Validations.defaults.validations import CommonHeaders
|
||||
from Schemas import AccountRecords
|
||||
|
||||
|
||||
tester_endpoint_route = APIRouter(prefix="/tester", tags=["Tester Cluster"])
|
||||
|
||||
|
||||
class TestList(BaseModel):
|
||||
uu_id: str
|
||||
bank_date: datetime.datetime
|
||||
currency_value: float
|
||||
process_name: str
|
||||
|
||||
|
||||
tester_list = "TestList"
|
||||
@tester_endpoint_route.post(
|
||||
path="/list",
|
||||
description="List all tester endpoint",
|
||||
operation_id="4c38fab8-9b66-41cd-b87a-41175c9eea48",
|
||||
)
|
||||
def tester_list_route(
|
||||
list_options: PaginateOnly,
|
||||
headers: CommonHeaders = Depends(CommonHeaders.as_dependency),
|
||||
):
|
||||
with AccountRecords.new_session() as db_session:
|
||||
AccountRecords.set_session(db_session)
|
||||
tester_list = AccountRecords.query.filter(AccountRecords.currency_value > 0)
|
||||
pagination = Pagination(data=tester_list, base_query=AccountRecords.query.filter())
|
||||
pagination.change(**list_options.model_dump())
|
||||
pagination_result = PaginationResult(data=tester_list, pagination=pagination, response_model=TestList)
|
||||
return EndpointResponse(message="MSG0003-LIST", pagination_result=pagination_result).response
|
||||
3
ServicesApi/Builds/TestApi/events/__init__.py
Normal file
3
ServicesApi/Builds/TestApi/events/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
__all__ = []
|
||||
Reference in New Issue
Block a user