Advanced - examples at advanced demo app
DATOs/DTOs classes examples
- Standard object:
- Embedded (i.e. not refernced) objects:
- At DATO usage, definition.
- At input DTO usage, definition.
- At update DTO usage, definition.
- Virtual (calculated) objects: class UserInfo.
DATOs/DTOs properties examples
- Passing types (embedded class, enum...) to property decorator:
- Specify objects relation (applicable only at DATO, not in DTO):
Modules and services examples
Create custom mutations/queries examples
The 'nestjs-query-simple' package inherently supports standard CRUD operations. If you intend to include custom mutations or queries, refer to the 'demonstrateComplexQuery()' example method:
Override a default mutations/queries examples
If you wish to customize default mutations or queries, refer to the 'createOne()' method in the example here. A similar approach can be applied in the resolver as well.
Inject a service into another service examples
If you wish to access a service from another service (e.g. to handle some asspects of relations between MongoDB documents), refer to usage of TenantsService
within TenantBillingsService
(this done in order to maintain the one-to-one relation, between 'TenantBillingDato' and 'TenantDato', at the 'TenantDato' side):