How to use the @tsed/mongoose.Ref function in @tsed/mongoose

To help you get started, we’ve selected a few @tsed/mongoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / examples / mongoose / src / models / events / CalendarEvent.ts View on Github external
import {Property, PropertyName, Required} from "@tsed/common";
import {Model, Ref} from "@tsed/mongoose";
import {Description} from "@tsed/swagger";
import {Calendar} from "../calendars/Calendar";

@Model()
export class CalendarEvent {
  @PropertyName("id")
  _id: string;

  @Ref(Calendar)
  @Description("Calendar ID")
  calendarId: Ref;

  @Property("name")
  @Description("The name of the event")
  name: string;

  @Property()
  @Description("Creation's date")
  dateCreate: Date = new Date();

  @Property()
  @Description("Last modification date")
  dateUpdate: Date = new Date();

  @Property()

@tsed/mongoose

Mongoose package for Ts.ED framework

MIT
Latest version published 3 days ago

Package Health Score

89 / 100
Full package analysis