(
organization: OrganizationWithDetails,
options: DisplayOptions = {},
)
| 22 | } |
| 23 | |
| 24 | export function displayOrganizationDetails( |
| 25 | organization: OrganizationWithDetails, |
| 26 | options: DisplayOptions = {}, |
| 27 | ) { |
| 28 | console.log(`\n${'='.repeat(80)}`); |
| 29 | console.log(chalk.bold.yellow(`\n📊 ORGANIZATION: ${organization.name}`)); |
| 30 | console.log(`${'='.repeat(80)}\n`); |
| 31 | |
| 32 | // Organization Details |
| 33 | console.log(chalk.bold('Organization Details:')); |
| 34 | console.log(` ${chalk.gray('ID:')} ${organization.id}`); |
| 35 | console.log(` ${chalk.gray('Name:')} ${organization.name}`); |
| 36 | console.log( |
| 37 | ` ${chalk.gray('Created:')} ${organization.createdAt.toISOString()}`, |
| 38 | ); |
| 39 | console.log(` ${chalk.gray('Timezone:')} ${organization.timezone || 'UTC'}`); |
| 40 | |
| 41 | // Subscription info |
| 42 | if (organization.subscriptionStatus) { |
| 43 | console.log( |
| 44 | ` ${chalk.gray('Subscription Status:')} ${getSubscriptionStatusColor(organization.subscriptionStatus)}`, |
| 45 | ); |
| 46 | if (organization.subscriptionPriceId) { |
| 47 | console.log( |
| 48 | ` ${chalk.gray('Price ID:')} ${organization.subscriptionPriceId}`, |
| 49 | ); |
| 50 | } |
| 51 | if (organization.subscriptionPeriodEventsLimit) { |
| 52 | const usage = `${organization.subscriptionPeriodEventsCount}/${organization.subscriptionPeriodEventsLimit}`; |
| 53 | const percentage = |
| 54 | (organization.subscriptionPeriodEventsCount / |
| 55 | organization.subscriptionPeriodEventsLimit) * |
| 56 | 100; |
| 57 | const color = |
| 58 | percentage > 90 |
| 59 | ? chalk.red |
| 60 | : percentage > 70 |
| 61 | ? chalk.yellow |
| 62 | : chalk.green; |
| 63 | console.log( |
| 64 | ` ${chalk.gray('Event Usage:')} ${color(usage)} (${percentage.toFixed(1)}%)`, |
| 65 | ); |
| 66 | } |
| 67 | if (organization.subscriptionStartsAt) { |
| 68 | console.log( |
| 69 | ` ${chalk.gray('Starts:')} ${organization.subscriptionStartsAt.toISOString()}`, |
| 70 | ); |
| 71 | } |
| 72 | if (organization.subscriptionEndsAt) { |
| 73 | console.log( |
| 74 | ` ${chalk.gray('Ends:')} ${organization.subscriptionEndsAt.toISOString()}`, |
| 75 | ); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | if (organization.deleteAt) { |
| 80 | console.log( |
| 81 | ` ${chalk.red.bold('⚠️ Scheduled for deletion:')} ${organization.deleteAt.toISOString()}`, |
no test coverage detected