controllers/chords

Chords Controller file Contains an object with each controller related to the Chord model
Description:
  • Chords Controller file Contains an object with each controller related to the Chord model
Source:

Requires

Methods

(async, static) filter(req, res, next) → {void}

Description:
  • Filters chords based on query parameters. This function validates query parameters, builds a dynamic filter object for the database query, handles pagination, and returns the result in a paginated response.
Source:
Parameters:
Name Type Description
req Object The request object containing query parameters.
res Object The response object to send the filtered result.
next function The next middleware to pass control in case of an error.
Throws:
Throws an error if invalid query parameters are provided or if there is an issue with the database.
Type
Error
Returns:
Type
void

(async, static) getById(req, res, next) → {void}

Description:
  • Retrieves a chord by its ID. This function validates the path parameter `id`, and if valid, fetches the chord from the database and returns it as a JSON response.
Source:
Parameters:
Name Type Description
req Object The request object containing the chord ID as a path parameter.
res Object The response object to send the chord data.
next function The next middleware to pass control in case of an error.
Throws:
Throws an error if the chord ID is invalid or if there is an issue with the database.
Type
Error
Returns:
Type
void