- Remove `type` keyword from NestJS injectable class imports across all modules to fix runtime DI resolution (330+ handler/listener files) - Offset CI docker-compose ports (5433/6380/8109/9002) to avoid conflicts with running dev containers - Update .env.test, playwright.config.ts, and e2e workflow to use isolated CI ports with configurable overrides - Fix prisma/seed.ts to use deterministic IDs for Prisma 7 upsert compatibility (phoneHash replaced phone as unique index) - Add dedicated Docker bridge network for CI service containers Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { AggregateRoot } from '@modules/shared';
|
|
import { QualityScoreUpdatedEvent } from '../events/quality-score-updated.event';
|
|
import { QualityScore } from '../value-objects/quality-score.vo';
|
|
|
|
export interface AgentProps {
|
|
userId: string;
|
|
licenseNumber: string | null;
|
|
agency: string | null;
|
|
qualityScore: QualityScore;
|
|
totalDeals: number;
|
|
responseTimeAvg: number | null;
|
|
bio: string | null;
|
|
serviceAreas: string[];
|
|
isVerified: boolean;
|
|
}
|
|
|
|
export class AgentEntity extends AggregateRoot<string> {
|
|
private _userId: string;
|
|
private _licenseNumber: string | null;
|
|
private _agency: string | null;
|
|
private _qualityScore: QualityScore;
|
|
private _totalDeals: number;
|
|
private _responseTimeAvg: number | null;
|
|
private _bio: string | null;
|
|
private _serviceAreas: string[];
|
|
private _isVerified: boolean;
|
|
|
|
constructor(id: string, props: AgentProps, createdAt?: Date, updatedAt?: Date) {
|
|
super(id, createdAt);
|
|
if (updatedAt) this.updatedAt = updatedAt;
|
|
this._userId = props.userId;
|
|
this._licenseNumber = props.licenseNumber;
|
|
this._agency = props.agency;
|
|
this._qualityScore = props.qualityScore;
|
|
this._totalDeals = props.totalDeals;
|
|
this._responseTimeAvg = props.responseTimeAvg;
|
|
this._bio = props.bio;
|
|
this._serviceAreas = props.serviceAreas;
|
|
this._isVerified = props.isVerified;
|
|
}
|
|
|
|
get userId(): string { return this._userId; }
|
|
get licenseNumber(): string | null { return this._licenseNumber; }
|
|
get agency(): string | null { return this._agency; }
|
|
get qualityScore(): QualityScore { return this._qualityScore; }
|
|
get totalDeals(): number { return this._totalDeals; }
|
|
get responseTimeAvg(): number | null { return this._responseTimeAvg; }
|
|
get bio(): string | null { return this._bio; }
|
|
get serviceAreas(): string[] { return this._serviceAreas; }
|
|
get isVerified(): boolean { return this._isVerified; }
|
|
|
|
updateQualityScore(newScore: QualityScore): void {
|
|
const oldScore = this._qualityScore.value;
|
|
this._qualityScore = newScore;
|
|
this.updatedAt = new Date();
|
|
|
|
this.addDomainEvent(
|
|
new QualityScoreUpdatedEvent(this.id, oldScore, newScore.value),
|
|
);
|
|
}
|
|
}
|