Feature: Added the customer module to list / edit customers. This is needed to add the customer discount functionality
This commit is contained in:
@ -93,11 +93,11 @@ def delete(
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=schemas.CustomerIn)
|
||||
@router.get("", response_model=schemas.CustomerBlank)
|
||||
def show_blank(
|
||||
db: Session = Depends(get_db),
|
||||
user: UserToken = Security(get_user, scopes=["customers"]),
|
||||
) -> schemas.CustomerIn:
|
||||
) -> schemas.CustomerBlank:
|
||||
return blank_customer_info()
|
||||
|
||||
|
||||
@ -137,5 +137,5 @@ def customer_info(item: Customer) -> schemas.Customer:
|
||||
)
|
||||
|
||||
|
||||
def blank_customer_info() -> schemas.CustomerIn:
|
||||
return schemas.CustomerIn(name="", address="", phone="")
|
||||
def blank_customer_info() -> schemas.CustomerBlank:
|
||||
return schemas.CustomerBlank(name="", address="", phone="")
|
||||
|
||||
@ -9,11 +9,11 @@ from . import to_camel
|
||||
|
||||
class CustomerIn(BaseModel):
|
||||
name: str = Field(..., min_length=1)
|
||||
phone: str = Field(..., min_length=1)
|
||||
# phone: str = Field(..., min_length=1)
|
||||
phone: str
|
||||
address: Optional[str]
|
||||
|
||||
class Config:
|
||||
fields = {"id_": "id"}
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
|
||||
@ -33,4 +33,11 @@ class CustomerLink(BaseModel):
|
||||
|
||||
class Config:
|
||||
fields = {"id_": "id"}
|
||||
|
||||
|
||||
class CustomerBlank(CustomerIn):
|
||||
name: str
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
|
||||
Reference in New Issue
Block a user