Skip to content
Suresh KUMAR Mukhiya edited this page Oct 7, 2020 · 2 revisions

Case Model

Schema(
  {
    name: {
      type: String,
      required: true,
    },
    description: {
      type: String,
    },
    status: {
      type: String,
      required: true,
      enum: ['ACTIVE', 'INACTIVE', 'DRAFT'],
    },
    featuredImage: [FileSchema],
    modules: [
      {
        type: Schema.Types.ObjectId,
        ref: 'module',
      },
    ],
    audience: {
      type: String,
      default: 'ALL',
      enum: ['ALL', 'USER'],
    },
    audienceList: [String],
    availableFrom: {
      type: String,
      required: true,
    },
    createdBy: {
      type: Schema.Types.ObjectId,
      ref: 'user',
    },
    updatedBy: {
      type: Schema.Types.ObjectId,
      ref: 'user',
    },
    importHash: { type: String },
  },
  { timestamps: true },
);

Note, timestamps automatically adds createdAt and updatedAt field.

Clone this wiki locally