async def update_an_account(id_or_taxcode, account: CompanyModel, account_type: str = 'enterprise'): if account_type == 'enterprise': obj_company.fn_create_or_update_a_company(id_or_taxcode, **account.dict()) return JSONResponse(content={'message': "Updated successfully."}) else: # TODO: update a personal account pass
async def create_a_new_account(account: CompanyModel, account_type: str = 'enterprise'): if account_type == 'enterprise': try: # TODO: check constraint tax_code is unique and isn't deleted yet obj_company.fn_create_or_update_a_company(**account.dict()) return JSONResponse(content={'message': "Created successfully."}, status_code=201) except ConstraintError: return JSONResponse(content={'message': "Already exists."}) else: # TODO: create a personal account pass