Files
gridpilot.gg/core/rating/domain/events/RatingCalculatedEvent.ts
Marc Mintel 9ccecbf3bb
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m51s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
integration tests
2026-01-24 01:13:49 +01:00

30 lines
638 B
TypeScript

/**
* RatingCalculatedEvent
*
* Event published when a driver's rating is calculated.
*/
import { DomainEvent } from '../../../shared/ports/EventPublisher';
import { Rating } from '../Rating';
export class RatingCalculatedEvent implements DomainEvent {
readonly type = 'RatingCalculatedEvent';
readonly timestamp: Date;
constructor(private readonly rating: Rating) {
this.timestamp = new Date();
}
getRating(): Rating {
return this.rating;
}
toJSON(): Record<string, any> {
return {
type: this.type,
timestamp: this.timestamp.toISOString(),
rating: this.rating.toJSON(),
};
}
}