Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PC-33658)[API] Delete old provider API columns #15805

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 0 additions & 5 deletions api/src/pcapi/scripts/rebuild_staging/anonymize.sql
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ UPDATE invoice SET token = 'anonymized-' || id::text;

UPDATE activation_code SET code = 'FAKE-' || id::text ;

UPDATE provider
SET "authToken" = 'anonymized, you may have to set it if you want to use this provider'
WHERE "authToken" IS NOT NULL
;

UPDATE provider
SET
"bookingExternalUrl" = 'http://mock-api-billeterie.mock-api-billeterie.svc.cluster.local:5003/tickets/create',
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
Loading