docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
A minimal HTTP module that enforces MongoDB ObjectId validation and parsing on incoming request data using the dependency's built-in pipes.
/customers/:customerId responds with status 200 and JSON { "id": "<customerId>" } when the path segment is a valid ObjectId string; it responds with status 400 when the segment is not a valid ObjectId format. @test/customers/:customerId/orders/:orderId uses the dependency's ObjectId-parsing pipe to convert both path segments before invoking the service, returning status 200 with { "deleted": true, "customer": "<ObjectId>", "order": "<ObjectId>" } when both are valid and 400 when either is invalid. @test/customers accepts the referrerId query parameter as optional: when omitted it returns status 200 with { "referrerId": null }; when provided as a valid ObjectId string it echoes that value; when provided but invalid it responds with status 400. @testexport class CustomersController {
constructor(service: CustomersService);
/**
* Returns the validated customer id string.
*/
getCustomer(customerId: string): Promise<{ id: string }>;
/**
* Parses and forwards ObjectIds for deletion.
*/
deleteOrder(
customerId: import('mongoose').Types.ObjectId,
orderId: import('mongoose').Types.ObjectId,
): Promise<{ deleted: true; customer: import('mongoose').Types.ObjectId; order: import('mongoose').Types.ObjectId }>;
/**
* Returns the optional referrer id string or null when absent.
*/
listCustomers(referrerId: string | null): Promise<{ referrerId: string | null }>;
}
export class CustomersService {
deleteOrder(
customerId: import('mongoose').Types.ObjectId,
orderId: import('mongoose').Types.ObjectId,
): Promise<{ deleted: true; customer: import('mongoose').Types.ObjectId; order: import('mongoose').Types.ObjectId }>;
}Provides built-in pipes for validating or parsing MongoDB ObjectId inputs in the NestJS request lifecycle.