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

Remove SharedCollectionAPI and IntegrationClient 🔥 (PP-224) #1298

Merged
merged 4 commits into from
Aug 10, 2023
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
122 changes: 122 additions & 0 deletions alembic/versions/20230726_2f1a51aa0ee8_remove_integration_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"""Remove integration client

Revision ID: 2f1a51aa0ee8
Revises: 892c8e0c89f8
Create Date: 2023-07-26 13:34:02.924885+00:00

"""
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

from alembic import op

# revision identifiers, used by Alembic.
revision = "2f1a51aa0ee8"
down_revision = "892c8e0c89f8"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.drop_index("ix_datasources_integration_client_id", table_name="datasources")
op.drop_constraint(
"datasources_integration_client_id_fkey", "datasources", type_="foreignkey"
)
op.drop_column("datasources", "integration_client_id")
op.drop_index("ix_holds_integration_client_id", table_name="holds")
op.drop_constraint("holds_integration_client_id_fkey", "holds", type_="foreignkey")
op.drop_column("holds", "integration_client_id")
op.drop_index("ix_loans_integration_client_id", table_name="loans")
op.drop_constraint("loans_integration_client_id_fkey", "loans", type_="foreignkey")
op.drop_column("loans", "integration_client_id")
op.drop_index(
"ix_integrationclients_shared_secret", table_name="integrationclients"
)
op.drop_table("integrationclients")


def downgrade() -> None:
op.create_table(
"integrationclients",
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column("url", sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column("shared_secret", sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column("enabled", sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column(
"created",
postgresql.TIMESTAMP(timezone=True),
autoincrement=False,
nullable=True,
),
sa.Column(
"last_accessed",
postgresql.TIMESTAMP(timezone=True),
autoincrement=False,
nullable=True,
),
sa.PrimaryKeyConstraint("id", name="integrationclients_pkey"),
sa.UniqueConstraint("url", name="integrationclients_url_key"),
)
op.create_index(
"ix_integrationclients_shared_secret",
"integrationclients",
["shared_secret"],
unique=False,
)
op.add_column(
"loans",
sa.Column(
"integration_client_id", sa.INTEGER(), autoincrement=False, nullable=True
),
)
op.create_foreign_key(
"loans_integration_client_id_fkey",
"loans",
"integrationclients",
["integration_client_id"],
["id"],
)
op.create_index(
"ix_loans_integration_client_id",
"loans",
["integration_client_id"],
unique=False,
)
op.add_column(
"holds",
sa.Column(
"integration_client_id", sa.INTEGER(), autoincrement=False, nullable=True
),
)
op.create_foreign_key(
"holds_integration_client_id_fkey",
"holds",
"integrationclients",
["integration_client_id"],
["id"],
)
op.create_index(
"ix_holds_integration_client_id",
"holds",
["integration_client_id"],
unique=False,
)
op.add_column(
"datasources",
sa.Column(
"integration_client_id", sa.INTEGER(), autoincrement=False, nullable=True
),
)
op.create_foreign_key(
"datasources_integration_client_id_fkey",
"datasources",
"integrationclients",
["integration_client_id"],
["id"],
)
op.create_index(
"ix_datasources_integration_client_id",
"datasources",
["integration_client_id"],
unique=False,
)
4 changes: 1 addition & 3 deletions api/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,12 @@ def __init__(
end_date,
hold_position,
external_identifier=None,
integration_client=None,
):
super().__init__(collection, data_source_name, identifier_type, identifier)
self.start_date = start_date
self.end_date = end_date
self.hold_position = hold_position
self.external_identifier = external_identifier
self.integration_client = integration_client

def __repr__(self):
return "<HoldInfo for {}/{}, start={} end={}, position={}>".format(
Expand Down Expand Up @@ -1250,7 +1248,7 @@ def borrow(
# to needing to put it on hold, but we do check for that case.
__transaction = self._db.begin_nested()
hold, is_new = licensepool.on_hold_to(
hold_info.integration_client or patron,
patron,
hold_info.start_date or now,
hold_info.end_date,
hold_info.hold_position,
Expand Down
Loading