Create new services: inventory, recipes, suppliers
This commit is contained in:
84
services/suppliers/app/core/config.py
Normal file
84
services/suppliers/app/core/config.py
Normal file
@@ -0,0 +1,84 @@
|
||||
# services/suppliers/app/core/config.py
|
||||
"""
|
||||
Supplier & Procurement Service Configuration
|
||||
"""
|
||||
|
||||
from typing import List
|
||||
from pydantic import Field
|
||||
from shared.config.base import BaseServiceSettings
|
||||
|
||||
|
||||
class Settings(BaseServiceSettings):
|
||||
"""Supplier service settings extending base configuration"""
|
||||
|
||||
# Override service-specific settings
|
||||
SERVICE_NAME: str = "suppliers-service"
|
||||
VERSION: str = "1.0.0"
|
||||
APP_NAME: str = "Bakery Supplier Service"
|
||||
DESCRIPTION: str = "Supplier and procurement management service"
|
||||
|
||||
# API Configuration
|
||||
API_V1_STR: str = "/api/v1"
|
||||
|
||||
# Override database URL to use SUPPLIERS_DATABASE_URL
|
||||
DATABASE_URL: str = Field(
|
||||
default="postgresql+asyncpg://suppliers_user:suppliers_pass123@suppliers-db:5432/suppliers_db",
|
||||
env="SUPPLIERS_DATABASE_URL"
|
||||
)
|
||||
|
||||
# Suppliers-specific Redis database
|
||||
REDIS_DB: int = Field(default=4, env="SUPPLIERS_REDIS_DB")
|
||||
|
||||
# File upload configuration
|
||||
MAX_UPLOAD_SIZE: int = 10 * 1024 * 1024 # 10MB
|
||||
UPLOAD_PATH: str = Field(default="/tmp/uploads", env="SUPPLIERS_UPLOAD_PATH")
|
||||
ALLOWED_FILE_EXTENSIONS: List[str] = [".csv", ".xlsx", ".xls", ".pdf", ".png", ".jpg", ".jpeg"]
|
||||
|
||||
# Pagination
|
||||
DEFAULT_PAGE_SIZE: int = 50
|
||||
MAX_PAGE_SIZE: int = 500
|
||||
|
||||
# Price validation
|
||||
MIN_UNIT_PRICE: float = 0.01
|
||||
MAX_UNIT_PRICE: float = 10000.0
|
||||
MIN_ORDER_AMOUNT: float = 1.0
|
||||
MAX_ORDER_AMOUNT: float = 100000.0
|
||||
|
||||
# Supplier-specific cache TTL
|
||||
SUPPLIERS_CACHE_TTL: int = 900 # 15 minutes
|
||||
PURCHASE_ORDERS_CACHE_TTL: int = 300 # 5 minutes
|
||||
DELIVERIES_CACHE_TTL: int = 180 # 3 minutes
|
||||
PRICE_LIST_CACHE_TTL: int = 1800 # 30 minutes
|
||||
|
||||
# Purchase order settings
|
||||
DEFAULT_PAYMENT_TERMS_DAYS: int = 30
|
||||
MAX_PAYMENT_TERMS_DAYS: int = 90
|
||||
DEFAULT_DELIVERY_DAYS: int = 3
|
||||
MAX_DELIVERY_DAYS: int = 30
|
||||
|
||||
# Quality and rating settings
|
||||
MIN_QUALITY_RATING: float = 1.0
|
||||
MAX_QUALITY_RATING: float = 5.0
|
||||
MIN_DELIVERY_RATING: float = 1.0
|
||||
MAX_DELIVERY_RATING: float = 5.0
|
||||
|
||||
# Lead time settings (in days)
|
||||
DEFAULT_LEAD_TIME: int = 3
|
||||
MAX_LEAD_TIME: int = 30
|
||||
|
||||
# Order approval thresholds
|
||||
AUTO_APPROVE_THRESHOLD: float = 500.0 # Amounts below this auto-approve
|
||||
MANAGER_APPROVAL_THRESHOLD: float = 2000.0 # Manager approval required
|
||||
|
||||
# Communication settings
|
||||
ORDER_CONFIRMATION_EMAIL: bool = True
|
||||
DELIVERY_NOTIFICATION_EMAIL: bool = True
|
||||
QUALITY_ISSUE_EMAIL: bool = True
|
||||
|
||||
# Business hours for supplier contact (24h format)
|
||||
BUSINESS_HOURS_START: int = 8
|
||||
BUSINESS_HOURS_END: int = 18
|
||||
|
||||
|
||||
# Global settings instance
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user