Skip to content

Commit

Permalink
chore: Merge branch 'release-0.2.0' into refactor/hamed-replace-typog…
Browse files Browse the repository at this point in the history
…raphy-bctypography-1341
  • Loading branch information
hamed-valiollahi committed Dec 11, 2024
2 parents a299583 + 85c783d commit 769a7c5
Show file tree
Hide file tree
Showing 55 changed files with 2,286 additions and 205 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Add Organization name to FSE
Revision ID: 9206124a098b
Revises: aeaa26f5cdd5
Create Date: 2024-12-04 09:59:22.876386
"""
from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = '9206124a098b'
down_revision = '26ab15f8ab18'
branch_labels = None
depends_on = None


def upgrade():
# Add the column 'organization_name' to 'final_supply_equipment' table
op.add_column("final_supply_equipment", sa.Column("organization_name", sa.String(), nullable=True))


def downgrade():
# Remove the column 'organization_name' from 'final_supply_equipment' table
op.drop_column("final_supply_equipment", "organization_name")
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""Remove notifications email from user_profile
Revision ID: cd8698fe40e6
Revises: 26ab15f8ab18
Create Date: 2024-12-09 22:33:29.554360
"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "cd8698fe40e6"
down_revision = "9206124a098b"
branch_labels = None
depends_on = None


def upgrade() -> None:
# Remove notifications_email column from user_profile table
op.drop_column("user_profile", "notifications_email")


def downgrade() -> None:
# Add notifications_email column to user_profile table
op.add_column(
"user_profile",
sa.Column(
"notifications_email",
sa.String(length=255),
nullable=True,
comment="Email address used for notifications",
),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"""Update Fuel Types measured in volume to be other-uses
Revision ID: 7ae38a8413ab
Revises: 26ab15f8ab18
Create Date: 2024-12-09 19:31:18.199089
"""

import sqlalchemy as sa
from alembic import op
from datetime import datetime

# revision identifiers, used by Alembic.
revision = "7ae38a8413ab"
down_revision = "cd8698fe40e6"
branch_labels = None
depends_on = None


def upgrade() -> None:
current_time = datetime.now()

# Update the `other_uses_fossil_derived` field for all specified fuel types
op.execute(
f"""
UPDATE fuel_type
SET other_uses_fossil_derived = true,
update_date = '{current_time}',
update_user = 'no_user'
WHERE fuel_type IN (
'Alternative jet fuel',
'Biodiesel',
'Ethanol',
'HDRD',
'Renewable gasoline',
'Renewable naphtha'
)
"""
)

# Update the `other_uses_fossil_derived` field for all specified fuel types
op.execute(
f"""
UPDATE fuel_type
SET other_uses_fossil_derived = false,
update_date = '{current_time}',
update_user = 'no_user'
WHERE fuel_type IN (
'CNG',
'Electricity',
'Hydrogen',
'LNG',
'Propane'
)
"""
)


def downgrade() -> None:
current_time = datetime.now()

# Revert the `other_uses_fossil_derived` field to false for the first set of fuel types
op.execute(
f"""
UPDATE fuel_type
SET other_uses_fossil_derived = false,
update_date = '{current_time}',
update_user = 'no_user'
WHERE fuel_type IN (
'Alternative jet fuel',
'Biodiesel',
'Ethanol',
'HDRD',
'Renewable gasoline',
'Renewable naphtha'
)
"""
)

# Revert the `other_uses_fossil_derived` field to true for the second set of fuel types
op.execute(
f"""
UPDATE fuel_type
SET other_uses_fossil_derived = true,
update_date = '{current_time}',
update_user = 'no_user'
WHERE fuel_type IN (
'CNG',
'Electricity',
'Hydrogen',
'LNG',
'Propane'
)
"""
)
1 change: 1 addition & 0 deletions backend/lcfs/db/models/compliance/FinalSupplyEquipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class FinalSupplyEquipment(BaseModel, Auditable):
Double, nullable=False, comment="The longitude of the equipment location."
)
notes = Column(Text, comment="Any additional notes related to the equipment.")
organization_name = Column(Text, comment="External organization name.")

# relationships
compliance_report = relationship(
Expand Down
3 changes: 0 additions & 3 deletions backend/lcfs/db/models/user/UserProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ class UserProfile(BaseModel, Auditable):
String(150), unique=True, nullable=False, comment="keycloak Username"
)
email = Column(String(255), nullable=True, comment="Primary email address")
notifications_email = Column(
String(255), nullable=True, comment="Email address used for notifications"
)
title = Column(String(100), nullable=True, comment="Professional Title")
phone = Column(String(50), nullable=True, comment="Primary phone number")
mobile_phone = Column(String(50), nullable=True, comment="Mobile phone number")
Expand Down
Loading

0 comments on commit 769a7c5

Please sign in to comment.