Skip to content

Commit

Permalink
(PC-33658)[API] feat: drop apiUrl & authToken columns in provider…
Browse files Browse the repository at this point in the history
… table
  • Loading branch information
tcoudray-pass committed Jan 10, 2025
1 parent 989ead4 commit 8db22d8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/alembic_version_conflict_detection.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
f0b5bf6e0d3f (pre) (head)
64c8345d8d49 (post) (head)
b44dae2d1489 (post) (head)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Drop `apiUrl` & `authToken` columns in provider table
"""

from alembic import op
import sqlalchemy as sa


# pre/post deployment: post
# revision identifiers, used by Alembic.
revision = "b44dae2d1489"
down_revision = "64c8345d8d49"
branch_labels: tuple[str] | None = None
depends_on: list[str] | None = None


def upgrade() -> None:
op.drop_column("provider", "authToken")
op.drop_column("provider", "apiUrl")


def downgrade() -> None:
op.add_column("provider", sa.Column("apiUrl", sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column("provider", sa.Column("authToken", sa.VARCHAR(), autoincrement=False, nullable=True))
1 change: 0 additions & 1 deletion api/src/pcapi/core/providers/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Meta:
name = factory.Sequence("Provider {}".format)
localClass = factory.Sequence("{}Stocks".format)
hmacKey = "secret"
apiUrl = None
enabledForPro = True
isActive = True

Expand Down
11 changes: 1 addition & 10 deletions api/src/pcapi/core/providers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@
class Provider(PcObject, Base, Model, DeactivableMixin):
name: str = sa.Column(sa.String(90), index=True, nullable=False)

localClass = sa.Column(
sa.String(60),
nullable=True,
unique=True,
)

# presence of this field signifies the provider implements pass Culture's provider API
apiUrl = sa.Column(sa.String, nullable=True)

authToken = sa.Column(sa.String, nullable=True)
localClass = sa.Column(sa.String(60), nullable=True, unique=True)

enabledForPro: bool = sa.Column(sa.Boolean, nullable=False, default=False, server_default=sa_sql.expression.false())

Expand Down
1 change: 0 additions & 1 deletion api/src/pcapi/routes/backoffice/venues/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def get_venue(venue_id: int) -> offerers_models.Venue:
providers_models.Provider.id,
providers_models.Provider.name,
providers_models.Provider.localClass,
providers_models.Provider.apiUrl,
providers_models.Provider.isActive,
),
sa.orm.joinedload(offerers_models.Venue.accessibilityProvider).load_only(
Expand Down
1 change: 0 additions & 1 deletion api/tests/core/providers/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def test_permanent_venue_marking(
provider = providers_factories.ProviderFactory(
enabledForPro=True,
isActive=True,
apiUrl="https://example.com/api",
localClass=None,
)
author = users_factories.UserFactory()
Expand Down

0 comments on commit 8db22d8

Please sign in to comment.