Skip to content

Commit

Permalink
Merge pull request #416 from uhh-lt/remove-adocs-from-endpoints
Browse files Browse the repository at this point in the history
Remove adocs from endpoints
  • Loading branch information
bigabig authored Sep 26, 2024
2 parents 5d3b2ed + fede773 commit 7dfde14
Show file tree
Hide file tree
Showing 112 changed files with 1,939 additions and 2,505 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"name": "Celery",
"type": "node-terminal",
"request": "launch",
"command": "conda activate dats && celery -A app.celery.background_jobs.tasks worker -Q bgJobsQ,celery -P threads -l info -c 1 --without-gossip --without-mingle --without-heartbeat",
"command": "micromamba activate dats && celery -A app.celery.background_jobs.tasks worker -Q bgJobsQ,celery -P threads -l info -c 1 --without-gossip --without-mingle --without-heartbeat",
"cwd": "${workspaceFolder}/backend/src",
"envFile": "${workspaceFolder}/backend/.env"
},
Expand All @@ -46,7 +46,7 @@
},
{
"name": "Python: run_migrations.py",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/backend/src/run_migrations.py",
"console": "integratedTerminal",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
"""Remove adoc from object handle
Revision ID: 714fa3c0323d
Revises: 53ec37ba68dd
Create Date: 2024-09-26 12:47:52.297367
"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "714fa3c0323d"
down_revision: Union[str, None] = "53ec37ba68dd"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index("ix_objecthandle_annotation_document_id", table_name="objecthandle")
op.drop_constraint(
"UC_only_one_object_handle_per_instance", "objecthandle", type_="unique"
)
op.create_unique_constraint(
"UC_only_one_object_handle_per_instance",
"objecthandle",
[
"user_id",
"project_id",
"code_id",
"current_code_id",
"source_document_id",
"span_annotation_id",
"span_group_id",
"document_tag_id",
"action_id",
"memo_id",
],
)
op.drop_index("idx_for_uc_work_with_null", table_name="objecthandle")
op.create_index(
"idx_for_uc_work_with_null",
"objecthandle",
[
sa.text("coalesce(user_id, 0)"),
sa.text("coalesce(project_id, 0)"),
sa.text("coalesce(code_id, 0)"),
sa.text("coalesce(current_code_id, 0)"),
sa.text("coalesce(source_document_id, 0)"),
sa.text("coalesce(span_annotation_id, 0)"),
sa.text("coalesce(bbox_annotation_id, 0)"),
sa.text("coalesce(span_group_id, 0)"),
sa.text("coalesce(document_tag_id, 0)"),
sa.text("coalesce(action_id, 0)"),
sa.text("coalesce(memo_id, 0)"),
],
unique=True,
)
op.drop_constraint(
"objecthandle_annotation_document_id_fkey", "objecthandle", type_="foreignkey"
)
op.drop_column("objecthandle", "annotation_document_id")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"objecthandle",
sa.Column(
"annotation_document_id", sa.INTEGER(), autoincrement=False, nullable=True
),
)
op.create_foreign_key(
"objecthandle_annotation_document_id_fkey",
"objecthandle",
"annotationdocument",
["annotation_document_id"],
["id"],
ondelete="CASCADE",
)
op.drop_index("idx_for_uc_work_with_null", table_name="objecthandle")
op.create_index(
"idx_for_uc_work_with_null",
"objecthandle",
[
sa.text("COALESCE(user_id, 0)"),
sa.text("COALESCE(project_id, 0)"),
sa.text("COALESCE(code_id, 0)"),
sa.text("COALESCE(current_code_id, 0)"),
sa.text("COALESCE(source_document_id, 0)"),
sa.text("COALESCE(annotation_document_id, 0)"),
sa.text("COALESCE(span_annotation_id, 0)"),
sa.text("COALESCE(bbox_annotation_id, 0)"),
sa.text("COALESCE(span_group_id, 0)"),
sa.text("COALESCE(document_tag_id, 0)"),
sa.text("COALESCE(action_id, 0)"),
sa.text("COALESCE(memo_id, 0)"),
],
unique=False,
)
op.drop_constraint(
"UC_only_one_object_handle_per_instance", "objecthandle", type_="unique"
)
op.create_unique_constraint(
"UC_only_one_object_handle_per_instance",
"objecthandle",
[
"user_id",
"project_id",
"code_id",
"current_code_id",
"source_document_id",
"annotation_document_id",
"span_annotation_id",
"span_group_id",
"document_tag_id",
"action_id",
"memo_id",
],
)
op.create_index(
"ix_objecthandle_annotation_document_id",
"objecthandle",
["annotation_document_id"],
unique=False,
)
# ### end Alembic commands ###
209 changes: 0 additions & 209 deletions backend/src/api/endpoints/annotation_document.py

This file was deleted.

2 changes: 1 addition & 1 deletion backend/src/api/endpoints/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ async def auth_content(
# returns None on purpose
token = request.cookies[AUTHORIZATION]
a = AuthzUser(request, get_current_user(db, token), db)
if not x_original_uri.startswith(CONTENT_PREFIX):
if x_original_uri is None or not x_original_uri.startswith(CONTENT_PREFIX):
return

index = x_original_uri.find("/", len(CONTENT_PREFIX))
Expand Down
Loading

0 comments on commit 7dfde14

Please sign in to comment.