File

apps/api/src/users/user.schema.ts

Description

User Schema Class

Index

Properties

Properties

email
Type : string
Decorators :
@Prop()

Email column

gravatar
Type : string
Decorators :
@Prop()

Gravatar column (gravatar url)

name
Type : string
Decorators :
@Prop()

Name column

password
Type : string
Decorators :
@Prop()

Password column

roles
Type : UserRolesEnum[]
Decorators :
@Prop(['String'])

Column to represent a one to many relationship with the roles entity

username
Type : string
Decorators :
@Prop()

Username column

import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { UserRolesEnum } from '@starter/api-types';
import { Document } from 'mongoose';

export type UserDocument = User & Document;

/**
 * User Schema Class
 */
@Schema()
export class User {
  /**
   * Username column
   */
  @Prop()
  username: string;

  /**
   * Name column
   */
  @Prop()
  name: string;

  /**
   * Email column
   */
  @Prop()
  email: string;

  /**
   * Gravatar column (gravatar url)
   */
  @Prop()
  gravatar: string;

  /**
   * Column to represent a one to many relationship with the roles entity
   */
  @Prop([String])
  roles: UserRolesEnum[];

  /**
   * Password column
   */
  @Prop()
  password: string;
}

export const UserSchema = SchemaFactory.createForClass(User);

results matching ""

    No results matching ""