inveniosoftware / invenio-records-resources

Records REST APIs for Invenio.
https://invenio-records-resources.readthedocs.io
MIT License
4 stars 48 forks source link

Service: Scan method not generating correct RecordList #260

Open jrcastro2 opened 3 years ago

jrcastro2 commented 3 years ago

Package version (if known): v0.16.1

Describe the bug

When executing a the scan function of the service we are supposed to receive a RecordList and by accessing hits, each element should be a RecordItem but instead it's only a dict.

Steps to Reproduce

  1. Go to the terminal.
  2. Access invenio shell by typing invenio shell.
  3. Test the scan, here an example:
    
    from invenio_rdm_records.proxies import current_rdm_records
    from invenio_access.permissions import system_identity

service = current_rdm_records.records_service records_list = service.scan(identity=system_identity)

for r in records_list.hits: print(r.class)


4. Note that it's a `dict` when it should be a [`RecordItem`](https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/services/records/results.py#L18).

## Expected behavior
Get [`RecordItem`](https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/services/records/results.py#L18) instead of a dict.

## Screenshots (if applicable)

## Additional context
ppanero commented 3 years ago

Similar behaviour here https://github.com/inveniosoftware/invenio-vocabularies/pull/52#discussion_r654491148 from the read_all function.