Better feedback on draft publication
This commit is contained in:
@@ -6,7 +6,7 @@ from ..core.routes import get_crud_router
|
||||
from .routes_draft import draft_router
|
||||
from .print import print_router
|
||||
|
||||
from .models import Contract, ContractDraft, Party, replace_variables_in_value
|
||||
from .models import Contract, ContractDraft, ContractDraftStatus, Party, replace_variables_in_value
|
||||
from .schemas import ContractCreate, ContractRead, ContractUpdate
|
||||
|
||||
from ..entity.models import Entity
|
||||
@@ -64,6 +64,8 @@ async def create(item: ContractCreate, user=Depends(get_current_user)) -> dict:
|
||||
contract_dict['provisions'] = provisions
|
||||
|
||||
o = await Contract(**contract_dict).create()
|
||||
|
||||
await draft.update({"$set": {"status": ContractDraftStatus.published}})
|
||||
return {"message": "Contract Successfully created", "id": o.id}
|
||||
|
||||
|
||||
@@ -89,11 +91,11 @@ async def affix_signature(signature_id: str, signature_file: UploadFile = File(.
|
||||
if signature.signature_affixed:
|
||||
raise HTTPException(status_code=400, detail="Signature already affixed")
|
||||
|
||||
with open("media/signatures/{}.png".format(signature_id), "wb") as buffer:
|
||||
with open(f'media/signatures/{signature_id}.png', "wb") as buffer:
|
||||
shutil.copyfileobj(signature_file.file, buffer)
|
||||
|
||||
update_query = {"$set": {
|
||||
'parties.{}.signature_affixed'.format(signature_index): True
|
||||
f'parties.{signature_index}.signature_affixed': True
|
||||
}}
|
||||
signature.signature_affixed = True
|
||||
if contract.is_signed():
|
||||
|
||||
Reference in New Issue
Block a user