mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
добавление редисаъ3
This commit is contained in:
@@ -2,7 +2,7 @@ from pydantic_settings import BaseSettings
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
DATABASE_URL: str = "postgresql://postgres:postgres@db:5432/support_db"
|
DATABASE_URL: str = "postgresql://postgres:postgres123@db:5432/support_db"
|
||||||
REDIS_URL: str = "redis://redis:6379/0"
|
REDIS_URL: str = "redis://redis:6379/0"
|
||||||
|
|
||||||
# JWT settings
|
# JWT settings
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"""Employee schemas"""
|
"""Employee schemas"""
|
||||||
from pydantic import BaseModel, ConfigDict
|
from pydantic import BaseModel, ConfigDict
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
class EmployeeBase(BaseModel):
|
class EmployeeBase(BaseModel):
|
||||||
first_name: str
|
first_name: str
|
||||||
@@ -7,19 +8,14 @@ class EmployeeBase(BaseModel):
|
|||||||
department: str
|
department: str
|
||||||
office: str
|
office: str
|
||||||
|
|
||||||
model_config = ConfigDict(from_attributes=True)
|
|
||||||
|
|
||||||
class EmployeeCreate(EmployeeBase):
|
class EmployeeCreate(EmployeeBase):
|
||||||
password: str
|
password: str
|
||||||
|
|
||||||
class EmployeeUpdate(BaseModel):
|
class EmployeeUpdate(EmployeeBase):
|
||||||
first_name: str | None = None
|
password: Optional[str] = None
|
||||||
last_name: str | None = None
|
|
||||||
department: str | None = None
|
|
||||||
office: str | None = None
|
|
||||||
password: str | None = None
|
|
||||||
|
|
||||||
|
class Employee(EmployeeBase):
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
|
|
||||||
class EmployeeResponse(EmployeeBase):
|
|
||||||
id: int
|
id: int
|
||||||
|
hashed_password: str
|
||||||
@@ -21,7 +21,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./backend:/app
|
- ./backend:/app
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=postgresql://postgres:postgres@db:5432/support_db
|
- DATABASE_URL=postgresql://postgres:postgres123@db:5432/support_db
|
||||||
- REDIS_URL=redis://redis:6379/0
|
- REDIS_URL=redis://redis:6379/0
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
@@ -34,8 +34,10 @@ services:
|
|||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
- POSTGRES_PASSWORD=postgres
|
- POSTGRES_PASSWORD=postgres123
|
||||||
- POSTGRES_DB=support_db
|
- POSTGRES_DB=support_db
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: support-redis
|
container_name: support-redis
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ COPY backend/ .
|
|||||||
# Создаем entrypoint скрипт
|
# Создаем entrypoint скрипт
|
||||||
RUN echo '#!/bin/sh\n\
|
RUN echo '#!/bin/sh\n\
|
||||||
echo "Waiting for database..."\n\
|
echo "Waiting for database..."\n\
|
||||||
sleep 5\n\
|
sleep 10\n\
|
||||||
echo "Running database migrations..."\n\
|
echo "Running database migrations..."\n\
|
||||||
alembic upgrade head\n\
|
alembic upgrade head\n\
|
||||||
echo "Starting application..."\n\
|
echo "Starting application..."\n\
|
||||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload' > /entrypoint.sh \
|
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --workers 1' > /entrypoint.sh \
|
||||||
&& chmod +x /entrypoint.sh
|
&& chmod +x /entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|||||||
Reference in New Issue
Block a user