diff --git a/backend/lcfs/db/migrations/versions/2024-12-19-23-46_ab04810d4d7c.py b/backend/lcfs/db/migrations/versions/2024-12-19-23-46_ab04810d4d7c.py new file mode 100644 index 000000000..2ce5f6430 --- /dev/null +++ b/backend/lcfs/db/migrations/versions/2024-12-19-23-46_ab04810d4d7c.py @@ -0,0 +1,36 @@ +"""Add UQ to TCI + +Revision ID: ab04810d4d7c +Revises: 851e09cf8661 +Create Date: 2024-12-19 23:46:37.505166 + +""" + +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "ab04810d4d7c" +down_revision = "851e09cf8661" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_unique_constraint( + "uq_target_carbon_intensity_compliance_fuel", + "target_carbon_intensity", + ["compliance_period_id", "fuel_category_id"], + ) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_constraint( + "uq_target_carbon_intensity_compliance_fuel", + "target_carbon_intensity", + type_="unique", + ) + # ### end Alembic commands ### diff --git a/backend/lcfs/db/models/admin_adjustment/AdminAdjustment.py b/backend/lcfs/db/models/admin_adjustment/AdminAdjustment.py index 49443d9d2..f23c0d306 100644 --- a/backend/lcfs/db/models/admin_adjustment/AdminAdjustment.py +++ b/backend/lcfs/db/models/admin_adjustment/AdminAdjustment.py @@ -1,13 +1,12 @@ from sqlalchemy import Column, Integer, BigInteger, ForeignKey, DateTime, String from sqlalchemy.orm import relationship -from sqlalchemy import UniqueConstraint + from lcfs.db.base import BaseModel, Auditable, EffectiveDates class AdminAdjustment(BaseModel, Auditable, EffectiveDates): __tablename__ = "admin_adjustment" __table_args__ = ( - UniqueConstraint("admin_adjustment_id"), {"comment": "Goverment to organization compliance units admin_adjustment"}, ) diff --git a/backend/lcfs/db/models/admin_adjustment/AdminAdjustmentHistory.py b/backend/lcfs/db/models/admin_adjustment/AdminAdjustmentHistory.py index 36fbf0d6f..4243891f7 100644 --- a/backend/lcfs/db/models/admin_adjustment/AdminAdjustmentHistory.py +++ b/backend/lcfs/db/models/admin_adjustment/AdminAdjustmentHistory.py @@ -1,13 +1,12 @@ -from sqlalchemy import Column, Integer, BigInteger, ForeignKey, DateTime +from sqlalchemy import Column, Integer, ForeignKey from sqlalchemy.orm import relationship -from sqlalchemy import UniqueConstraint + from lcfs.db.base import BaseModel, Auditable, EffectiveDates class AdminAdjustmentHistory(BaseModel, Auditable, EffectiveDates): __tablename__ = "admin_adjustment_history" __table_args__ = ( - UniqueConstraint("admin_adjustment_history_id"), {"comment": "History record for admin_adjustment status change."}, ) diff --git a/backend/lcfs/db/models/comment/InternalComment.py b/backend/lcfs/db/models/comment/InternalComment.py index 56dcecbc9..aba68d742 100644 --- a/backend/lcfs/db/models/comment/InternalComment.py +++ b/backend/lcfs/db/models/comment/InternalComment.py @@ -1,18 +1,22 @@ -from sqlalchemy import Column, Integer, Text, UniqueConstraint -from sqlalchemy.orm import relationship +from sqlalchemy import Column, Integer, Text from sqlalchemy.dialects.postgresql import ENUM +from sqlalchemy.orm import relationship + from lcfs.db.base import BaseModel, Auditable # ENUM for audience scope audience_scope_enum = ENUM( - "Director", "Analyst", "Compliance Manager", name="audience_scope", create_type=False + "Director", + "Analyst", + "Compliance Manager", + name="audience_scope", + create_type=False, ) class InternalComment(BaseModel, Auditable): __tablename__ = "internal_comment" __table_args__ = ( - UniqueConstraint("internal_comment_id"), {"comment": "Stores internal comments with scope and related metadata."}, ) @@ -42,4 +46,4 @@ class InternalComment(BaseModel, Auditable): ) compliance_report_internal_comments = relationship( "ComplianceReportInternalComment", back_populates="internal_comment" - ) \ No newline at end of file + ) diff --git a/backend/lcfs/db/models/compliance/CompliancePeriod.py b/backend/lcfs/db/models/compliance/CompliancePeriod.py index 187f7ee67..07e330583 100644 --- a/backend/lcfs/db/models/compliance/CompliancePeriod.py +++ b/backend/lcfs/db/models/compliance/CompliancePeriod.py @@ -1,5 +1,6 @@ -from sqlalchemy import Column, Integer, String, Date +from sqlalchemy import Column, Integer, String from sqlalchemy.orm import relationship + from lcfs.db.base import BaseModel, EffectiveDates diff --git a/backend/lcfs/db/models/compliance/ComplianceReport.py b/backend/lcfs/db/models/compliance/ComplianceReport.py index 6656cc6ec..43f28a00e 100644 --- a/backend/lcfs/db/models/compliance/ComplianceReport.py +++ b/backend/lcfs/db/models/compliance/ComplianceReport.py @@ -1,17 +1,17 @@ -import uuid import enum +import uuid from pydantic import computed_field from sqlalchemy import ( Column, Integer, String, - ForeignKey, Enum, Table, ForeignKey, ) -from sqlalchemy.orm import relationship, backref +from sqlalchemy.orm import relationship + from lcfs.db.base import BaseModel, Auditable diff --git a/backend/lcfs/db/models/document/Document.py b/backend/lcfs/db/models/document/Document.py index 865df76ee..8639d8229 100644 --- a/backend/lcfs/db/models/document/Document.py +++ b/backend/lcfs/db/models/document/Document.py @@ -1,5 +1,4 @@ -from sqlalchemy import Column, Integer, String, ForeignKey -from sqlalchemy import UniqueConstraint +from sqlalchemy import Column, Integer, String from sqlalchemy.orm import relationship from lcfs.db.base import BaseModel, Auditable @@ -11,7 +10,6 @@ class Document(BaseModel, Auditable): __tablename__ = "document" __table_args__ = ( - UniqueConstraint("document_id"), {"comment": "Main document table for storing base document information"}, ) diff --git a/backend/lcfs/db/models/fuel/FuelCategory.py b/backend/lcfs/db/models/fuel/FuelCategory.py index f4d3f0791..ab1615ef0 100644 --- a/backend/lcfs/db/models/fuel/FuelCategory.py +++ b/backend/lcfs/db/models/fuel/FuelCategory.py @@ -1,7 +1,8 @@ -from sqlalchemy import Column, Integer, Text, Enum, Float, Numeric -from lcfs.db.base import BaseModel, Auditable, DisplayOrder, EffectiveDates +from sqlalchemy import Column, Integer, Text, Enum, Numeric from sqlalchemy.orm import relationship +from lcfs.db.base import BaseModel, Auditable, DisplayOrder, EffectiveDates + class FuelCategory(BaseModel, Auditable, DisplayOrder, EffectiveDates): diff --git a/backend/lcfs/db/models/fuel/FuelType.py b/backend/lcfs/db/models/fuel/FuelType.py index 5f652b738..4ebbb7aae 100644 --- a/backend/lcfs/db/models/fuel/FuelType.py +++ b/backend/lcfs/db/models/fuel/FuelType.py @@ -1,9 +1,11 @@ -from sqlalchemy import Column, Integer, Text, Boolean, Float, Enum, Numeric -from lcfs.db.base import BaseModel, Auditable, DisplayOrder -from sqlalchemy.orm import relationship -from sqlalchemy import ForeignKey import enum +from sqlalchemy import Column, Integer, Text, Boolean, Enum, Numeric +from sqlalchemy import ForeignKey +from sqlalchemy.orm import relationship + +from lcfs.db.base import BaseModel, Auditable, DisplayOrder + # Enum for fuel quantity units class QuantityUnitsEnum(enum.Enum): diff --git a/backend/lcfs/db/models/initiative_agreement/InitiativeAgreement.py b/backend/lcfs/db/models/initiative_agreement/InitiativeAgreement.py index 63d5a9817..590c80239 100644 --- a/backend/lcfs/db/models/initiative_agreement/InitiativeAgreement.py +++ b/backend/lcfs/db/models/initiative_agreement/InitiativeAgreement.py @@ -1,13 +1,12 @@ from sqlalchemy import Column, Integer, BigInteger, ForeignKey, DateTime, String from sqlalchemy.orm import relationship -from sqlalchemy import UniqueConstraint + from lcfs.db.base import BaseModel, Auditable, EffectiveDates class InitiativeAgreement(BaseModel, Auditable, EffectiveDates): __tablename__ = "initiative_agreement" __table_args__ = ( - UniqueConstraint("initiative_agreement_id"), {"comment": "Goverment to organization compliance units initiative agreement"}, ) diff --git a/backend/lcfs/db/models/initiative_agreement/InitiativeAgreementHistory.py b/backend/lcfs/db/models/initiative_agreement/InitiativeAgreementHistory.py index 868c96f8d..03abf6add 100644 --- a/backend/lcfs/db/models/initiative_agreement/InitiativeAgreementHistory.py +++ b/backend/lcfs/db/models/initiative_agreement/InitiativeAgreementHistory.py @@ -1,13 +1,12 @@ -from sqlalchemy import Column, Integer, BigInteger, ForeignKey, DateTime +from sqlalchemy import Column, Integer, ForeignKey from sqlalchemy.orm import relationship -from sqlalchemy import UniqueConstraint + from lcfs.db.base import BaseModel, Auditable, EffectiveDates class InitiativeAgreementHistory(BaseModel, Auditable, EffectiveDates): __tablename__ = "initiative_agreement_history" __table_args__ = ( - UniqueConstraint("initiative_agreement_history_id"), {"comment": "History record for initiative agreement status change."}, ) diff --git a/backend/lcfs/db/models/transaction/Transaction.py b/backend/lcfs/db/models/transaction/Transaction.py index 10042ab68..978ce1796 100644 --- a/backend/lcfs/db/models/transaction/Transaction.py +++ b/backend/lcfs/db/models/transaction/Transaction.py @@ -1,7 +1,6 @@ import enum from sqlalchemy import Column, Integer, BigInteger, ForeignKey, Enum -from sqlalchemy import UniqueConstraint from sqlalchemy.orm import relationship from lcfs.db.base import BaseModel, Auditable, EffectiveDates @@ -16,7 +15,6 @@ class TransactionActionEnum(enum.Enum): class Transaction(BaseModel, Auditable, EffectiveDates): __tablename__ = "transaction" __table_args__ = ( - UniqueConstraint("transaction_id"), { "comment": "Contains a list of all of the government to organization and Organization to Organization transaction." }, diff --git a/backend/lcfs/db/models/transfer/Transfer.py b/backend/lcfs/db/models/transfer/Transfer.py index 5869dce0b..12b730d22 100644 --- a/backend/lcfs/db/models/transfer/Transfer.py +++ b/backend/lcfs/db/models/transfer/Transfer.py @@ -1,7 +1,8 @@ import enum + from sqlalchemy import Column, Integer, ForeignKey, DateTime, Enum, String, Numeric from sqlalchemy.orm import relationship -from sqlalchemy import UniqueConstraint + from lcfs.db.base import BaseModel, Auditable, EffectiveDates @@ -13,7 +14,6 @@ class TransferRecommendationEnum(enum.Enum): class Transfer(BaseModel, Auditable, EffectiveDates): __tablename__ = "transfer" __table_args__ = ( - UniqueConstraint("transfer_id"), {"comment": "Records of tranfer from Organization to Organization"}, ) diff --git a/backend/lcfs/db/models/transfer/TransferCategory.py b/backend/lcfs/db/models/transfer/TransferCategory.py index 8bab13e73..6b41e1510 100644 --- a/backend/lcfs/db/models/transfer/TransferCategory.py +++ b/backend/lcfs/db/models/transfer/TransferCategory.py @@ -14,10 +14,7 @@ class TransferCategoryEnum(enum.Enum): class TransferCategory(BaseModel, Auditable, EffectiveDates): __tablename__ = "transfer_category" - __table_args__ = ( - UniqueConstraint("transfer_category_id"), - {"comment": "Transfer Category"}, - ) + __table_args__ = ({"comment": "Transfer Category"},) transfer_category_id = Column( Integer, diff --git a/backend/lcfs/db/models/transfer/TransferHistory.py b/backend/lcfs/db/models/transfer/TransferHistory.py index 1cdd702b4..48f485015 100644 --- a/backend/lcfs/db/models/transfer/TransferHistory.py +++ b/backend/lcfs/db/models/transfer/TransferHistory.py @@ -1,5 +1,6 @@ -from sqlalchemy import Column, Integer, ForeignKey, DateTime +from sqlalchemy import Column, Integer, ForeignKey from sqlalchemy.orm import relationship + from lcfs.db.base import BaseModel, Auditable, EffectiveDates diff --git a/backend/lcfs/tests/fuel_code/test_fuel_code_repo.py b/backend/lcfs/tests/fuel_code/test_fuel_code_repo.py index 729ac6f12..a7fd952bc 100644 --- a/backend/lcfs/tests/fuel_code/test_fuel_code_repo.py +++ b/backend/lcfs/tests/fuel_code/test_fuel_code_repo.py @@ -1,26 +1,23 @@ from datetime import date -from unittest import mock +from unittest.mock import AsyncMock, MagicMock import pytest -from unittest.mock import AsyncMock, MagicMock from sqlalchemy.exc import NoResultFound -from sqlalchemy.orm import joinedload -from lcfs.web.api.fuel_code.repo import FuelCodeRepository -from lcfs.db.models.fuel.TransportMode import TransportMode -from lcfs.db.models.fuel.FuelType import FuelType -from lcfs.db.models.fuel.FuelCategory import FuelCategory -from lcfs.db.models.fuel.UnitOfMeasure import UnitOfMeasure +from lcfs.db.models.fuel.AdditionalCarbonIntensity import AdditionalCarbonIntensity +from lcfs.db.models.fuel.EnergyDensity import EnergyDensity +from lcfs.db.models.fuel.EnergyEffectivenessRatio import EnergyEffectivenessRatio from lcfs.db.models.fuel.ExpectedUseType import ExpectedUseType +from lcfs.db.models.fuel.FuelCategory import FuelCategory from lcfs.db.models.fuel.FuelCode import FuelCode from lcfs.db.models.fuel.FuelCodePrefix import FuelCodePrefix from lcfs.db.models.fuel.FuelCodeStatus import FuelCodeStatus, FuelCodeStatusEnum -from lcfs.db.models.fuel.EnergyDensity import EnergyDensity -from lcfs.db.models.fuel.EnergyEffectivenessRatio import EnergyEffectivenessRatio +from lcfs.db.models.fuel.FuelType import FuelType from lcfs.db.models.fuel.ProvisionOfTheAct import ProvisionOfTheAct -from lcfs.db.models.fuel.AdditionalCarbonIntensity import AdditionalCarbonIntensity from lcfs.db.models.fuel.TargetCarbonIntensity import TargetCarbonIntensity -from lcfs.db.models.compliance.CompliancePeriod import CompliancePeriod +from lcfs.db.models.fuel.TransportMode import TransportMode +from lcfs.db.models.fuel.UnitOfMeasure import UnitOfMeasure +from lcfs.web.api.fuel_code.repo import FuelCodeRepository from lcfs.web.exception.exceptions import DatabaseException diff --git a/backend/lcfs/tests/fuel_supply/test_fuel_supplies_actions_service.py b/backend/lcfs/tests/fuel_supply/test_fuel_supplies_actions_service.py index 1b16bda9a..ec0f33ff1 100644 --- a/backend/lcfs/tests/fuel_supply/test_fuel_supplies_actions_service.py +++ b/backend/lcfs/tests/fuel_supply/test_fuel_supplies_actions_service.py @@ -1,6 +1,3 @@ -# test_fuel_supply.py - -from datetime import datetime from unittest.mock import AsyncMock from uuid import uuid4 diff --git a/backend/lcfs/tests/fuel_supply/test_fuel_supplies_services.py b/backend/lcfs/tests/fuel_supply/test_fuel_supplies_services.py index ab4fa7b50..9b5114a84 100644 --- a/backend/lcfs/tests/fuel_supply/test_fuel_supplies_services.py +++ b/backend/lcfs/tests/fuel_supply/test_fuel_supplies_services.py @@ -1,17 +1,17 @@ -import uuid +from unittest.mock import MagicMock, AsyncMock + import pytest -from unittest.mock import MagicMock, AsyncMock, patch from fastapi import HTTPException +from lcfs.db.base import UserTypeEnum, ActionTypeEnum from lcfs.db.models import ( FuelType, EnergyEffectivenessRatio, EnergyDensity, - FuelCategory, ) -from lcfs.db.base import UserTypeEnum, ActionTypeEnum -from lcfs.web.api.fuel_supply.actions_service import FuelSupplyActionService +from lcfs.db.models.compliance.FuelSupply import FuelSupply from lcfs.web.api.fuel_code.repo import FuelCodeRepository +from lcfs.web.api.fuel_supply.actions_service import FuelSupplyActionService from lcfs.web.api.fuel_supply.repo import FuelSupplyRepository from lcfs.web.api.fuel_supply.schema import ( FuelSupplyCreateUpdateSchema, @@ -21,10 +21,8 @@ FuelTypeSchema, FuelCategoryResponseSchema, ) -from lcfs.db.models.compliance.FuelSupply import FuelSupply from lcfs.web.api.fuel_supply.services import FuelSupplyServices - # Fixture to set up the FuelSupplyServices with mocked dependencies # Mock common fuel type and fuel category for reuse fuel_type = FuelTypeSchema( diff --git a/backend/lcfs/web/api/compliance_report/repo.py b/backend/lcfs/web/api/compliance_report/repo.py index 59696d6ab..1e3d845e2 100644 --- a/backend/lcfs/web/api/compliance_report/repo.py +++ b/backend/lcfs/web/api/compliance_report/repo.py @@ -1,47 +1,46 @@ -import structlog -from typing import List, Optional, Dict from collections import defaultdict from datetime import datetime +from typing import List, Optional, Dict -from lcfs.db.models import UserProfile -from lcfs.db.models.organization.Organization import Organization -from lcfs.db.models.user.UserProfile import UserProfile -from lcfs.db.models.fuel.FuelType import FuelType -from lcfs.db.models.fuel.FuelCategory import FuelCategory -from lcfs.db.models.fuel.ExpectedUseType import ExpectedUseType +import structlog +from fastapi import Depends from sqlalchemy import func, select, and_, asc, desc -from sqlalchemy.orm import joinedload from sqlalchemy.ext.asyncio import AsyncSession -from fastapi import Depends +from sqlalchemy.orm import joinedload -from lcfs.web.api.base import ( - PaginationRequestSchema, - apply_filter_conditions, - get_field_for_filter, -) +from lcfs.db.dependencies import get_async_db_session from lcfs.db.models.compliance import CompliancePeriod +from lcfs.db.models.compliance.AllocationAgreement import AllocationAgreement from lcfs.db.models.compliance.ComplianceReport import ( ComplianceReport, ReportingFrequency, ) -from lcfs.db.models.compliance.ComplianceReportSummary import ComplianceReportSummary +from lcfs.db.models.compliance.ComplianceReportHistory import ComplianceReportHistory from lcfs.db.models.compliance.ComplianceReportStatus import ( ComplianceReportStatus, ComplianceReportStatusEnum, ) +from lcfs.db.models.compliance.ComplianceReportSummary import ComplianceReportSummary +from lcfs.db.models.compliance.FuelSupply import FuelSupply +from lcfs.db.models.compliance.OtherUses import OtherUses +from lcfs.db.models.fuel.ExpectedUseType import ExpectedUseType +from lcfs.db.models.fuel.FuelCategory import FuelCategory +from lcfs.db.models.fuel.FuelType import FuelType +from lcfs.db.models.initiative_agreement.InitiativeAgreement import InitiativeAgreement +from lcfs.db.models.organization.Organization import Organization +from lcfs.db.models.transfer.Transfer import Transfer +from lcfs.db.models.user.UserProfile import UserProfile +from lcfs.web.api.base import ( + PaginationRequestSchema, + apply_filter_conditions, + get_field_for_filter, +) from lcfs.web.api.compliance_report.schema import ( ComplianceReportBaseSchema, ComplianceReportSummaryUpdateSchema, ) -from lcfs.db.models.compliance.ComplianceReportHistory import ComplianceReportHistory -from lcfs.web.core.decorators import repo_handler -from lcfs.db.dependencies import get_async_db_session -from lcfs.db.models.compliance.OtherUses import OtherUses -from lcfs.db.models.transfer.Transfer import Transfer -from lcfs.db.models.initiative_agreement.InitiativeAgreement import InitiativeAgreement -from lcfs.db.models.compliance.AllocationAgreement import AllocationAgreement -from lcfs.db.models.compliance.FuelSupply import FuelSupply from lcfs.web.api.fuel_supply.repo import FuelSupplyRepository +from lcfs.web.core.decorators import repo_handler logger = structlog.get_logger(__name__) diff --git a/backend/lcfs/web/api/fuel_export/actions_service.py b/backend/lcfs/web/api/fuel_export/actions_service.py index cd758ca85..66247d267 100644 --- a/backend/lcfs/web/api/fuel_export/actions_service.py +++ b/backend/lcfs/web/api/fuel_export/actions_service.py @@ -1,13 +1,13 @@ import uuid from logging import getLogger -from typing import Optional + from fastapi import Depends, HTTPException from lcfs.db.base import ActionTypeEnum, UserTypeEnum -from lcfs.db.models.compliance.FuelExport import FuelExport from lcfs.db.models.compliance.ComplianceReport import QuantityUnitsEnum -from lcfs.web.api.fuel_export.repo import FuelExportRepository +from lcfs.db.models.compliance.FuelExport import FuelExport from lcfs.web.api.fuel_code.repo import FuelCodeRepository +from lcfs.web.api.fuel_export.repo import FuelExportRepository from lcfs.web.api.fuel_export.schema import ( DeleteFuelExportResponseSchema, FuelExportCreateUpdateSchema, diff --git a/backend/lcfs/web/api/fuel_export/services.py b/backend/lcfs/web/api/fuel_export/services.py index 1a3279b5c..3fc118a71 100644 --- a/backend/lcfs/web/api/fuel_export/services.py +++ b/backend/lcfs/web/api/fuel_export/services.py @@ -1,13 +1,15 @@ -import structlog import math + +import structlog from fastapi import Depends, Request -from fastapi_cache.decorator import cache +from lcfs.utils.constants import default_ci from lcfs.web.api.base import ( PaginationRequestSchema, PaginationResponseSchema, - lcfs_cache_key_builder, ) +from lcfs.web.api.compliance_report.repo import ComplianceReportRepository +from lcfs.web.api.fuel_export.repo import FuelExportRepository from lcfs.web.api.fuel_export.schema import ( EndUseTypeSchema, EnergyDensitySchema, @@ -22,13 +24,8 @@ TargetCarbonIntensitySchema, UnitOfMeasureSchema, ) -from lcfs.web.api.fuel_export.repo import FuelExportRepository -from lcfs.db.models.compliance.ComplianceReport import QuantityUnitsEnum -from lcfs.web.api.compliance_report.repo import ComplianceReportRepository from lcfs.web.api.fuel_export.validation import FuelExportValidation from lcfs.web.core.decorators import service_handler -from lcfs.web.utils.calculations import calculate_compliance_units -from lcfs.utils.constants import default_ci logger = structlog.get_logger(__name__) diff --git a/backend/lcfs/web/api/fuel_supply/actions_service.py b/backend/lcfs/web/api/fuel_supply/actions_service.py index 38efcba22..f2346b06f 100644 --- a/backend/lcfs/web/api/fuel_supply/actions_service.py +++ b/backend/lcfs/web/api/fuel_supply/actions_service.py @@ -1,12 +1,11 @@ import uuid from logging import getLogger -from typing import Optional from fastapi import Depends, HTTPException from lcfs.db.base import ActionTypeEnum, UserTypeEnum -from lcfs.db.models.compliance.FuelSupply import FuelSupply from lcfs.db.models.compliance.ComplianceReport import QuantityUnitsEnum +from lcfs.db.models.compliance.FuelSupply import FuelSupply from lcfs.web.api.fuel_code.repo import FuelCodeRepository from lcfs.web.api.fuel_supply.repo import FuelSupplyRepository from lcfs.web.api.fuel_supply.schema import ( diff --git a/backend/lcfs/web/api/fuel_supply/views.py b/backend/lcfs/web/api/fuel_supply/views.py index 9058d4586..cb95c2597 100644 --- a/backend/lcfs/web/api/fuel_supply/views.py +++ b/backend/lcfs/web/api/fuel_supply/views.py @@ -1,12 +1,13 @@ -import structlog -from typing import Optional, Union +from typing import Union +import structlog from fastapi import APIRouter, Body, Depends, Request, Response, status, HTTPException from starlette.responses import JSONResponse from lcfs.db.models.user.Role import RoleEnum from lcfs.web.api.base import PaginationRequestSchema from lcfs.web.api.compliance_report.validation import ComplianceReportValidation +from lcfs.web.api.fuel_supply.actions_service import FuelSupplyActionService from lcfs.web.api.fuel_supply.schema import ( DeleteFuelSupplyResponseSchema, FuelSuppliesSchema, @@ -17,7 +18,6 @@ ) from lcfs.web.api.fuel_supply.services import FuelSupplyServices from lcfs.web.api.fuel_supply.validation import FuelSupplyValidation -from lcfs.web.api.fuel_supply.actions_service import FuelSupplyActionService from lcfs.web.core.decorators import view_handler router = APIRouter() diff --git a/backend/lcfs/web/api/notional_transfer/services.py b/backend/lcfs/web/api/notional_transfer/services.py index 4fdca07f4..448569c9a 100644 --- a/backend/lcfs/web/api/notional_transfer/services.py +++ b/backend/lcfs/web/api/notional_transfer/services.py @@ -6,10 +6,10 @@ from fastapi import Depends from lcfs.db.base import UserTypeEnum, ActionTypeEnum -from lcfs.web.api.notional_transfer.repo import NotionalTransferRepository -from lcfs.web.core.decorators import service_handler from lcfs.db.models.compliance.NotionalTransfer import NotionalTransfer from lcfs.web.api.base import PaginationRequestSchema, PaginationResponseSchema +from lcfs.web.api.fuel_code.repo import FuelCodeRepository +from lcfs.web.api.notional_transfer.repo import NotionalTransferRepository from lcfs.web.api.notional_transfer.schema import ( NotionalTransferCreateSchema, NotionalTransferSchema, @@ -19,7 +19,7 @@ NotionalTransfersAllSchema, DeleteNotionalTransferResponseSchema, ) -from lcfs.web.api.fuel_code.repo import FuelCodeRepository +from lcfs.web.core.decorators import service_handler logger = structlog.get_logger(__name__)