NestJS module that provides seamless integration between NestJS and Mongoose ODM for MongoDB database operations
80
Pending
Does it follow best practices?
Impact
80%
1.02xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
Use dependency injection to persist orders and audit entries through injected database models and connections instead of constructing them manually.
{ customerId: "c-1", totalCents: 2500 }, recordOrder stores the order via the injected order model and writes an audit entry referencing the saved order id via the audit model; it returns both persisted records. @testrecordOrder is invoked with { customerId: "c-2", totalCents: 5000, useTransaction: true } and the audit write fails, both order and audit writes are rolled back using a session from the injected connection. @testfetchAuditHistory(orderId) returns audit entries for that order, sorted most recent first, using the injected audit model tied to the named connection. @test@generates
export interface OrderPayload {
customerId: string;
totalCents: number;
useTransaction?: boolean;
}
export interface OrderRecord {
id: string;
customerId: string;
totalCents: number;
createdAt: Date;
}
export interface AuditEntry {
id: string;
orderId: string;
action: 'created';
at: Date;
}
export class OrderAnalyticsService {
constructor(/* injected models and a database connection */);
recordOrder(order: OrderPayload): Promise<{ order: OrderRecord; audit: AuditEntry }>;
fetchAuditHistory(orderId: string): Promise<AuditEntry[]>;
}Provides framework-level integration for injecting database models and connections in NestJS providers. @satisfied-by
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10