Skip to content

DataFileList format in Origdatablock files request #2702

@abdellah257

Description

@abdellah257

Summary

The request GET /origdatablocks/fullquery/files return dataFileList object as a JSON dict and not an array.
This results in an inconsistent result with OutputOrigDatablockDTO.

Current Behaviour

{
	"_id": "1b2XXX",
	"createdBy": "",
	"updatedBy": "",
	"ownerGroup": "",
	"accessGroups": [],
	"isPublished": false,
	"datasetId": "DS-XX",
	"size": 0,
	"chkAlg": "blake2d",
	"dataFileList": {
		"path": "XX.nxs",
		"size": 0,
		"time": "",
		"chk": "XX",
		"_id": "69eXXXX"
	},
	"createdAt": "",
	"updatedAt": "",
	"__v": 0,
	"datasetExist": true
}

Expected Behaviour

{
        ....
	"dataFileList": [
               {
		   "path": "XX.nxs",
		   "size": 0,
		   "time": "",
		   "chk": "XX",
		   "_id": "69eXXXX"
	      },
         ],
}

Details

While the request is expected to return an OrigDatablock with only a single datafile in the dataFileList, it seems more adequate to maintain the dataFileList array format.

This useful to have more consistent schema at the frontend side instead of using just an object[] type .
see FileState

Also there is a risque of { $unwind: "$dataFileList" } at return multiple dataFileList objects like:

{ dataFileList: A }
{ dataFileList: B }
{ dataFileList: C }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions