Skip to content

Commit

Permalink
feat(GP-13): patch overwrite hashes, swagger doc
Browse files Browse the repository at this point in the history
  • Loading branch information
khan08 committed Feb 27, 2019
1 parent 535bc76 commit cb68992
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
12 changes: 10 additions & 2 deletions indexd/index/drivers/alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,16 @@ def update(self, did, rev, changing_fields):
for m_key, m_value in changing_fields['metadata'].items()]

if 'hashes' in changing_fields:
for k, v in iteritems(changing_fields['hashes']):
session.merge(IndexRecordHash(hash_type=k, hash_value=v, did=record.did))
for hash in record.hashes:
session.delete(hash)

record.hashes = [
IndexRecordHash(
did=record.did,
hash_type=hash_type,
hash_value=hash_value
)
for hash_type, hash_value in changing_fields['hashes'].items()]

if 'urls_metadata' in changing_fields:
for url in record.urls:
Expand Down
4 changes: 3 additions & 1 deletion indexd/index/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"type": ["string", "null"],
},
"size": {
"type": "integer",
"description": "Size of the data being indexed in bytes",
"type": "integer",
"minimum": 0
},
"version": {
"type": ["string", "null"],
Expand Down
6 changes: 6 additions & 0 deletions openapis/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -984,8 +984,14 @@ definitions:
UpdateInputInfo:
type: object
properties:
hashes:
$ref: '#/definitions/HashInfo'
file_name:
type: string
size:
type: integer
format: int64
description: size in bytes
metadata:
type: object
urls_metadata:
Expand Down

0 comments on commit cb68992

Please sign in to comment.