All files / db/entities users.entity.ts

100% Statements 13/13
100% Branches 0/0
100% Functions 0/0
100% Lines 12/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 878x 8x 8x               8x                   8x       8x               8x             8x             8x                 8x                       8x               8x                      
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { ModelOptions, Severity, prop } from '@typegoose/typegoose'
import { Exclude, Expose } from 'class-transformer'
import { ObjectId } from 'mongoose'
import { CheckoutInformation } from '../../payments/interfaces/payments'
 
/**
 * @description Entity with all user information
 */
@ModelOptions({ schemaOptions: { timestamps: true } })
export class User {
  _id: ObjectId
  updatedAt: Date
 
  @Expose({ groups: ['self'] })
  @prop({ required: true, unique: true })
  @ApiProperty({
    description: 'Email of the user. Only exposed to self',
    example: '[email protected]',
  })
  email: string
 
  @Exclude()
  @prop({ required: true })
  password: string
 
  @Expose({ groups: ['self'] })
  @prop()
  @ApiPropertyOptional({
    description: 'Last login for the user. Only exposed to self',
    example: Date.now(),
  })
  lastLogin: Date | null
 
  @Expose()
  @ApiPropertyOptional({
    description: 'Creation date of user',
    example: new Date(),
  })
  createdAt: Date
 
  @Expose()
  @prop({ required: true, default: false })
  @ApiProperty({
    description: 'Has the users mail been verified?',
  })
  hasVerifiedEmail: boolean
 
  @Expose()
  @prop({ required: true, default: 'free' })
  @ApiPropertyOptional({
    description: 'Payment plan of the user',
    example: 'free',
    enum: ['free', 'single', 'family'],
  })
  paymentPlan: string
 
  @Expose()
  @prop({
    required: true,
    default: { status: 'free', lastInformationTime: 0 },
    allowMixed: Severity.ALLOW,
  })
  @ApiPropertyOptional({
    description: 'Checkout status',
    example: { status: 'free', lastInformationTime: 0 },
  })
  checkoutInformation: CheckoutInformation
 
  @Expose()
  @prop({ required: false })
  @ApiPropertyOptional({
    description: 'Stripe customer id',
    example: 'cus_...',
  })
  stripeCustomerId: string
  /*
 
  _koooHELLOoobbbiii
  kkDIDuCheckThisbiii
  kkooTellUsoobbbiii
  koobii
  _kobi
 
  */
}