Skip to content

Commit

Permalink
Merge pull request #353 from uc-cdis/bug/PXP-6421-Revert-description
Browse files Browse the repository at this point in the history
bug(PXP-6421): Reverting description changes for DRS
  • Loading branch information
k-burt-uch committed Mar 17, 2023
2 parents f09ede1 + 78164d7 commit 899654a
Show file tree
Hide file tree
Showing 21 changed files with 635 additions and 825 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,3 @@ docs/_build/
local_settings.py
settings.yaml
*.sq3

# IDE
.idea

# pyenv
.python-version
33 changes: 12 additions & 21 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@
"line_number": 104
}
],
"indexd/utils.py": [
{
"type": "Basic Auth Credentials",
"filename": "indexd/utils.py",
"hashed_secret": "5d0fa74acf95d1d6bebd0d37f76a94e77d604fd9",
"is_verified": false,
"line_number": 87
}
],
"tests/test_aliases_endpoints.py": [
{
"type": "Hex High Entropy String",
Expand Down Expand Up @@ -168,77 +159,77 @@
"filename": "tests/test_client.py",
"hashed_secret": "5666c088b494f26cd8f63ace013992f5fc391ce0",
"is_verified": false,
"line_number": 23
"line_number": 19
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "15a6d8daad1278efcaadc0d6e3d1dd2d9ebbc262",
"is_verified": false,
"line_number": 1090
"line_number": 1084
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "1b0d1a618b5c213dd792bbc3aa96ffa6bc370ef3",
"is_verified": false,
"line_number": 1306
"line_number": 1300
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "1170ace44158ff189902ff44597efef121623353",
"is_verified": false,
"line_number": 1737
"line_number": 1731
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "ff9c79b737b3ea7386618cc9437d3fb0a772182b",
"is_verified": false,
"line_number": 2414
"line_number": 2406
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "c8176f1e75e62e15dabaa4087fb7194451c8f6d2",
"is_verified": false,
"line_number": 2417
"line_number": 2409
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "d5198f8eddb1cbeb437899cd99e5ee97ab8531b4",
"is_verified": false,
"line_number": 2417
"line_number": 2409
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "02dc196562514eaa3e2feac1f441ccf6ad81e09d",
"is_verified": false,
"line_number": 2421
"line_number": 2413
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "f1cb2d91a95165a2ab909eadd9f7b65f312c7e2d",
"is_verified": false,
"line_number": 2422
"line_number": 2414
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "58db546de03270b55a4c889a5c5e6296b29fef25",
"is_verified": false,
"line_number": 2423
"line_number": 2415
},
{
"type": "Hex High Entropy String",
"filename": "tests/test_client.py",
"hashed_secret": "b6c0bd08fde409c18760f32bef8705191840c402",
"is_verified": false,
"line_number": 2424
"line_number": 2416
}
],
"tests/test_deprecated_aliases_endpoints.py": [
Expand Down Expand Up @@ -269,5 +260,5 @@
}
]
},
"generated_at": "2023-03-09T21:25:06Z"
"generated_at": "2023-03-17T18:42:05Z"
}
1 change: 0 additions & 1 deletion bin/index_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def main(path, action=None, username=None, password=None):


if __name__ == "__main__":

parser = argparse.ArgumentParser()

parser.add_argument(
Expand Down
1 change: 0 additions & 1 deletion indexd/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def get_record(record):


def dist_get_record(record):

# Sort the list of distributed ID services
# Ones with which the request matches a hint will be first
# Followed by those that don't match the hint
Expand Down
6 changes: 5 additions & 1 deletion indexd/drs/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def indexd_to_drs(record, expand=False):

form = record["form"] if "form" in record else "bundle"

description = record["description"] if "description" in record else ""
description = record["description"] if "description" in record else None

alias = (
record["alias"]
Expand All @@ -141,6 +141,7 @@ def indexd_to_drs(record, expand=False):

drs_object = {
"id": did,
"description": "",
"mime_type": "application/json",
"name": name,
"created_time": created_time,
Expand All @@ -154,6 +155,9 @@ def indexd_to_drs(record, expand=False):
"description": description,
}

if "description" in record:
drs_object["description"] = record["description"]

if "bundle_data" in record:
drs_object["contents"] = []
for bundle in record["bundle_data"]:
Expand Down
8 changes: 2 additions & 6 deletions indexd/index/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from indexd import auth

from indexd.errors import AuthError, AuthzError, IndexdUnexpectedError
from indexd.errors import AuthError, AuthzError
from indexd.errors import UserError

from .schema import PUT_RECORD_SCHEMA
Expand Down Expand Up @@ -243,7 +243,7 @@ def get_urls():

# NOTE: /index/<record>/deeper-route methods are above /index/<record> so that routing
# prefers these first. Without this ordering, newer versions of the web framework
# were interpreting index/e383a3aa-316e-4a51-975d-d699eff41bd2/aliases/ as routing
# were interpretting index/e383a3aa-316e-4a51-975d-d699eff41bd2/aliases/ as routing
# to /index/<record> where <record> was "e383a3aa-316e-4a51-975d-d699eff41bd2/aliases/"


Expand Down Expand Up @@ -407,7 +407,6 @@ def post_index_record():
version = flask.request.json.get("version")
baseid = flask.request.json.get("baseid")
uploader = flask.request.json.get("uploader")
description = flask.request.json.get("description")

did, rev, baseid = blueprint.index_driver.add(
form,
Expand All @@ -423,7 +422,6 @@ def post_index_record():
hashes=hashes,
baseid=baseid,
uploader=uploader,
description=description,
)

ret = {"did": did, "rev": rev, "baseid": baseid}
Expand Down Expand Up @@ -555,7 +553,6 @@ def add_index_record_version(record):
metadata = flask.request.json.get("metadata")
urls_metadata = flask.request.json.get("urls_metadata")
version = flask.request.json.get("version")
description = flask.request.json.get("description")

# authorize done in add_version for both the old and new authz
did, baseid, rev = blueprint.index_driver.add_version(
Expand All @@ -571,7 +568,6 @@ def add_index_record_version(record):
urls_metadata=urls_metadata,
version=version,
hashes=hashes,
description=description,
)

ret = {"did": did, "baseid": baseid, "rev": rev}
Expand Down
8 changes: 0 additions & 8 deletions indexd/index/drivers/alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class IndexRecord(Base):
file_name = Column(String, index=True)
version = Column(String, index=True)
uploader = Column(String, index=True)
description = Column(String)

urls = relationship(
"IndexRecordUrl", backref="index_record", cascade="all, delete-orphan"
Expand Down Expand Up @@ -136,7 +135,6 @@ def to_document_dict(self):
"form": self.form,
"created_date": created_date,
"updated_date": updated_date,
"description": self.description,
}


Expand Down Expand Up @@ -684,7 +682,6 @@ def add(
hashes=None,
baseid=None,
uploader=None,
description=None,
):
"""
Creates a new record given size, urls, acl, authz, hashes, metadata,
Expand Down Expand Up @@ -744,9 +741,6 @@ def add(
IndexRecordMetadata(did=record.did, key=m_key, value=m_value)
for m_key, m_value in metadata.items()
]

record.description = description

session.merge(base_version)

try:
Expand Down Expand Up @@ -1273,7 +1267,6 @@ def add_version(
acl=None,
authz=None,
hashes=None,
description=None,
):
"""
Add a record version given did
Expand Down Expand Up @@ -1312,7 +1305,6 @@ def add_version(
record.size = size
record.file_name = file_name
record.version = version
record.description = description

record.urls = [IndexRecordUrl(did=record.did, url=url) for url in urls]

Expand Down
2 changes: 0 additions & 2 deletions indexd/index/drivers/query/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def query_urls(
fields="did,urls",
**kwargs
):

if kwargs:
raise UserError(
"Unexpected query parameter(s) {}".format(list(kwargs.keys()))
Expand Down Expand Up @@ -102,7 +101,6 @@ def query_metadata_by_key(
fields="did,urls,rev",
**kwargs
):

if kwargs:
raise UserError(
"Unexpected query parameter(s) {}".format(list(kwargs.keys()))
Expand Down
5 changes: 0 additions & 5 deletions indexd/index/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
"description": "optional version string of the object",
"type": "string",
},
"description": {
"description": "optional description string of the object",
"type": "string",
},
"uploader": {
"description": "optional uploader of the object",
"type": "string",
Expand Down Expand Up @@ -86,7 +82,6 @@
"uploader": {"type": ["string", "null"]},
"metadata": {"type": "object"},
"urls_metadata": {"type": "object"},
"description": {"type": ["string", "null"]},
},
}

Expand Down
1 change: 0 additions & 1 deletion indexd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def hint_match(record, hints):
def try_drop_test_data(
user, database, root_user="postgres", host=""
): # pragma: no cover

engine = create_engine(
"postgres://{user}@{host}/postgres".format(user=root_user, host=host)
)
Expand Down
8 changes: 1 addition & 7 deletions openapis/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1449,8 +1449,6 @@ definitions:
type: object
version:
type: string
description:
type: string
urls:
type: array
items:
Expand Down Expand Up @@ -2352,11 +2350,7 @@ definitions:
type: array
items:
$ref: '#/definitions/Checksum'
description:
type: string
version:
type: string
description: optional version string of the object

bundles:
type: array
items:
Expand Down
Loading

0 comments on commit 899654a

Please sign in to comment.