File

src/policies/schemas/policy.schema.ts

Extends

OwnableClass

Index

Properties

Properties

_id
Type : string
Decorators :
@ApiProperty()
@Prop({type: String, default: () => })
archiveEmailNotification
Type : boolean
Decorators :
@ApiProperty({description: 'Flag is true when an email notification should be sent to archiveEmailsToBeNotified upon an archive job creation'})
@Prop({type: Boolean, default: false})
archiveEmailsToBeNotified
Type : string[]
Decorators :
@ApiProperty({description: 'Array of additional email addresses that should be notified up an archive job creation'})
@Prop({type: undefined})
autoArchive
Type : boolean
Decorators :
@ApiProperty({description: 'Flag to indicate that a dataset should be automatically archived after ingest. If false then archive delay is ignored'})
@Prop({type: Boolean, default: true})
autoArchiveDelay
Type : number
Decorators :
@ApiProperty({description: 'Number of days after dataset creation that (remaining) datasets are archived automatically'})
@Prop({type: Number, default: 7})
embargoPeriod
Type : number
Decorators :
@ApiProperty({description: 'Number of years after dataset creation before the dataset becomes public'})
@Prop({type: Number, default: 3})
manager
Type : string[]
Decorators :
@ApiProperty({description: 'Defines the emails of users that can modify the policy parameters'})
@Prop({type: undefined})
retrieveEmailNotification
Type : boolean
Decorators :
@ApiProperty({description: 'Flag is true when an email notification should be sent to retrieveEmailsToBeNotified upon a retrieval job creation'})
@Prop({type: Boolean, default: false})
retrieveEmailsToBeNotified
Type : string[]
Decorators :
@ApiProperty({description: 'Array of additional email addresses that should be notified up a retrieval job creation'})
@Prop({type: undefined})
tapeRedundancy
Type : string
Decorators :
@ApiProperty({description: 'Defines the level of redundancy in storage to minimize loss of data. Allowed values are low, medium, high. Low could e.g. mean one tape copy only, medium could mean two tape copies and high two geo-redundant tape copies'})
@Prop({type: String, default: 'low'})
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.'})
@Prop({type: undefined, index: true})
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.'})
@Prop({type: String, required: false})
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'})
@Prop({type: String, index: true})
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.'})
@Prop({type: Date})
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.'})
@Prop({type: String, index: true, required: true})
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.'})
@Prop({type: Date})
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.'})
@Prop({type: String, required: true})
Inherited from QueryableClass
Defined in QueryableClass:26
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose";
import { ApiProperty } from "@nestjs/swagger";
import { Document } from "mongoose";
import { OwnableClass } from "src/common/schemas/ownable.schema";
import { v4 as uuidv4 } from "uuid";

export type PolicyDocument = Policy & Document;

@Schema({
  collection: "Policy",
  toJSON: {
    getters: true,
  },
  timestamps: true,
})
export class Policy extends OwnableClass {
  @ApiProperty()
  @Prop({ type: String, default: () => uuidv4() })
  _id: string;

  @ApiProperty({
    description:
      "Defines the emails of users that can modify the policy parameters",
  })
  @Prop({ type: [String] })
  manager: string[];

  @ApiProperty({
    description:
      "Defines the level of redundancy in storage to minimize loss of data. Allowed values are low, medium, high. Low could e.g. mean one tape copy only, medium could mean two tape copies and high two geo-redundant tape copies",
  })
  @Prop({ type: String, default: "low" })
  tapeRedundancy: string;

  @ApiProperty({
    description:
      "Flag to indicate that a dataset should be automatically archived after ingest. If false then archive delay is ignored",
  })
  @Prop({ type: Boolean, default: true })
  autoArchive: boolean;

  @ApiProperty({
    description:
      "Number of days after dataset creation that (remaining) datasets are archived automatically",
  })
  @Prop({ type: Number, default: 7 })
  autoArchiveDelay: number;

  @ApiProperty({
    description:
      "Flag is true when an email notification should be sent to archiveEmailsToBeNotified upon an archive job creation",
  })
  @Prop({ type: Boolean, default: false })
  archiveEmailNotification: boolean;

  @ApiProperty({
    description:
      "Array of additional email addresses that should be notified up an archive job creation",
  })
  @Prop({ type: [String] })
  archiveEmailsToBeNotified: string[];

  @ApiProperty({
    description:
      "Flag is true when an email notification should be sent to retrieveEmailsToBeNotified upon a retrieval job creation",
  })
  @Prop({ type: Boolean, default: false })
  retrieveEmailNotification: boolean;

  @ApiProperty({
    description:
      "Array of additional email addresses that should be notified up a retrieval job creation",
  })
  @Prop({ type: [String] })
  retrieveEmailsToBeNotified: string[];

  @ApiProperty({
    description:
      "Number of years after dataset creation before the dataset becomes public",
  })
  @Prop({ type: Number, default: 3 })
  embargoPeriod: number;
}

export const PolicySchema = SchemaFactory.createForClass(Policy);

PolicySchema.index({ "$**": "text" });

results matching ""

    No results matching ""