it0/packages/services/referral-service/src/domain/entities/user-point-transaction.enti...

20 lines
870 B
TypeScript

export type PointTransactionType =
| 'REFERRAL_FIRST_PAYMENT' // first subscription payment by referred user
| 'REFERRAL_RECURRING' // recurring monthly reward (≤12 months)
| 'REFERRAL_L2' // level-2 indirect reward (≤6 months)
| 'REFERRAL_WELCOME' // welcome bonus to newly referred user
| 'REDEMPTION_QUOTA' // redeemed for extra usage quota
| 'REDEMPTION_UNLOCK' // redeemed to unlock a premium agent
| 'ADMIN_GRANT' // platform admin manual adjustment
| 'EXPIRY'; // points expiry deduction
export class UserPointTransaction {
id: string;
userId: string;
delta: number; // positive = earned, negative = spent
type: PointTransactionType;
refId: string | null; // user_referral_relationships.id or redemption id
note: string | null;
createdAt: Date;
}