fix(lint): enforce consistent-type-imports and fix import ordering across codebase

Auto-fix 862 lint errors: convert value imports used only as types to
`import type`, fix import group ordering in seed.ts and du-an-api.ts,
remove unused imports in auth controller, and clean up stale eslint-disable
comments referencing non-existent rules.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-16 05:13:56 +07:00
parent 86adcf7295
commit c920934fb6
296 changed files with 692 additions and 659 deletions

View File

@@ -12,7 +12,7 @@ function createPendingBankTransferPayment(id = 'pay-bt-1'): PaymentEntity {
return payment;
}
function createCompletedBankTransferPayment(): PaymentEntity {
function _createCompletedBankTransferPayment(): PaymentEntity {
const money = Money.create(1_000_000n).unwrap();
const payment = PaymentEntity.createNew('pay-bt-done', 'user-1', 'BANK_TRANSFER', 'SUBSCRIPTION', money);
payment.markProcessing('BT-pay-bt-done');

View File

@@ -1,7 +1,7 @@
import { HttpStatus, Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode, LoggerService } from '@modules/shared';
import { ORDER_REPOSITORY, IOrderRepository } from '../../../domain/repositories/order.repository';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode, type LoggerService } from '@modules/shared';
import { ORDER_REPOSITORY, type IOrderRepository } from '../../../domain/repositories/order.repository';
import { CancelOrderCommand } from './cancel-order.command';
export interface CancelOrderResult {

View File

@@ -1,11 +1,11 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { createId } from '@paralleldrive/cuid2';
import { ConflictException, DomainException, ValidationException, LoggerService } from '@modules/shared';
import { ConflictException, DomainException, ValidationException, type LoggerService } from '@modules/shared';
import { EscrowEntity } from '../../../domain/entities/escrow.entity';
import { OrderEntity } from '../../../domain/entities/order.entity';
import { ESCROW_REPOSITORY, IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, IOrderRepository } from '../../../domain/repositories/order.repository';
import { ESCROW_REPOSITORY, type IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, type IOrderRepository } from '../../../domain/repositories/order.repository';
import { Money } from '../../../domain/value-objects/money.vo';
import { PlatformFee } from '../../../domain/value-objects/platform-fee.vo';
import { CreateOrderCommand } from './create-order.command';

View File

@@ -1,4 +1,4 @@
import { PaymentProvider, PaymentType } from '@prisma/client';
import { type PaymentProvider, type PaymentType } from '@prisma/client';
export class CreatePaymentCommand {
constructor(

View File

@@ -1,16 +1,16 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { createId } from '@paralleldrive/cuid2';
import { ConflictException, DomainException, ValidationException, LoggerService } from '@modules/shared';
import { ConflictException, DomainException, ValidationException, type LoggerService } from '@modules/shared';
import { PaymentEntity } from '../../../domain/entities/payment.entity';
import {
PAYMENT_REPOSITORY,
IPaymentRepository,
type IPaymentRepository,
} from '../../../domain/repositories/payment.repository';
import { Money } from '../../../domain/value-objects/money.vo';
import {
PAYMENT_GATEWAY_FACTORY,
IPaymentGatewayFactory,
type IPaymentGatewayFactory,
} from '../../../infrastructure/services/payment-gateway.interface';
import { CreatePaymentCommand } from './create-payment.command';

View File

@@ -1,4 +1,4 @@
import { PaymentProvider } from '@prisma/client';
import { type PaymentProvider } from '@prisma/client';
export class HandleCallbackCommand {
constructor(

View File

@@ -1,8 +1,8 @@
import { HttpStatus, Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode, LoggerService } from '@modules/shared';
import { ESCROW_REPOSITORY, IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, IOrderRepository } from '../../../domain/repositories/order.repository';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode, type LoggerService } from '@modules/shared';
import { ESCROW_REPOSITORY, type IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, type IOrderRepository } from '../../../domain/repositories/order.repository';
import { HoldEscrowCommand } from './hold-escrow.command';
export interface HoldEscrowResult {

View File

@@ -1,13 +1,13 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, NotFoundException, ValidationException, LoggerService } from '@modules/shared';
import { CommandHandler, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, NotFoundException, ValidationException, type LoggerService } from '@modules/shared';
import {
PAYMENT_REPOSITORY,
IPaymentRepository,
type IPaymentRepository,
} from '../../../domain/repositories/payment.repository';
import {
PAYMENT_GATEWAY_FACTORY,
IPaymentGatewayFactory,
type IPaymentGatewayFactory,
} from '../../../infrastructure/services/payment-gateway.interface';
import { RefundPaymentCommand } from './refund-payment.command';

View File

@@ -1,8 +1,8 @@
import { HttpStatus, Inject, InternalServerErrorException } from '@nestjs/common';
import { CommandHandler, EventBus, ICommandHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode, LoggerService } from '@modules/shared';
import { ESCROW_REPOSITORY, IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, IOrderRepository } from '../../../domain/repositories/order.repository';
import { CommandHandler, type EventBus, type ICommandHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode, type LoggerService } from '@modules/shared';
import { ESCROW_REPOSITORY, type IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, type IOrderRepository } from '../../../domain/repositories/order.repository';
import { ReleaseEscrowCommand } from './release-escrow.command';
export interface ReleaseEscrowResult {

View File

@@ -1,8 +1,8 @@
import { HttpStatus, Inject } from '@nestjs/common';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, ErrorCode } from '@modules/shared';
import { ESCROW_REPOSITORY, IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, IOrderRepository } from '../../../domain/repositories/order.repository';
import { ESCROW_REPOSITORY, type IEscrowRepository } from '../../../domain/repositories/escrow.repository';
import { ORDER_REPOSITORY, type IOrderRepository } from '../../../domain/repositories/order.repository';
import { GetOrderStatusQuery } from './get-order-status.query';
export interface OrderStatusDto {

View File

@@ -1,9 +1,9 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, ForbiddenException, LoggerService, NotFoundException } from '@modules/shared';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, ForbiddenException, type LoggerService, NotFoundException } from '@modules/shared';
import {
PAYMENT_REPOSITORY,
IPaymentRepository,
type IPaymentRepository,
} from '../../../domain/repositories/payment.repository';
import { GetPaymentStatusQuery } from './get-payment-status.query';

View File

@@ -1,9 +1,9 @@
import { Inject, InternalServerErrorException } from '@nestjs/common';
import { IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, LoggerService } from '@modules/shared';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { DomainException, type LoggerService } from '@modules/shared';
import {
PAYMENT_REPOSITORY,
IPaymentRepository,
type IPaymentRepository,
} from '../../../domain/repositories/payment.repository';
import { ListTransactionsQuery } from './list-transactions.query';

View File

@@ -1,4 +1,4 @@
import { PaymentStatus } from '@prisma/client';
import { type PaymentStatus } from '@prisma/client';
export class ListTransactionsQuery {
constructor(

View File

@@ -1,10 +1,10 @@
import { HttpStatus } from '@nestjs/common';
import { EscrowStatus } from '@prisma/client';
import { type EscrowStatus } from '@prisma/client';
import { AggregateRoot, DomainException, ErrorCode, Result } from '@modules/shared';
import { EscrowDisputedEvent } from '../events/escrow-disputed.event';
import { EscrowHeldEvent } from '../events/escrow-held.event';
import { EscrowReleasedEvent } from '../events/escrow-released.event';
import { Money } from '../value-objects/money.vo';
import { type Money } from '../value-objects/money.vo';
export interface EscrowProps {
orderId: string;

View File

@@ -1,11 +1,11 @@
import { HttpStatus } from '@nestjs/common';
import { OrderStatus } from '@prisma/client';
import { type OrderStatus } from '@prisma/client';
import { AggregateRoot, DomainException, ErrorCode, Result } from '@modules/shared';
import { OrderCancelledEvent } from '../events/order-cancelled.event';
import { OrderCreatedEvent } from '../events/order-created.event';
import { OrderPaidEvent } from '../events/order-paid.event';
import { Money } from '../value-objects/money.vo';
import { PlatformFee } from '../value-objects/platform-fee.vo';
import { type Money } from '../value-objects/money.vo';
import { type PlatformFee } from '../value-objects/platform-fee.vo';
export interface OrderProps {
buyerId: string;

View File

@@ -9,7 +9,7 @@ import { PaymentCompletedEvent } from '../events/payment-completed.event';
import { PaymentCreatedEvent } from '../events/payment-created.event';
import { PaymentFailedEvent } from '../events/payment-failed.event';
import { PaymentRefundedEvent } from '../events/payment-refunded.event';
import { Money } from '../value-objects/money.vo';
import { type Money } from '../value-objects/money.vo';
export interface PaymentProps {
userId: string;

View File

@@ -1,4 +1,4 @@
import { DomainEvent } from '@modules/shared';
import { type DomainEvent } from '@modules/shared';
export class EscrowDisputedEvent implements DomainEvent {
readonly eventName = 'escrow.disputed';

View File

@@ -1,4 +1,4 @@
import { DomainEvent } from '@modules/shared';
import { type DomainEvent } from '@modules/shared';
export class EscrowHeldEvent implements DomainEvent {
readonly eventName = 'escrow.held';

View File

@@ -1,4 +1,4 @@
import { DomainEvent } from '@modules/shared';
import { type DomainEvent } from '@modules/shared';
export class EscrowReleasedEvent implements DomainEvent {
readonly eventName = 'escrow.released';

View File

@@ -1,4 +1,4 @@
import { DomainEvent } from '@modules/shared';
import { type DomainEvent } from '@modules/shared';
export class OrderCancelledEvent implements DomainEvent {
readonly eventName = 'order.cancelled';

View File

@@ -1,4 +1,4 @@
import { DomainEvent } from '@modules/shared';
import { type DomainEvent } from '@modules/shared';
export class OrderCreatedEvent implements DomainEvent {
readonly eventName = 'order.created';

View File

@@ -1,4 +1,4 @@
import { DomainEvent } from '@modules/shared';
import { type DomainEvent } from '@modules/shared';
export class OrderPaidEvent implements DomainEvent {
readonly eventName = 'order.paid';

View File

@@ -1,5 +1,5 @@
import { PaymentProvider } from '@prisma/client';
import { DomainEvent } from '@modules/shared';
import { type PaymentProvider } from '@prisma/client';
import { type DomainEvent } from '@modules/shared';
export class PaymentCompletedEvent implements DomainEvent {
readonly eventName = 'payment.completed';

View File

@@ -1,5 +1,5 @@
import { PaymentProvider, PaymentType } from '@prisma/client';
import { DomainEvent } from '@modules/shared';
import { type PaymentProvider, type PaymentType } from '@prisma/client';
import { type DomainEvent } from '@modules/shared';
export class PaymentCreatedEvent implements DomainEvent {
readonly eventName = 'payment.created';

View File

@@ -1,5 +1,5 @@
import { PaymentProvider } from '@prisma/client';
import { DomainEvent } from '@modules/shared';
import { type PaymentProvider } from '@prisma/client';
import { type DomainEvent } from '@modules/shared';
export class PaymentFailedEvent implements DomainEvent {
readonly eventName = 'payment.failed';

View File

@@ -1,5 +1,5 @@
import { PaymentProvider } from '@prisma/client';
import { DomainEvent } from '@modules/shared';
import { type PaymentProvider } from '@prisma/client';
import { type DomainEvent } from '@modules/shared';
export class PaymentRefundedEvent implements DomainEvent {
readonly eventName = 'payment.refunded';

View File

@@ -1,4 +1,4 @@
import { EscrowEntity } from '../entities/escrow.entity';
import { type EscrowEntity } from '../entities/escrow.entity';
export const ESCROW_REPOSITORY = Symbol('ESCROW_REPOSITORY');

View File

@@ -1,5 +1,5 @@
import { OrderStatus } from '@prisma/client';
import { OrderEntity } from '../entities/order.entity';
import { type OrderStatus } from '@prisma/client';
import { type OrderEntity } from '../entities/order.entity';
export const ORDER_REPOSITORY = Symbol('ORDER_REPOSITORY');

View File

@@ -1,5 +1,5 @@
import { PaymentStatus } from '@prisma/client';
import { PaymentEntity } from '../entities/payment.entity';
import { type PaymentStatus } from '@prisma/client';
import { type PaymentEntity } from '../entities/payment.entity';
export const PAYMENT_REPOSITORY = Symbol('PAYMENT_REPOSITORY');

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common';
import { Escrow as PrismaEscrow } from '@prisma/client';
import { PrismaService } from '@modules/shared';
import { EscrowEntity, EscrowProps } from '../../domain/entities/escrow.entity';
import { IEscrowRepository } from '../../domain/repositories/escrow.repository';
import { type Escrow as PrismaEscrow } from '@prisma/client';
import { type PrismaService } from '@modules/shared';
import { EscrowEntity, type EscrowProps } from '../../domain/entities/escrow.entity';
import { type IEscrowRepository } from '../../domain/repositories/escrow.repository';
import { Money } from '../../domain/value-objects/money.vo';
@Injectable()

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common';
import { Prisma, Order as PrismaOrder, OrderStatus } from '@prisma/client';
import { PrismaService } from '@modules/shared';
import { OrderEntity, OrderProps } from '../../domain/entities/order.entity';
import { IOrderRepository } from '../../domain/repositories/order.repository';
import { type Prisma, type Order as PrismaOrder, type OrderStatus } from '@prisma/client';
import { type PrismaService } from '@modules/shared';
import { OrderEntity, type OrderProps } from '../../domain/entities/order.entity';
import { type IOrderRepository } from '../../domain/repositories/order.repository';
import { Money } from '../../domain/value-objects/money.vo';
import { PlatformFee } from '../../domain/value-objects/platform-fee.vo';

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common';
import { Prisma, Payment as PrismaPayment, PaymentStatus } from '@prisma/client';
import { PrismaService } from '@modules/shared';
import { PaymentEntity, PaymentProps } from '../../domain/entities/payment.entity';
import { IPaymentRepository } from '../../domain/repositories/payment.repository';
import { Prisma, type Payment as PrismaPayment, type PaymentStatus } from '@prisma/client';
import { type PrismaService } from '@modules/shared';
import { PaymentEntity, type PaymentProps } from '../../domain/entities/payment.entity';
import { type IPaymentRepository } from '../../domain/repositories/payment.repository';
import { Money } from '../../domain/value-objects/money.vo';
@Injectable()

View File

@@ -1,8 +1,8 @@
import * as crypto from 'crypto';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PaymentProvider } from '@prisma/client';
import { LoggerService } from '@modules/shared';
import { type ConfigService } from '@nestjs/config';
import { type PaymentProvider } from '@prisma/client';
import { type LoggerService } from '@modules/shared';
import {
type IPaymentGateway,
type CreatePaymentUrlParams,

View File

@@ -1,8 +1,8 @@
import * as crypto from 'crypto';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PaymentProvider } from '@prisma/client';
import { LoggerService } from '@modules/shared';
import { type ConfigService } from '@nestjs/config';
import { type PaymentProvider } from '@prisma/client';
import { type LoggerService } from '@modules/shared';
import {
type IPaymentGateway,
type CreatePaymentUrlParams,

View File

@@ -1,4 +1,4 @@
import { PaymentProvider } from '@prisma/client';
import { type PaymentProvider } from '@prisma/client';
export const PAYMENT_GATEWAY_FACTORY = Symbol('PAYMENT_GATEWAY_FACTORY');

View File

@@ -1,8 +1,8 @@
import * as crypto from 'crypto';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PaymentProvider } from '@prisma/client';
import { LoggerService } from '@modules/shared';
import { type ConfigService } from '@nestjs/config';
import { type PaymentProvider } from '@prisma/client';
import { type LoggerService } from '@modules/shared';
import {
type IPaymentGateway,
type CreatePaymentUrlParams,

View File

@@ -1,8 +1,8 @@
import * as crypto from 'crypto';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PaymentProvider } from '@prisma/client';
import { LoggerService } from '@modules/shared';
import { type ConfigService } from '@nestjs/config';
import { type PaymentProvider } from '@prisma/client';
import { type LoggerService } from '@modules/shared';
import {
type IPaymentGateway,
type CreatePaymentUrlParams,