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:
@@ -1,7 +1,8 @@
|
||||
import { ListingStatus, TransactionType } from '@prisma/client';
|
||||
import { type ListingStatus, type TransactionType } from '@prisma/client';
|
||||
import { AggregateRoot, ValidationException } from '@modules/shared';
|
||||
import { ListingApprovedEvent } from '../events/listing-approved.event';
|
||||
import { ListingCreatedEvent } from '../events/listing-created.event';
|
||||
import { ListingPriceChangedEvent } from '../events/listing-price-changed.event';
|
||||
import { ListingSoldEvent } from '../events/listing-sold.event';
|
||||
import { ListingStatusChangedEvent } from '../events/listing-status-changed.event';
|
||||
import { ListingUpdatedEvent } from '../events/listing-updated.event';
|
||||
@@ -208,6 +209,7 @@ export class ListingEntity extends AggregateRoot<string> {
|
||||
const updatedFields: string[] = [];
|
||||
|
||||
if (fields.priceVND !== undefined) {
|
||||
const oldPriceValue = this._price.amountVND;
|
||||
const priceResult = Price.create(fields.priceVND);
|
||||
if (priceResult.isErr) {
|
||||
throw new ValidationException(priceResult.unwrapErr(), { field: 'priceVND' });
|
||||
@@ -216,6 +218,9 @@ export class ListingEntity extends AggregateRoot<string> {
|
||||
if (fields.areaM2 !== undefined) {
|
||||
this._pricePerM2 = this._price.calculatePerM2(fields.areaM2);
|
||||
}
|
||||
if (oldPriceValue !== fields.priceVND) {
|
||||
this.addDomainEvent(new ListingPriceChangedEvent(this.id, oldPriceValue, fields.priceVND));
|
||||
}
|
||||
updatedFields.push('priceVND');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PropertyType, Direction } from '@prisma/client';
|
||||
import { type PropertyType, type Direction } from '@prisma/client';
|
||||
import { AggregateRoot } from '@modules/shared';
|
||||
import { Address } from '../value-objects/address.vo';
|
||||
import { GeoPoint } from '../value-objects/geo-point.vo';
|
||||
import { type Address } from '../value-objects/address.vo';
|
||||
import { type GeoPoint } from '../value-objects/geo-point.vo';
|
||||
|
||||
export interface PropertyProps {
|
||||
propertyType: PropertyType;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export { ListingCreatedEvent } from './listing-created.event';
|
||||
export { ListingApprovedEvent } from './listing-approved.event';
|
||||
export { ListingPriceChangedEvent } from './listing-price-changed.event';
|
||||
export { ListingSoldEvent } from './listing-sold.event';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DomainEvent } from '@modules/shared';
|
||||
import { type DomainEvent } from '@modules/shared';
|
||||
|
||||
export class ListingApprovedEvent implements DomainEvent {
|
||||
readonly eventName = 'listing.approved';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TransactionType } from '@prisma/client';
|
||||
import { DomainEvent } from '@modules/shared';
|
||||
import { type TransactionType } from '@prisma/client';
|
||||
import { type DomainEvent } from '@modules/shared';
|
||||
|
||||
export class ListingCreatedEvent implements DomainEvent {
|
||||
readonly eventName = 'listing.created';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ListingStatus } from '@prisma/client';
|
||||
import { DomainEvent } from '@modules/shared';
|
||||
import { type ListingStatus } from '@prisma/client';
|
||||
import { type DomainEvent } from '@modules/shared';
|
||||
|
||||
export class ListingSoldEvent implements DomainEvent {
|
||||
readonly eventName = 'listing.sold';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ListingStatus } from '@prisma/client';
|
||||
import { DomainEvent } from '@modules/shared';
|
||||
import { type ListingStatus } from '@prisma/client';
|
||||
import { type DomainEvent } from '@modules/shared';
|
||||
|
||||
export class ListingStatusChangedEvent implements DomainEvent {
|
||||
readonly eventName = 'listing.status_changed';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ListingStatus, TransactionType, PropertyType, Direction } from '@prisma/client';
|
||||
import { type ListingStatus, type TransactionType, type PropertyType, type Direction } from '@prisma/client';
|
||||
|
||||
/** Returned by findByIdWithProperty — full listing detail with property, seller, agent */
|
||||
export interface ListingDetailData {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ListingStatus, TransactionType, PropertyType } from '@prisma/client';
|
||||
import { ListingEntity } from '../entities/listing.entity';
|
||||
import { ListingDetailData, ListingSearchItem, ListingSellerItem } from './listing-read.dto';
|
||||
import { type ListingStatus, type TransactionType, type PropertyType } from '@prisma/client';
|
||||
import { type ListingEntity } from '../entities/listing.entity';
|
||||
import { type ListingDetailData, type ListingSearchItem, type ListingSellerItem } from './listing-read.dto';
|
||||
|
||||
export const LISTING_REPOSITORY = Symbol('LISTING_REPOSITORY');
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PropertyMediaEntity } from '../entities/property-media.entity';
|
||||
import { PropertyEntity } from '../entities/property.entity';
|
||||
import { type PropertyMediaEntity } from '../entities/property-media.entity';
|
||||
import { type PropertyEntity } from '../entities/property.entity';
|
||||
|
||||
export const PROPERTY_REPOSITORY = Symbol('PROPERTY_REPOSITORY');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PropertyType } from '@prisma/client';
|
||||
import { type PropertyType } from '@prisma/client';
|
||||
|
||||
export const DUPLICATE_DETECTOR = Symbol('DUPLICATE_DETECTOR');
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ListingStatus } from '@prisma/client';
|
||||
import { ListingEntity } from '../entities/listing.entity';
|
||||
import { type ListingStatus } from '@prisma/client';
|
||||
import { type ListingEntity } from '../entities/listing.entity';
|
||||
|
||||
export interface ModerationAction {
|
||||
action: 'approve' | 'reject';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PropertyType } from '@prisma/client';
|
||||
import { type PropertyType } from '@prisma/client';
|
||||
|
||||
export const PRICE_VALIDATOR = Symbol('PRICE_VALIDATOR');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user