Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
92bde05
Adding 'external link' Class to old and current "output dataset" API.
GBirkel Jul 24, 2025
806533d
Merge branch 'SciCatProject:master' into templated-external-links-v2
GBirkel Aug 4, 2025
1baa254
Test version of virtual (derived) value for external links.
GBirkel Aug 7, 2025
ddeceeb
Applying some test templates, in a draft data structure
GBirkel Aug 13, 2025
1cd8986
Adding a config json file and section for link templates.
GBirkel Aug 14, 2025
58e1b48
Moving the virtual field creation up to the module so we can get acce…
GBirkel Aug 14, 2025
a419d1d
Minor commentary and cleanup.
GBirkel Aug 14, 2025
e0a77ca
Merge branch 'refs/heads/master' into templated-external-links-v2
GBirkel Aug 14, 2025
fa3d6f3
Too much nesting. :D
GBirkel Aug 15, 2025
d1d1544
Lint.
GBirkel Aug 15, 2025
9afc970
Sorry linter, we actually need this for the anonymous filter/map func…
GBirkel Aug 15, 2025
42fee6a
Mentioning datasetExternalLinkTemplates.json in the development instr…
GBirkel Aug 18, 2025
023bfd7
Just a bit of code cleanup.
GBirkel Aug 28, 2025
9183bcf
Adding v3 and v4 endpoints for /:pid/externallinks , calling a common…
GBirkel Aug 28, 2025
ce6e498
Removing the injected virtual field code for dataset links.
GBirkel Aug 28, 2025
ea96c52
The list of external links is no longer returned as a field in the da…
GBirkel Aug 28, 2025
b04c6fa
Merge branch 'refs/heads/master' into templated-external-links-v2
GBirkel Sep 3, 2025
c570748
This is no longer true. :D
GBirkel Sep 3, 2025
b76cce2
OutputAttachmentV3Dto is not a schema (it has no Mongo representation…
GBirkel Sep 3, 2025
0e8304e
Merge branch 'refs/heads/master' into templated-external-links-v2
GBirkel Sep 4, 2025
bf27ced
Merge branch 'refs/heads/master' into templated-external-links-v2
GBirkel Sep 8, 2025
c650365
Lint
GBirkel Sep 8, 2025
12d5e25
Upgrading dependency to latest release to test SDK generation
GBirkel Sep 8, 2025
846ff80
Removing imports that are no longer used.
GBirkel Sep 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/datasets/dto/output-dataset-obsolete.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
IsObject,
IsOptional,
IsString,
ValidateNested,
} from "class-validator";
import { ApiProperty, getSchemaPath } from "@nestjs/swagger";
import { UpdateDatasetObsoleteDto } from "./update-dataset-obsolete.dto";
Expand All @@ -13,6 +14,7 @@ import { OrigDatablock } from "src/origdatablocks/schemas/origdatablock.schema";
import { Datablock } from "src/datablocks/schemas/datablock.schema";
import { DatasetType } from "../types/dataset-type.enum";
import { OutputAttachmentV3Dto } from "src/attachments/dto-obsolete/output-attachment.v3.dto";
import { ExternalLinkClass } from "../schemas/externallink.class";

export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
@ApiProperty({
Expand Down Expand Up @@ -200,6 +202,18 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
@Type(() => Datablock)
datablocks?: Datablock[];

@ApiProperty({
type: [ExternalLinkClass],
required: false,
default: [],
description: "List of external links that involve this data set.",
})
@IsArray()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ExternalLinkClass)
readonly externalLinks?: ExternalLinkClass[];

@ApiProperty({
type: String,
required: true,
Expand Down
24 changes: 22 additions & 2 deletions src/datasets/dto/output-dataset.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { ApiProperty, PartialType } from "@nestjs/swagger";
import { ApiProperty, getSchemaPath, PartialType } from "@nestjs/swagger";

Check warning on line 1 in src/datasets/dto/output-dataset.dto.ts

View workflow job for this annotation

GitHub Actions / eslint

'getSchemaPath' is defined but never used
import { CreateDatasetDto } from "./create-dataset.dto";
import { IsDateString, IsString } from "class-validator";
import { Type } from "class-transformer";
import {
IsArray,
IsDateString,
IsOptional,
IsString,
ValidateNested,
} from "class-validator";
import { ExternalLinkClass } from "../schemas/externallink.class";

export class OutputDatasetDto extends CreateDatasetDto {
@ApiProperty({
Expand Down Expand Up @@ -47,6 +55,18 @@
@IsDateString()
updatedAt: Date;

@ApiProperty({
type: [ExternalLinkClass],
required: false,
default: [],
description: "List of external links that involve this data set.",
})
@IsArray()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => ExternalLinkClass)
readonly externalLinks?: ExternalLinkClass[];

@ApiProperty({
type: String,
required: true,
Expand Down
26 changes: 25 additions & 1 deletion src/datasets/schemas/dataset.schema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { Prop, Virtual, Schema, SchemaFactory } from "@nestjs/mongoose";
import { ApiProperty, getSchemaPath } from "@nestjs/swagger";
import { Document } from "mongoose";
import { OwnableClass } from "src/common/schemas/ownable.schema";
import { v4 as uuidv4 } from "uuid";
import { ExternalLinkClass } from "./externallink.class";
import { HistoryClass, HistorySchema } from "./history.schema";
import { LifecycleClass, LifecycleSchema } from "./lifecycle.schema";
import { RelationshipClass, RelationshipSchema } from "./relationship.schema";
Expand All @@ -14,8 +15,12 @@
collection: "Dataset",
minimize: false,
timestamps: true,
toObject: {
virtuals: true,
},
toJSON: {
getters: true,
virtuals: true,
},
})
export class DatasetClass extends OwnableClass {
Expand Down Expand Up @@ -265,6 +270,25 @@
@Prop({ type: String, required: true })
version: string;

@ApiProperty({
type: [ExternalLinkClass],
required: false,
default: [],
description: "List of external links that involve this data set.",
})
@Virtual({
get: function (this: ExternalLinkClass[]) {
//`${this.firstName} ${this.lastName}`;
return [
{ url: "test_url",

Check failure on line 283 in src/datasets/schemas/dataset.schema.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `⏎·········`
title: "test_title",
description: "test_description"

Check failure on line 285 in src/datasets/schemas/dataset.schema.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `,`
}

Check failure on line 286 in src/datasets/schemas/dataset.schema.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `,`
];
},
})
externalLinks?: ExternalLinkClass[];

@ApiProperty({
type: "array",
items: { $ref: getSchemaPath(HistoryClass) },
Expand Down
31 changes: 31 additions & 0 deletions src/datasets/schemas/externallink.class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ApiProperty } from "@nestjs/swagger";
import { IsString } from "class-validator";

// This data is not represented in Mongoose.
// It is generated internally based on the user-defined link templates.
Comment thread
GBirkel marked this conversation as resolved.
Outdated

export class ExternalLinkClass {
@ApiProperty({
type: String,
required: true,
description: "URL of the external link.",
})
@IsString()
readonly url: string;

@ApiProperty({
type: String,
required: true,
description: "Text to display representing the external link.",
})
@IsString()
readonly title: string;

@ApiProperty({
type: String,
required: false,
description: "Description of the link destination.",
})
@IsString()
readonly description?: string;
}
Loading