Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
loki-sinclair-hdruk committed Dec 12, 2023
1 parent ce4b634 commit e76bf9b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
2 changes: 1 addition & 1 deletion files/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "Sample description here",
"type": "dataset",
"persistentId": "e96e36ba-30ca-4c25-bc55-fab02d72a51c",
"self": "https://fair.preview.aridhia.io/api/datasets/e96e36ba-30ca-4c25-bc55-fab02d72a51c",
"self": "http://example-url.com/api/datasets/e96e36ba-30ca-4c25-bc55-fab02d72a51c",
"version": "0.0.0",
"issued": "2023-02-13T14:10:31.640Z",
"modified": "2023-09-04T10:53:01.239Z",
Expand Down
2 changes: 1 addition & 1 deletion src/api/v1/controllers/dataset.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class DatasetController extends BaseController {

return res
.status(200)
.json({ query: { q: q || '', total: datasetTotal, limit: limitInt, offset: offsetInt }, items: datasets });
.json(datasets);
} catch (err) {
this._logger.sendDataInLogging({ data: err.name }, 'ERROR');
this._logger.sendDataInLogging({ data: (<Error>err).message }, 'ERROR');
Expand Down
28 changes: 1 addition & 27 deletions src/api/v1/services/dataset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,7 @@ export default class DatasetService {

const file = fs.readFileSync("./files/list.json", 'utf-8');
const parsedJSON = JSON.parse(file);
const datasetData = {
persistentId : parsedJSON.identifier,
"@schema" : parsedJSON["@schema"],
version : parsedJSON.version,
issued : parsedJSON.issued,
modified : parsedJSON.modified,
name : parsedJSON.summary.title,
description : parsedJSON.summary.abstract,
type : "dataset",
source : parsedJSON.summary.publisher.name,
self : "http://example-url.com/api/datasets/" + parsedJSON.identifier
}

datasets.push(datasetData);

// Check the offset is valid
if (offset < datasets.length)
{
datasets = datasets.slice(offset);
}

if (!isNaN(limit) && limit > 0)
{
datasets = datasets.slice(0, limit);
}

return datasets;
return parsedJSON;
}

public async getDataset(pid: string) {
Expand Down

0 comments on commit e76bf9b

Please sign in to comment.