ProtectedactionsThe base actions used by the class.
ProtectedcachesAn array of cache objects used to store data temporarily. Each cache object is expected to hold an array of elements, with the specific type of the elements being flexible (any[]). This variable can be utilized as a mechanism to manage and retrieve stored data efficiently.
ProtecteddefaultThe default duration for cache lifetime.
Handles the creation of a new resource by processing the request, sanitizing input and output data, and responding with the created resource.
The HTTP request containing the data to create the resource.
The HTTP response used to send the result back to the client.
This method does not return a value, it sends a response to the client.
Deletes a resource identified by the provided ID.
The HTTP request object, containing the resource ID to delete.
The HTTP response object, used to send back the deletion result.
No value is returned, the response object is used to communicate the result.
Retrieves all data based on the provided request, processes it, and sends the appropriate response.
The incoming request object containing the necessary parameters and context.
The response object used to send back the processed data or error information.
This method does not return anything directly, but responds to the client with the processed data or an error.
Retrieves a record by its identifier from the database, sanitizes the data, and sends the response back to the client. Throws an exception if the record is not found or an error occurs during the process.
The HTTP request object, used to extract the record ID.
The HTTP response object, used to send back the result or error message.
Does not return a value, as it sends the response directly to the client.
Loads data using the provided loader function and generates a cache with a checksum. Utilizes request-specific parameters to identify caching needs, validate cache validity, and update the cache if necessary.
The incoming request object containing path, parameters, body, and headers.
A function to load data that will populate the cache.
OptionalonUpdates the resource with the provided data and responds with the updated result.
The request object containing the data to update the resource.
The response object used to send the result or error to the client.
This method does not return a value; it sends a response back to the client.
StaticgetRetrieves and parses the "id" parameter from the given request object.
The request object containing parameters.
OptionalshouldThrow: boolean = trueDetermines whether an exception should be thrown if the "id" parameter is missing.
The parsed integer value of the "id" parameter if present, or null if not present and shouldThrow is false.
StaticgetStaticget{Express.Request}
{ParamDefinition}
Abstract class that provides a base implementation for managing data operations such as loading, caching, retrieving, updating, creating, and deleting resources. The
DataControlleris designed to interact with a specified interface for managing data and provides methods for handling common resource-related operations.This class is designed to be extended by specific implementations for various data types.