refactor: import resource module to nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-01-13 10:15:57 +02:00
parent 270b421a6c
commit 72818759a5
38 changed files with 479 additions and 424 deletions

View File

@@ -3,8 +3,11 @@ import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectab
import { Inject, Injectable } from '@nestjs/common';
import * as R from 'ramda';
import { Customer } from '../models/Customer';
import { IFilterMeta, IPaginationMeta } from '@/interfaces/Model';
import { CustomerTransfromer } from './CustomerTransformer';
import {
GetCustomersResponse,
ICustomersFilter,
} from '../types/Customers.types';
@Injectable()
export class GetCustomers {
@@ -26,12 +29,11 @@ export class GetCustomers {
/**
* Retrieve customers paginated list.
* @param {ICustomersFilter} filter - Cusotmers filter.
* @returns {Promise<GetCustomersResponse>}
*/
public async getCustomersList(filterDTO: ICustomersFilter): Promise<{
customers: Customer[];
pagination: IPaginationMeta;
filterMeta: IFilterMeta;
}> {
public async getCustomersList(
filterDTO: ICustomersFilter,
): Promise<GetCustomersResponse> {
// Parses customers list filter DTO.
const filter = this.parseCustomersListFilterDTO(filterDTO);

View File

@@ -1,6 +1,8 @@
import { Knex } from 'knex';
import { Customer } from '../models/Customer';
import { IContactAddressDTO } from '@/modules/Contacts/types/Contacts.types';
import { IDynamicListFilter } from '@/modules/DynamicListing/DynamicFilter/DynamicFilter.types';
import { IFilterMeta, IPaginationMeta } from '@/interfaces/Model';
// Customer Interfaces.
// ----------------------------------
@@ -47,12 +49,17 @@ export interface ICustomerEditDTO extends IContactAddressDTO {
active?: boolean;
}
// export interface ICustomersFilter extends IDynamicListFilter {
// stringifiedFilterRoles?: string;
// page?: number;
// pageSize?: number;
// }
export interface ICustomersFilter extends IDynamicListFilter {
stringifiedFilterRoles?: string;
page?: number;
pageSize?: number;
}
export interface GetCustomersResponse {
customers: Customer[];
pagination: IPaginationMeta;
filterMeta: IFilterMeta;
}
// Customer Events.
// ----------------------------------
export interface ICustomerEventCreatedPayload {