File

src/proposals/schemas/proposal.schema.ts

Extends

OwnableClass

Index

Properties

Properties

_id
Type : string
Decorators :
@Prop({type: String})
Optional abstract
Type : string
Decorators :
@ApiProperty({type: String, required: false, description: 'The proposal abstract.'})
@Prop({type: String, required: false})
email
Type : string
Decorators :
@ApiProperty({type: String, required: true, description: 'Email of main proposer.'})
@Prop({type: String, required: true})
Optional endTime
Type : Date
Decorators :
@ApiProperty({type: Date, required: false, description: 'The date when data collection finishes.'})
@Prop({type: Date, required: false})
Optional firstname
Type : string
Decorators :
@ApiProperty({type: String, required: false, description: 'First name of main proposer.'})
@Prop({type: String, required: false})
Optional lastname
Type : string
Decorators :
@ApiProperty({type: String, required: false, description: 'Last name of main proposer.'})
@Prop({type: String, required: false})
Optional MeasurementPeriodList
Type : MeasurementPeriodClass[]
Decorators :
@ApiProperty({type: MeasurementPeriodClass, isArray: true, required: false, description: 'Embedded information used inside proposals to define which type of experiment has to be pursued, where (at which instrument) and when.'})
@Prop({type: undefined, required: false})
Optional pi_email
Type : string
Decorators :
@ApiProperty({type: String, required: false, description: 'Email of principal investigator.'})
@Prop({type: String, required: false, index: true})
Optional pi_firstname
Type : string
Decorators :
@ApiProperty({type: String, required: false, description: 'First name of principal investigator.'})
@Prop({type: String, required: false})
Optional pi_lastname
Type : string
Decorators :
@ApiProperty({type: String, required: false, description: 'Last name of principal investigator.'})
@Prop({type: String, required: false})
proposalId
Type : string
Decorators :
@ApiProperty({type: String, required: true, description: 'Globally unique identifier of a proposal, eg. PID-prefix/internal-proposal-number. PID prefix is auto prepended.'})
@Prop({type: String, unique: true, required: true})
Optional startTime
Type : Date
Decorators :
@ApiProperty({type: Date, required: false, description: 'The date when the data collection starts.'})
@Prop({type: Date, required: false})
title
Type : string
Decorators :
@ApiProperty({type: String, required: true, description: 'The title of the proposal.'})
@Prop({type: String, required: true})
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, getSchemaPath } from "@nestjs/swagger";
import { Document } from "mongoose";
import {
  Attachment,
  AttachmentSchema,
} from "src/attachments/schemas/attachment.schema";
import { OwnableClass } from "src/common/schemas/ownable.schema";
import {
  MeasurementPeriodClass,
  MeasurementPeriodSchema,
} from "./measurement-period.schema";

export type ProposalDocument = ProposalClass & Document;
@Schema({
  collection: "Proposal",
  toJSON: {
    getters: true,
  },
  timestamps: true,
})
export class ProposalClass extends OwnableClass {
  @ApiProperty({
    type: String,
    required: true,
    description:
      "Globally unique identifier of a proposal, eg. PID-prefix/internal-proposal-number. PID prefix is auto prepended.",
  })
  @Prop({
    type: String,
    unique: true,
    required: true,
  })
  proposalId: string;

  @Prop({
    type: String,
  })
  _id: string;

  @ApiProperty({
    type: String,
    required: false,
    description: "Email of principal investigator.",
  })
  @Prop({
    type: String,
    required: false,
    index: true,
  })
  pi_email?: string;

  @ApiProperty({
    type: String,
    required: false,
    description: "First name of principal investigator.",
  })
  @Prop({
    type: String,
    required: false,
  })
  pi_firstname?: string;

  @ApiProperty({
    type: String,
    required: false,
    description: "Last name of principal investigator.",
  })
  @Prop({
    type: String,
    required: false,
  })
  pi_lastname?: string;

  @ApiProperty({
    type: String,
    required: true,
    description: "Email of main proposer.",
  })
  @Prop({
    type: String,
    required: true,
  })
  email: string;

  @ApiProperty({
    type: String,
    required: false,
    description: "First name of main proposer.",
  })
  @Prop({
    type: String,
    required: false,
  })
  firstname?: string;

  @ApiProperty({
    type: String,
    required: false,
    description: "Last name of main proposer.",
  })
  @Prop({
    type: String,
    required: false,
  })
  lastname?: string;

  @ApiProperty({
    type: String,
    required: true,
    description: "The title of the proposal.",
  })
  @Prop({
    type: String,
    required: true,
  })
  title: string;

  @ApiProperty({
    type: String,
    required: false,
    description: "The proposal abstract.",
  })
  @Prop({
    type: String,
    required: false,
  })
  abstract?: string;

  @ApiProperty({
    type: Date,
    required: false,
    description: "The date when the data collection starts.",
  })
  @Prop({
    type: Date,
    required: false,
  })
  startTime?: Date;

  @ApiProperty({
    type: Date,
    required: false,
    description: "The date when data collection finishes.",
  })
  @Prop({
    type: Date,
    required: false,
  })
  endTime?: Date;

  @ApiProperty({
    type: MeasurementPeriodClass,
    isArray: true,
    required: false,
    description:
      "Embedded information used inside proposals to define which type of experiment has to be pursued, where (at which instrument) and when.",
  })
  @Prop({
    type: [MeasurementPeriodSchema],
    required: false,
  })
  MeasurementPeriodList?: MeasurementPeriodClass[];
}

export const ProposalSchema = SchemaFactory.createForClass(ProposalClass);

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

results matching ""

    No results matching ""