src/datablocks/schemas/datablock.schema.ts
Properties |
| _id |
Type : string
|
Decorators :
@ApiProperty({type: String, default: () => })
|
| archiveId |
Type : string
|
Decorators :
@ApiProperty({type: String, required: true, description: 'Unique identifier given by the archive system to the stored datablock. This id is used when data is retrieved back.'})
|
| chkAlg |
Type : string
|
Decorators :
@ApiProperty({type: String, required: false, description: 'Algorithm used for calculation of file checksums. Should be lowercase, e.g., sha2 or blake2b.'})
|
| dataFileList |
Type : DataFile[]
|
Decorators :
@ApiProperty({type: 'array', items: undefined, required: true, description: 'Embedded schema definition for each file.'})
|
| datasetId |
Type : string
|
Decorators :
@ApiProperty({type: String, required: true, description: 'PID of the dataset to which the datablock belongs.'})
|
| packedSize |
Type : number
|
Decorators :
@ApiProperty({type: Number, required: true, description: 'Total size in bytes of all files in the datablock when on archived.'})
|
| size |
Type : number
|
Decorators :
@ApiProperty({type: Number, required: true, description: 'Total size in bytes of all files in the datablock when on accessible.'})
|
| version |
Type : string
|
Decorators :
@ApiProperty({type: String, required: true, description: 'Version string defining the format of how data is packed and stored in archive.'})
|
| accessGroups |
Type : string[]
|
Default value : []
|
Decorators :
@ApiProperty({type: undefined, description: 'Optional additional groups which have read access to the data. Users which are members in one of the groups listed here are allowed to access this data. The special group 'public' makes data available to all users.'})
|
|
Inherited from
OwnableClass
|
|
Defined in
OwnableClass:26
|
| Optional instrumentGroup |
Type : string
|
Decorators :
@ApiProperty({type: String, required: false, description: 'Optional additional groups which have read and write access to the data. Users which are members in one of the groups listed here are allowed to access this data.'})
|
|
Inherited from
OwnableClass
|
|
Defined in
OwnableClass:38
|
| ownerGroup |
Type : string
|
Decorators :
@ApiProperty({type: String, description: 'Defines the group which owns the data, and therefore has unrestricted access to this data. Usually a pgroup like p12151'})
|
|
Inherited from
OwnableClass
|
|
Defined in
OwnableClass:15
|
| createdAt |
Type : Date
|
Decorators :
@ApiProperty({type: Date, description: 'Date and time when this record was created. This property is added and maintained by mongoose.'})
|
|
Inherited from
QueryableClass
|
|
Defined in
QueryableClass:40
|
|
NOTE: createdAt and updatedAt properties are handled automatically by mongoose when timestamps flag is set to true on a schema(https://mongoosejs.com/docs/guide.html#timestamps). We still need to keep the fields available here because of the response model and swagger documentation. They are not required so we don't need to provide them manually on create/update. |
| createdBy |
Type : string
|
Decorators :
@ApiProperty({type: String, description: 'Indicate the user who created this record. This property is added and maintained by the system.'})
|
|
Inherited from
QueryableClass
|
|
Defined in
QueryableClass:15
|
| updatedAt |
Type : Date
|
Decorators :
@ApiProperty({type: Date, description: 'Date and time when this record was updated last. This property is added and maintained by mongoose.'})
|
|
Inherited from
QueryableClass
|
|
Defined in
QueryableClass:50
|
| updatedBy |
Type : string
|
Decorators :
@ApiProperty({type: String, description: 'Indicate the user who updated this record last. This property is added and maintained by the system.'})
|
|
Inherited from
QueryableClass
|
|
Defined in
QueryableClass:26
|
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { ApiProperty, getSchemaPath } from "@nestjs/swagger";
import { DataFile, DataFileSchema } from "src/common/schemas/datafile.schema";
import { OwnableClass } from "src/common/schemas/ownable.schema";
import { v4 as uuidv4 } from "uuid";
export type DatablockDocument = Datablock & Document;
@Schema({
collection: "Datablock",
toJSON: {
getters: true,
},
timestamps: true,
})
export class Datablock extends OwnableClass {
@ApiProperty({
type: String,
default: () => uuidv4(),
})
@Prop({
type: String,
required: true,
default: () => uuidv4(),
})
_id: string;
@ApiProperty({
type: String,
required: true,
description: "PID of the dataset to which the datablock belongs.",
})
@Prop({ type: String, ref: "Dataset", required: true })
datasetId: string;
@ApiProperty({
type: String,
required: true,
description:
"Unique identifier given by the archive system to the stored datablock. This id is used when data is retrieved back.",
})
@Prop({
type: String,
required: true,
unique: true,
sparse: true,
})
archiveId: string;
@ApiProperty({
type: Number,
required: true,
description:
"Total size in bytes of all files in the datablock when on accessible.",
})
@Prop({
type: Number,
required: true,
})
size: number;
@ApiProperty({
type: Number,
required: true,
description:
"Total size in bytes of all files in the datablock when on archived.",
})
@Prop({
type: Number,
required: true,
})
packedSize: number;
@ApiProperty({
type: String,
required: false,
description:
"Algorithm used for calculation of file checksums. Should be lowercase, e.g., sha2 or blake2b.",
})
@Prop({
type: String,
required: false,
})
chkAlg: string;
@ApiProperty({
type: String,
required: true,
description:
"Version string defining the format of how data is packed and stored in archive.",
})
@Prop({
type: String,
required: true,
})
version: string;
@ApiProperty({
type: "array",
items: { $ref: getSchemaPath(DataFile) },
required: true,
description: "Embedded schema definition for each file.",
})
@Prop({
type: [DataFileSchema],
required: true,
})
dataFileList: DataFile[];
}
export const DatablockSchema = SchemaFactory.createForClass(Datablock);