Bumped the version to 7
Fixed double exception being thrown Currency pipe broke the accounts pipe
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
from datetime import datetime
|
||||
@@ -49,9 +48,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.Account)
|
||||
@@ -84,9 +81,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id}")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
from datetime import datetime, date, timedelta
|
||||
|
||||
from fastapi import APIRouter, HTTPException, status, Depends, Security, Request
|
||||
@@ -107,9 +106,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def date_range(start: date, stop: date, step=timedelta(days=1), inclusive=False):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
from fastapi import APIRouter, HTTPException, status, Depends, Security
|
||||
@@ -46,9 +45,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id_}")
|
||||
@@ -68,9 +65,7 @@ def delete(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("/list")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -41,9 +40,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.Role)
|
||||
@@ -66,9 +63,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def add_permissions(role: Role, permissions: List[schemas.PermissionItem], db):
|
||||
@@ -97,9 +92,7 @@ def delete(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -41,9 +40,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("/me", response_model=schemas.User)
|
||||
@@ -75,9 +72,7 @@ def update_me(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.User)
|
||||
@@ -103,9 +98,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def add_roles(user: User, roles: List[schemas.RoleItem], db: Session):
|
||||
@@ -134,9 +127,7 @@ def delete(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -42,9 +41,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.CostCentre)
|
||||
@@ -70,9 +67,8 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
|
||||
@router.delete("/{id_}")
|
||||
@@ -96,9 +92,7 @@ def delete(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import desc
|
||||
@@ -51,9 +50,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.Employee)
|
||||
@@ -87,9 +84,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id_}")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from math import ceil
|
||||
from typing import List
|
||||
@@ -75,9 +74,7 @@ def save_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def save(data: schema_in.EmployeeBenefitIn, date_: date, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -163,9 +160,7 @@ def update_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def update(id_: uuid.UUID, data: schema_in.EmployeeBenefitIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -222,9 +217,7 @@ def get_id(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=output.Voucher)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from decimal import Decimal
|
||||
from typing import List, Optional
|
||||
@@ -73,9 +72,7 @@ def save_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def save(data: schema_in.IncentiveIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -138,9 +135,7 @@ def update_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def update(id_: uuid.UUID, data: schema_in.IncentiveIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -185,9 +180,7 @@ def get_id(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=output.Voucher)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
@@ -69,9 +68,7 @@ def save_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def save(data: schema_in.IssueIn, user: UserToken, db: Session) -> (Voucher, Optional[bool]):
|
||||
@@ -176,9 +173,7 @@ def update_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def update(id_: uuid.UUID, data: schema_in.IssueIn, user: UserToken, db: Session) -> (Voucher, Optional[bool]):
|
||||
@@ -306,9 +301,7 @@ def get_id(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=output.Voucher)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import List
|
||||
from datetime import datetime
|
||||
@@ -65,6 +64,7 @@ def save_route(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e),
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise
|
||||
|
||||
|
||||
@@ -111,9 +111,7 @@ def update_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def update(id_: uuid.UUID, data: schema_in.JournalIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -174,9 +172,7 @@ def get_id(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=output.Voucher)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
@@ -54,9 +53,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.Product)
|
||||
@@ -93,9 +90,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id_}")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -42,9 +41,7 @@ def save(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.put("/{id_}", response_model=schemas.ProductGroup)
|
||||
@@ -70,9 +67,7 @@ def update(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.delete("/{id_}")
|
||||
@@ -96,9 +91,7 @@ def delete(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from decimal import Decimal
|
||||
from typing import List
|
||||
@@ -69,9 +68,7 @@ def save_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def save(data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -158,9 +155,7 @@ def update_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def update(id_: uuid.UUID, data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -301,9 +296,7 @@ def get_id(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=output.Voucher)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from decimal import Decimal
|
||||
from typing import List
|
||||
@@ -68,9 +67,7 @@ def save_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def save(data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -154,9 +151,7 @@ def update_route(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def update(id_: uuid.UUID, data: schema_in.PurchaseIn, user: UserToken, db: Session) -> Voucher:
|
||||
@@ -248,9 +243,7 @@ def get_id(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
@router.get("", response_model=output.Voucher)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import traceback
|
||||
import uuid
|
||||
from typing import Optional
|
||||
from datetime import datetime, date
|
||||
@@ -67,9 +66,7 @@ def post_voucher(
|
||||
)
|
||||
except Exception:
|
||||
db.rollback()
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=traceback.format_exc(),
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def check_delete_permissions(voucher: Voucher, user: UserToken):
|
||||
|
||||
Reference in New Issue
Block a user