Spaces:
Paused
Paused
Commit ·
cce9e60
1
Parent(s): 91187f2
feat(reference): add delete operations for various reference data entities
Browse files- app/controllers/reference.py +184 -2
- app/db/repositories/reference_repo.py +126 -0
- app/services/reference_service.py +56 -0
app/controllers/reference.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from fastapi import APIRouter, Depends, Query, status, HTTPException
|
| 2 |
from sqlalchemy.orm import Session
|
| 3 |
from app.db.session import get_db
|
| 4 |
from app.services.reference_service import ReferenceDataService
|
|
@@ -697,4 +697,186 @@ def update_priority(
|
|
| 697 |
result = service.update_priority(priority_id, data)
|
| 698 |
if not result:
|
| 699 |
raise HTTPException(status_code=404, detail="Priority not found")
|
| 700 |
-
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import APIRouter, Depends, Query, status, HTTPException, Response
|
| 2 |
from sqlalchemy.orm import Session
|
| 3 |
from app.db.session import get_db
|
| 4 |
from app.services.reference_service import ReferenceDataService
|
|
|
|
| 697 |
result = service.update_priority(priority_id, data)
|
| 698 |
if not result:
|
| 699 |
raise HTTPException(status_code=404, detail="Priority not found")
|
| 700 |
+
return result
|
| 701 |
+
|
| 702 |
+
@router.delete("/states/{state_id}", status_code=204)
|
| 703 |
+
def delete_state(
|
| 704 |
+
state_id: int,
|
| 705 |
+
db: Session = Depends(get_db),
|
| 706 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 707 |
+
):
|
| 708 |
+
"""Delete a state"""
|
| 709 |
+
service = ReferenceDataService(db)
|
| 710 |
+
success = service.delete_state(state_id)
|
| 711 |
+
if not success:
|
| 712 |
+
raise HTTPException(status_code=404, detail="State not found")
|
| 713 |
+
return Response(status_code=204)
|
| 714 |
+
|
| 715 |
+
@router.delete("/countries/{country_id}", status_code=204)
|
| 716 |
+
def delete_country(
|
| 717 |
+
country_id: int,
|
| 718 |
+
db: Session = Depends(get_db),
|
| 719 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 720 |
+
):
|
| 721 |
+
"""Delete a country"""
|
| 722 |
+
service = ReferenceDataService(db)
|
| 723 |
+
success = service.delete_country(country_id)
|
| 724 |
+
if not success:
|
| 725 |
+
raise HTTPException(status_code=404, detail="Country not found")
|
| 726 |
+
return Response(status_code=204)
|
| 727 |
+
|
| 728 |
+
@router.delete("/company-types/{company_type_id}", status_code=204)
|
| 729 |
+
def delete_company_type(
|
| 730 |
+
company_type_id: int,
|
| 731 |
+
db: Session = Depends(get_db),
|
| 732 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 733 |
+
):
|
| 734 |
+
"""Delete a company type"""
|
| 735 |
+
service = ReferenceDataService(db)
|
| 736 |
+
success = service.delete_company_type(company_type_id)
|
| 737 |
+
if not success:
|
| 738 |
+
raise HTTPException(status_code=404, detail="Company type not found")
|
| 739 |
+
return Response(status_code=204)
|
| 740 |
+
|
| 741 |
+
@router.delete("/lead-sources/{lead_generated_from_id}", status_code=204)
|
| 742 |
+
def delete_lead_source(
|
| 743 |
+
lead_generated_from_id: int,
|
| 744 |
+
db: Session = Depends(get_db),
|
| 745 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 746 |
+
):
|
| 747 |
+
"""Delete a lead source"""
|
| 748 |
+
service = ReferenceDataService(db)
|
| 749 |
+
success = service.delete_lead_source(lead_generated_from_id)
|
| 750 |
+
if not success:
|
| 751 |
+
raise HTTPException(status_code=404, detail="Lead source not found")
|
| 752 |
+
return Response(status_code=204)
|
| 753 |
+
|
| 754 |
+
@router.delete("/payment-terms/{payment_term_id}", status_code=204)
|
| 755 |
+
def delete_payment_term(
|
| 756 |
+
payment_term_id: int,
|
| 757 |
+
db: Session = Depends(get_db),
|
| 758 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 759 |
+
):
|
| 760 |
+
"""Delete a payment term"""
|
| 761 |
+
service = ReferenceDataService(db)
|
| 762 |
+
success = service.delete_payment_term(payment_term_id)
|
| 763 |
+
if not success:
|
| 764 |
+
raise HTTPException(status_code=404, detail="Payment term not found")
|
| 765 |
+
return Response(status_code=204)
|
| 766 |
+
|
| 767 |
+
@router.delete("/purchase-prices/{purchase_price_id}", status_code=204)
|
| 768 |
+
def delete_purchase_price(
|
| 769 |
+
purchase_price_id: int,
|
| 770 |
+
db: Session = Depends(get_db),
|
| 771 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 772 |
+
):
|
| 773 |
+
"""Delete a purchase price"""
|
| 774 |
+
service = ReferenceDataService(db)
|
| 775 |
+
success = service.delete_purchase_price(purchase_price_id)
|
| 776 |
+
if not success:
|
| 777 |
+
raise HTTPException(status_code=404, detail="Purchase price not found")
|
| 778 |
+
return Response(status_code=204)
|
| 779 |
+
|
| 780 |
+
@router.delete("/rental-prices/{rental_price_id}", status_code=204)
|
| 781 |
+
def delete_rental_price(
|
| 782 |
+
rental_price_id: int,
|
| 783 |
+
db: Session = Depends(get_db),
|
| 784 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 785 |
+
):
|
| 786 |
+
"""Delete a rental price"""
|
| 787 |
+
service = ReferenceDataService(db)
|
| 788 |
+
success = service.delete_rental_price(rental_price_id)
|
| 789 |
+
if not success:
|
| 790 |
+
raise HTTPException(status_code=404, detail="Rental price not found")
|
| 791 |
+
return Response(status_code=204)
|
| 792 |
+
|
| 793 |
+
@router.delete("/barrier-sizes/{barrier_size_id}", status_code=204)
|
| 794 |
+
def delete_barrier_size(
|
| 795 |
+
barrier_size_id: int,
|
| 796 |
+
db: Session = Depends(get_db),
|
| 797 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 798 |
+
):
|
| 799 |
+
"""Delete a barrier size"""
|
| 800 |
+
service = ReferenceDataService(db)
|
| 801 |
+
success = service.delete_barrier_size(barrier_size_id)
|
| 802 |
+
if not success:
|
| 803 |
+
raise HTTPException(status_code=404, detail="Barrier size not found")
|
| 804 |
+
return Response(status_code=204)
|
| 805 |
+
|
| 806 |
+
@router.delete("/product-applications/{application_id}", status_code=204)
|
| 807 |
+
def delete_product_application(
|
| 808 |
+
application_id: int,
|
| 809 |
+
db: Session = Depends(get_db),
|
| 810 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 811 |
+
):
|
| 812 |
+
"""Delete a product application"""
|
| 813 |
+
service = ReferenceDataService(db)
|
| 814 |
+
success = service.delete_product_application(application_id)
|
| 815 |
+
if not success:
|
| 816 |
+
raise HTTPException(status_code=404, detail="Product application not found")
|
| 817 |
+
return Response(status_code=204)
|
| 818 |
+
|
| 819 |
+
@router.delete("/fobs/{fob_id}", status_code=204)
|
| 820 |
+
def delete_fob(
|
| 821 |
+
fob_id: int,
|
| 822 |
+
db: Session = Depends(get_db),
|
| 823 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 824 |
+
):
|
| 825 |
+
"""Delete a FOB"""
|
| 826 |
+
service = ReferenceDataService(db)
|
| 827 |
+
success = service.delete_fob(fob_id)
|
| 828 |
+
if not success:
|
| 829 |
+
raise HTTPException(status_code=404, detail="FOB not found")
|
| 830 |
+
return Response(status_code=204)
|
| 831 |
+
|
| 832 |
+
@router.delete("/est-ship-dates/{est_ship_date_id}", status_code=204)
|
| 833 |
+
def delete_est_ship_date(
|
| 834 |
+
est_ship_date_id: int,
|
| 835 |
+
db: Session = Depends(get_db),
|
| 836 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 837 |
+
):
|
| 838 |
+
"""Delete an estimated ship date"""
|
| 839 |
+
service = ReferenceDataService(db)
|
| 840 |
+
success = service.delete_est_ship_date(est_ship_date_id)
|
| 841 |
+
if not success:
|
| 842 |
+
raise HTTPException(status_code=404, detail="Estimated ship date not found")
|
| 843 |
+
return Response(status_code=204)
|
| 844 |
+
|
| 845 |
+
@router.delete("/est-freights/{est_freight_id}", status_code=204)
|
| 846 |
+
def delete_est_freight(
|
| 847 |
+
est_freight_id: int,
|
| 848 |
+
db: Session = Depends(get_db),
|
| 849 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 850 |
+
):
|
| 851 |
+
"""Delete an estimated freight"""
|
| 852 |
+
service = ReferenceDataService(db)
|
| 853 |
+
success = service.delete_est_freight(est_freight_id)
|
| 854 |
+
if not success:
|
| 855 |
+
raise HTTPException(status_code=404, detail="Estimated freight not found")
|
| 856 |
+
return Response(status_code=204)
|
| 857 |
+
|
| 858 |
+
@router.delete("/status-info/{status_info_id}", status_code=204)
|
| 859 |
+
def delete_status_info(
|
| 860 |
+
status_info_id: int,
|
| 861 |
+
db: Session = Depends(get_db),
|
| 862 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 863 |
+
):
|
| 864 |
+
"""Delete a status info"""
|
| 865 |
+
service = ReferenceDataService(db)
|
| 866 |
+
success = service.delete_status_info(status_info_id)
|
| 867 |
+
if not success:
|
| 868 |
+
raise HTTPException(status_code=404, detail="Status info not found")
|
| 869 |
+
return Response(status_code=204)
|
| 870 |
+
|
| 871 |
+
@router.delete("/priorities/{priority_id}", status_code=204)
|
| 872 |
+
def delete_priority(
|
| 873 |
+
priority_id: int,
|
| 874 |
+
db: Session = Depends(get_db),
|
| 875 |
+
current_user: CurrentUser = Depends(get_current_user_optional)
|
| 876 |
+
):
|
| 877 |
+
"""Delete a priority"""
|
| 878 |
+
service = ReferenceDataService(db)
|
| 879 |
+
success = service.delete_priority(priority_id)
|
| 880 |
+
if not success:
|
| 881 |
+
raise HTTPException(status_code=404, detail="Priority not found")
|
| 882 |
+
return Response(status_code=204)
|
app/db/repositories/reference_repo.py
CHANGED
|
@@ -748,6 +748,132 @@ class ReferenceDataRepository:
|
|
| 748 |
self.db.refresh(priority)
|
| 749 |
return {column.name: getattr(priority, column.name) for column in priority.__table__.columns}
|
| 750 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
def clear_cache(self):
|
| 752 |
"""Clear the internal cache to force fresh data on next request"""
|
| 753 |
self._cache.clear()
|
|
|
|
| 748 |
self.db.refresh(priority)
|
| 749 |
return {column.name: getattr(priority, column.name) for column in priority.__table__.columns}
|
| 750 |
|
| 751 |
+
def delete_state(self, state_id: int) -> bool:
|
| 752 |
+
"""Delete a state"""
|
| 753 |
+
state = self.db.query(State).filter(State.state_id == state_id).first()
|
| 754 |
+
if not state:
|
| 755 |
+
return False
|
| 756 |
+
self.db.delete(state)
|
| 757 |
+
self.db.commit()
|
| 758 |
+
return True
|
| 759 |
+
|
| 760 |
+
def delete_country(self, country_id: int) -> bool:
|
| 761 |
+
"""Delete a country"""
|
| 762 |
+
country = self.db.query(Country).filter(Country.country_id == country_id).first()
|
| 763 |
+
if not country:
|
| 764 |
+
return False
|
| 765 |
+
self.db.delete(country)
|
| 766 |
+
self.db.commit()
|
| 767 |
+
return True
|
| 768 |
+
|
| 769 |
+
def delete_company_type(self, company_type_id: int) -> bool:
|
| 770 |
+
"""Delete a company type"""
|
| 771 |
+
company_type = self.db.query(CompanyType).filter(CompanyType.company_type_id == company_type_id).first()
|
| 772 |
+
if not company_type:
|
| 773 |
+
return False
|
| 774 |
+
self.db.delete(company_type)
|
| 775 |
+
self.db.commit()
|
| 776 |
+
return True
|
| 777 |
+
|
| 778 |
+
def delete_lead_source(self, lead_generated_from_id: int) -> bool:
|
| 779 |
+
"""Delete a lead source"""
|
| 780 |
+
lead_source = self.db.query(LeadGeneratedFrom).filter(LeadGeneratedFrom.lead_generated_from_id == lead_generated_from_id).first()
|
| 781 |
+
if not lead_source:
|
| 782 |
+
return False
|
| 783 |
+
self.db.delete(lead_source)
|
| 784 |
+
self.db.commit()
|
| 785 |
+
return True
|
| 786 |
+
|
| 787 |
+
def delete_payment_term(self, payment_term_id: int) -> bool:
|
| 788 |
+
"""Delete a payment term"""
|
| 789 |
+
payment_term = self.db.query(PaymentTerm).filter(PaymentTerm.payment_term_id == payment_term_id).first()
|
| 790 |
+
if not payment_term:
|
| 791 |
+
return False
|
| 792 |
+
self.db.delete(payment_term)
|
| 793 |
+
self.db.commit()
|
| 794 |
+
return True
|
| 795 |
+
|
| 796 |
+
def delete_purchase_price(self, purchase_price_id: int) -> bool:
|
| 797 |
+
"""Delete a purchase price"""
|
| 798 |
+
purchase_price = self.db.query(PurchasePrice).filter(PurchasePrice.purchase_price_id == purchase_price_id).first()
|
| 799 |
+
if not purchase_price:
|
| 800 |
+
return False
|
| 801 |
+
self.db.delete(purchase_price)
|
| 802 |
+
self.db.commit()
|
| 803 |
+
return True
|
| 804 |
+
|
| 805 |
+
def delete_rental_price(self, rental_price_id: int) -> bool:
|
| 806 |
+
"""Delete a rental price"""
|
| 807 |
+
rental_price = self.db.query(RentalPrice).filter(RentalPrice.rental_price_id == rental_price_id).first()
|
| 808 |
+
if not rental_price:
|
| 809 |
+
return False
|
| 810 |
+
self.db.delete(rental_price)
|
| 811 |
+
self.db.commit()
|
| 812 |
+
return True
|
| 813 |
+
|
| 814 |
+
def delete_barrier_size(self, barrier_size_id: int) -> bool:
|
| 815 |
+
"""Delete a barrier size"""
|
| 816 |
+
barrier_size = self.db.query(BarrierSize).filter(BarrierSize.barrier_size_id == barrier_size_id).first()
|
| 817 |
+
if not barrier_size:
|
| 818 |
+
return False
|
| 819 |
+
self.db.delete(barrier_size)
|
| 820 |
+
self.db.commit()
|
| 821 |
+
return True
|
| 822 |
+
|
| 823 |
+
def delete_product_application(self, application_id: int) -> bool:
|
| 824 |
+
"""Delete a product application"""
|
| 825 |
+
product_application = self.db.query(ProductApplication).filter(ProductApplication.application_id == application_id).first()
|
| 826 |
+
if not product_application:
|
| 827 |
+
return False
|
| 828 |
+
self.db.delete(product_application)
|
| 829 |
+
self.db.commit()
|
| 830 |
+
return True
|
| 831 |
+
|
| 832 |
+
def delete_fob(self, fob_id: int) -> bool:
|
| 833 |
+
"""Delete a FOB"""
|
| 834 |
+
fob = self.db.query(FOB).filter(FOB.fob_id == fob_id).first()
|
| 835 |
+
if not fob:
|
| 836 |
+
return False
|
| 837 |
+
self.db.delete(fob)
|
| 838 |
+
self.db.commit()
|
| 839 |
+
return True
|
| 840 |
+
|
| 841 |
+
def delete_est_ship_date(self, est_ship_date_id: int) -> bool:
|
| 842 |
+
"""Delete an estimated ship date"""
|
| 843 |
+
est_ship_date = self.db.query(EstShipDate).filter(EstShipDate.est_ship_date_id == est_ship_date_id).first()
|
| 844 |
+
if not est_ship_date:
|
| 845 |
+
return False
|
| 846 |
+
self.db.delete(est_ship_date)
|
| 847 |
+
self.db.commit()
|
| 848 |
+
return True
|
| 849 |
+
|
| 850 |
+
def delete_est_freight(self, est_freight_id: int) -> bool:
|
| 851 |
+
"""Delete an estimated freight"""
|
| 852 |
+
est_freight = self.db.query(EstFreight).filter(EstFreight.est_freight_id == est_freight_id).first()
|
| 853 |
+
if not est_freight:
|
| 854 |
+
return False
|
| 855 |
+
self.db.delete(est_freight)
|
| 856 |
+
self.db.commit()
|
| 857 |
+
return True
|
| 858 |
+
|
| 859 |
+
def delete_status_info(self, status_info_id: int) -> bool:
|
| 860 |
+
"""Delete a status info"""
|
| 861 |
+
status_info = self.db.query(StatusInfo).filter(StatusInfo.status_info_id == status_info_id).first()
|
| 862 |
+
if not status_info:
|
| 863 |
+
return False
|
| 864 |
+
self.db.delete(status_info)
|
| 865 |
+
self.db.commit()
|
| 866 |
+
return True
|
| 867 |
+
|
| 868 |
+
def delete_priority(self, priority_id: int) -> bool:
|
| 869 |
+
"""Delete a priority"""
|
| 870 |
+
priority = self.db.query(Priority).filter(Priority.priority_id == priority_id).first()
|
| 871 |
+
if not priority:
|
| 872 |
+
return False
|
| 873 |
+
self.db.delete(priority)
|
| 874 |
+
self.db.commit()
|
| 875 |
+
return True
|
| 876 |
+
|
| 877 |
def clear_cache(self):
|
| 878 |
"""Clear the internal cache to force fresh data on next request"""
|
| 879 |
self._cache.clear()
|
app/services/reference_service.py
CHANGED
|
@@ -288,6 +288,62 @@ class ReferenceDataService:
|
|
| 288 |
return PriorityOut(**result)
|
| 289 |
return None
|
| 290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
def get_fobs(self, active_only: bool = True):
|
| 292 |
"""Get all FOBs as Pydantic models"""
|
| 293 |
fobs_data = self.repo.get_fobs(active_only)
|
|
|
|
| 288 |
return PriorityOut(**result)
|
| 289 |
return None
|
| 290 |
|
| 291 |
+
def delete_state(self, state_id: int) -> bool:
|
| 292 |
+
"""Delete a state"""
|
| 293 |
+
return self.repo.delete_state(state_id)
|
| 294 |
+
|
| 295 |
+
def delete_country(self, country_id: int) -> bool:
|
| 296 |
+
"""Delete a country"""
|
| 297 |
+
return self.repo.delete_country(country_id)
|
| 298 |
+
|
| 299 |
+
def delete_company_type(self, company_type_id: int) -> bool:
|
| 300 |
+
"""Delete a company type"""
|
| 301 |
+
return self.repo.delete_company_type(company_type_id)
|
| 302 |
+
|
| 303 |
+
def delete_lead_source(self, lead_generated_from_id: int) -> bool:
|
| 304 |
+
"""Delete a lead source"""
|
| 305 |
+
return self.repo.delete_lead_source(lead_generated_from_id)
|
| 306 |
+
|
| 307 |
+
def delete_payment_term(self, payment_term_id: int) -> bool:
|
| 308 |
+
"""Delete a payment term"""
|
| 309 |
+
return self.repo.delete_payment_term(payment_term_id)
|
| 310 |
+
|
| 311 |
+
def delete_purchase_price(self, purchase_price_id: int) -> bool:
|
| 312 |
+
"""Delete a purchase price"""
|
| 313 |
+
return self.repo.delete_purchase_price(purchase_price_id)
|
| 314 |
+
|
| 315 |
+
def delete_rental_price(self, rental_price_id: int) -> bool:
|
| 316 |
+
"""Delete a rental price"""
|
| 317 |
+
return self.repo.delete_rental_price(rental_price_id)
|
| 318 |
+
|
| 319 |
+
def delete_barrier_size(self, barrier_size_id: int) -> bool:
|
| 320 |
+
"""Delete a barrier size"""
|
| 321 |
+
return self.repo.delete_barrier_size(barrier_size_id)
|
| 322 |
+
|
| 323 |
+
def delete_product_application(self, application_id: int) -> bool:
|
| 324 |
+
"""Delete a product application"""
|
| 325 |
+
return self.repo.delete_product_application(application_id)
|
| 326 |
+
|
| 327 |
+
def delete_fob(self, fob_id: int) -> bool:
|
| 328 |
+
"""Delete a FOB"""
|
| 329 |
+
return self.repo.delete_fob(fob_id)
|
| 330 |
+
|
| 331 |
+
def delete_est_ship_date(self, est_ship_date_id: int) -> bool:
|
| 332 |
+
"""Delete an estimated ship date"""
|
| 333 |
+
return self.repo.delete_est_ship_date(est_ship_date_id)
|
| 334 |
+
|
| 335 |
+
def delete_est_freight(self, est_freight_id: int) -> bool:
|
| 336 |
+
"""Delete an estimated freight"""
|
| 337 |
+
return self.repo.delete_est_freight(est_freight_id)
|
| 338 |
+
|
| 339 |
+
def delete_status_info(self, status_info_id: int) -> bool:
|
| 340 |
+
"""Delete a status info"""
|
| 341 |
+
return self.repo.delete_status_info(status_info_id)
|
| 342 |
+
|
| 343 |
+
def delete_priority(self, priority_id: int) -> bool:
|
| 344 |
+
"""Delete a priority"""
|
| 345 |
+
return self.repo.delete_priority(priority_id)
|
| 346 |
+
|
| 347 |
def get_fobs(self, active_only: bool = True):
|
| 348 |
"""Get all FOBs as Pydantic models"""
|
| 349 |
fobs_data = self.repo.get_fobs(active_only)
|