Skip to content

Commit

Permalink
fixed output dataset dtos in swagger (#1487)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrosx authored Nov 7, 2024
1 parent 591fdf5 commit fc7a136
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/datasets/datasets.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 201,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
description: "Create a new dataset and return its representation in SciCat",
})
async create(
Expand Down Expand Up @@ -722,7 +722,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
isArray: true,
description: "Return the datasets requested",
})
Expand Down Expand Up @@ -817,7 +817,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
isArray: true,
description: "Return datasets requested",
})
Expand Down Expand Up @@ -897,7 +897,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: Object,
isArray: true,
description: "Return datasets requested",
})
Expand Down Expand Up @@ -978,7 +978,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: String,
isArray: true,
description: "Return metadata keys list of datasets selected",
})
Expand Down Expand Up @@ -1049,7 +1049,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
description: "Return the datasets requested",
})
async findOne(
Expand Down Expand Up @@ -1159,7 +1159,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
isArray: false,
description: "Return dataset with pid specified",
})
Expand Down Expand Up @@ -1214,7 +1214,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
description:
"Update an existing dataset and return its representation in SciCat",
})
Expand Down Expand Up @@ -1307,7 +1307,7 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
description:
"Update an existing dataset and return its representation in SciCat",
})
Expand Down Expand Up @@ -1434,15 +1434,15 @@ export class DatasetsController {
})
@ApiResponse({
status: 200,
type: DatasetClass,
type: OutputDatasetObsoleteDto,
description: "Return new value of the dataset",
})
async appendToArrayField(
@Req() request: Request,
@Param("pid") pid: string,
@Query("fieldName") fieldName: string,
@Query("data") data: string,
): Promise<DatasetClass | null> {
): Promise<OutputDatasetObsoleteDto | null> {
const user: JWTUser = request.user as JWTUser;
const ability = this.caslAbilityFactory.datasetInstanceAccess(user);
const datasetToUpdate = await this.datasetsService.findOne({
Expand Down Expand Up @@ -1473,7 +1473,12 @@ export class DatasetsController {
},
};

return this.datasetsService.findByIdAndUpdate(pid, updateQuery);
const outputDatasetDto = await this.datasetsService.findByIdAndUpdate(
pid,
updateQuery,
);

return await this.convertCurrentToObsoleteSchema(outputDatasetDto);
}

// GET /datasets/:id/thumbnail
Expand Down

0 comments on commit fc7a136

Please sign in to comment.