rwadurian/backend/services/authorization-service/src/domain/value-objects/restriction-check-result.vo.ts

23 lines
502 B
TypeScript

export class RestrictionCheckResult {
private constructor(
public readonly allowed: boolean,
public readonly message: string | null,
) {}
static allowed(): RestrictionCheckResult {
return new RestrictionCheckResult(true, null)
}
static blocked(message: string): RestrictionCheckResult {
return new RestrictionCheckResult(false, message)
}
isAllowed(): boolean {
return this.allowed
}
isBlocked(): boolean {
return !this.allowed
}
}