Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Controller

Modular Controller with CRUD methods using Firestore repository and DocumentData type.

Hierarchy

  • Controller

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • new Controller(collectionName: string): Controller
  • Parameters

    • collectionName: string

    Returns Controller

Properties

Private repository

Firebase repository used by CRUD methods.

Methods

create

  • create(req: Request, res: Response, next: NextFunction): DocumentData | undefined
  • Create a document in Firestore collection using the DocumentData received in the request body.

    Parameters

    • req: Request

      The request received by the API Rest

    • res: Response

      The response sent by the API Rest

    • next: NextFunction

      The next function executed in the app's middleware

    Returns DocumentData | undefined

delete

  • delete(req: Request, res: Response, next: NextFunction): DocumentData | undefined
  • Delete document by the given id

    Parameters

    • req: Request

      The request received by the API Rest

    • res: Response

      The response sent by the API Rest

    • next: NextFunction

      The next function executed in the app's middleware

    Returns DocumentData | undefined

readAll

  • readAll(req: Request, res: Response, next: NextFunction): DocumentData[] | undefined
  • Read all documents available in the Firestore collection.

    Parameters

    • req: Request

      The request received by the API Rest

    • res: Response

      The response sent by the API Rest

    • next: NextFunction

      The next function executed in the app's middleware

    Returns DocumentData[] | undefined

readOne

  • readOne(req: Request, res: Response, next: NextFunction): DocumentData | undefined
  • Read one document by the given id.

    Parameters

    • req: Request

      The request received by the API Rest

    • res: Response

      The response sent by the API Rest

    • next: NextFunction

      The next function executed in the app's middleware

    Returns DocumentData | undefined

update

  • update(req: Request, res: Response, next: NextFunction): DocumentData | undefined
  • Update document fields by the given id.

    Parameters

    • req: Request

      The request received by the API Rest

    • res: Response

      The response sent by the API Rest

    • next: NextFunction

      The next function executed in the app's middleware

    Returns DocumentData | undefined

Generated using TypeDoc