Initial commit: Add EAMCO Service API
- Add FastAPI service for managing oil delivery services - Implement service scheduling and management endpoints - Add customer service history tracking - Include database models for services, customers, and auto-delivery - Add authentication and authorization middleware - Configure Docker support for local, dev, and prod environments - Add comprehensive .gitignore for Python projects
This commit is contained in:
111
app/schema/service.py
Normal file
111
app/schema/service.py
Normal file
@@ -0,0 +1,111 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from datetime import datetime, date
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class ServiceBase(BaseModel):
|
||||
customer_id: Optional[int] = None
|
||||
customer_name: Optional[str] = None
|
||||
customer_address: Optional[str] = None
|
||||
customer_town: Optional[str] = None
|
||||
customer_state: Optional[str] = None
|
||||
customer_zip: Optional[str] = None
|
||||
type_service_call: Optional[int] = None
|
||||
scheduled_date: Optional[datetime] = None
|
||||
description: Optional[str] = None
|
||||
service_cost: Optional[Decimal] = None
|
||||
payment_type: Optional[int] = None
|
||||
payment_card_id: Optional[int] = None
|
||||
payment_status: Optional[int] = None
|
||||
|
||||
|
||||
class ServiceResponse(ServiceBase):
|
||||
id: int
|
||||
when_ordered: Optional[datetime] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ServiceCreateRequest(BaseModel):
|
||||
customer_id: int
|
||||
expected_delivery_date: str
|
||||
type_service_call: Optional[int] = None
|
||||
description: Optional[str] = None
|
||||
|
||||
|
||||
class ServiceUpdateRequest(BaseModel):
|
||||
scheduled_date: Optional[str] = None
|
||||
type_service_call: Optional[int] = None
|
||||
description: Optional[str] = None
|
||||
service_cost: Optional[Decimal] = None
|
||||
|
||||
|
||||
class ServiceCostUpdateRequest(BaseModel):
|
||||
service_cost: Decimal
|
||||
|
||||
|
||||
class ServicePartsBase(BaseModel):
|
||||
customer_id: Optional[int] = None
|
||||
oil_filter: Optional[str] = None
|
||||
oil_filter_2: Optional[str] = None
|
||||
oil_nozzle: Optional[str] = None
|
||||
oil_nozzle_2: Optional[str] = None
|
||||
hot_water_tank: Optional[int] = None
|
||||
|
||||
|
||||
class ServicePartsResponse(ServicePartsBase):
|
||||
id: Optional[int] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ServicePartsUpdateRequest(BaseModel):
|
||||
oil_filter: Optional[str] = None
|
||||
oil_filter_2: Optional[str] = None
|
||||
oil_nozzle: Optional[str] = None
|
||||
oil_nozzle_2: Optional[str] = None
|
||||
hot_water_tank: Optional[int] = None
|
||||
|
||||
|
||||
class ServicePlanBase(BaseModel):
|
||||
customer_id: Optional[int] = None
|
||||
contract_plan: Optional[int] = None
|
||||
contract_years: Optional[int] = None
|
||||
contract_start_date: Optional[date] = None
|
||||
|
||||
|
||||
class ServicePlanResponse(ServicePlanBase):
|
||||
id: Optional[int] = None
|
||||
customer_name: Optional[str] = None
|
||||
customer_address: Optional[str] = None
|
||||
customer_town: Optional[str] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ServicePlanCreateRequest(BaseModel):
|
||||
customer_id: int
|
||||
contract_plan: int
|
||||
contract_years: int
|
||||
contract_start_date: str
|
||||
|
||||
|
||||
class ServicePlanUpdateRequest(BaseModel):
|
||||
contract_plan: Optional[int] = None
|
||||
contract_years: Optional[int] = None
|
||||
contract_start_date: Optional[str] = None
|
||||
|
||||
|
||||
class CalendarEvent(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
start: Optional[str] = None
|
||||
end: Optional[str] = None
|
||||
backgroundColor: Optional[str] = None
|
||||
textColor: Optional[str] = None
|
||||
borderColor: Optional[str] = None
|
||||
extendedProps: Optional[dict] = None
|
||||
Reference in New Issue
Block a user