rwadurian/backend/services/reward-service/src/domain/value-objects/reward-source.vo.ts

26 lines
634 B
TypeScript

import { RightType } from './right-type.enum';
export class RewardSource {
private constructor(
public readonly rightType: RightType,
public readonly sourceOrderId: bigint,
public readonly sourceUserId: bigint,
) {}
static create(
rightType: RightType,
sourceOrderId: bigint,
sourceUserId: bigint,
): RewardSource {
return new RewardSource(rightType, sourceOrderId, sourceUserId);
}
equals(other: RewardSource): boolean {
return (
this.rightType === other.rightType &&
this.sourceOrderId === other.sourceOrderId &&
this.sourceUserId === other.sourceUserId
);
}
}