Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UsersRepository

The user repository

Hierarchy

Index

Constructors

constructor

Properties

collectionName

collectionName: string

The collection name, used also as controller route name

Protected model

model: Model<IUser>

The mongoose model for this repository

Protected userModel

userModel: Model<IUser>

Methods

create

  • create(item: User): Promise<IUser>

delete

  • delete(id: string): Promise<boolean>

find

findOne

get

  • get(id: string): Promise<IUser>

getByRoles

  • getByRoles(roles: RoleType | Array<RoleType>): Promise<IUser[]>

login

  • login(email: string, password: string): Promise<IUser>
  • Return the user if the email and password are matching, null otherwise

    Parameters

    • email: string

      The user email

    • password: string

      The user password

    Returns Promise<IUser>

partialUpdate

  • partialUpdate(id: string, item: Partial<User>): Promise<IUser>

register

  • register(user: User): Promise<IUser>

update

  • update(item: User): Promise<IUser>

updateOwn

  • updateOwn(user: User): Promise<IUser>

Generated using TypeDoc