text changes and remove infra folder
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Load environment config
|
||||
const env = process.env.NODE_ENV || "dev";
|
||||
const env = process.env.NODE_ENV;
|
||||
const envFile = `.env.${env}`;
|
||||
require("dotenv").config({ path: envFile });
|
||||
|
||||
@@ -101,11 +101,11 @@ async function resendInvitation(emailOrCode) {
|
||||
// Try to find by code first (if it looks like a code), otherwise by email
|
||||
if (input.toUpperCase().startsWith("ALPHA-")) {
|
||||
invitation = await AlphaInvitation.findOne({
|
||||
where: { code: input.toUpperCase() }
|
||||
where: { code: input.toUpperCase() },
|
||||
});
|
||||
} else {
|
||||
invitation = await AlphaInvitation.findOne({
|
||||
where: { email: normalizeEmail(input) }
|
||||
where: { email: normalizeEmail(input) },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -131,7 +131,10 @@ async function resendInvitation(emailOrCode) {
|
||||
|
||||
// Resend the email
|
||||
try {
|
||||
await emailServices.alphaInvitation.sendAlphaInvitation(invitation.email, invitation.code);
|
||||
await emailServices.alphaInvitation.sendAlphaInvitation(
|
||||
invitation.email,
|
||||
invitation.code,
|
||||
);
|
||||
|
||||
console.log(`\n✅ Alpha invitation resent successfully!`);
|
||||
console.log(` Email: ${invitation.email}`);
|
||||
@@ -178,7 +181,7 @@ async function listInvitations(filter = "all") {
|
||||
});
|
||||
|
||||
console.log(
|
||||
`\n📋 Alpha Invitations (${invitations.length} total, filter: ${filter})\n`
|
||||
`\n📋 Alpha Invitations (${invitations.length} total, filter: ${filter})\n`,
|
||||
);
|
||||
console.log("─".repeat(100));
|
||||
console.log(
|
||||
@@ -186,7 +189,7 @@ async function listInvitations(filter = "all") {
|
||||
"EMAIL".padEnd(30) +
|
||||
"STATUS".padEnd(10) +
|
||||
"USED BY".padEnd(25) +
|
||||
"CREATED"
|
||||
"CREATED",
|
||||
);
|
||||
console.log("─".repeat(100));
|
||||
|
||||
@@ -204,7 +207,7 @@ async function listInvitations(filter = "all") {
|
||||
inv.email.padEnd(30) +
|
||||
inv.status.padEnd(10) +
|
||||
usedBy.padEnd(25) +
|
||||
created
|
||||
created,
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -221,7 +224,7 @@ async function listInvitations(filter = "all") {
|
||||
};
|
||||
|
||||
console.log(
|
||||
`\nSummary: ${stats.pending} pending | ${stats.active} active | ${stats.revoked} revoked\n`
|
||||
`\nSummary: ${stats.pending} pending | ${stats.active} active | ${stats.revoked} revoked\n`,
|
||||
);
|
||||
|
||||
return invitations;
|
||||
@@ -274,7 +277,9 @@ async function restoreInvitation(code) {
|
||||
}
|
||||
|
||||
if (invitation.status !== "revoked") {
|
||||
console.log(`\n⚠️ Invitation is not revoked (current status: ${invitation.status})`);
|
||||
console.log(
|
||||
`\n⚠️ Invitation is not revoked (current status: ${invitation.status})`,
|
||||
);
|
||||
console.log(` Code: ${code}`);
|
||||
console.log(` Email: ${invitation.email}`);
|
||||
return invitation;
|
||||
@@ -288,7 +293,9 @@ async function restoreInvitation(code) {
|
||||
console.log(`\n✅ Invitation restored successfully!`);
|
||||
console.log(` Code: ${code}`);
|
||||
console.log(` Email: ${invitation.email}`);
|
||||
console.log(` Status: ${newStatus} (${invitation.usedBy ? 'was previously used' : 'never used'})`);
|
||||
console.log(
|
||||
` Status: ${newStatus} (${invitation.usedBy ? "was previously used" : "never used"})`,
|
||||
);
|
||||
|
||||
return invitation;
|
||||
} catch (error) {
|
||||
@@ -313,7 +320,7 @@ async function bulkImport(csvPath) {
|
||||
const dataLines = hasHeader ? lines.slice(1) : lines;
|
||||
|
||||
console.log(
|
||||
`\n📥 Importing ${dataLines.length} invitations from ${csvPath}...\n`
|
||||
`\n📥 Importing ${dataLines.length} invitations from ${csvPath}...\n`,
|
||||
);
|
||||
|
||||
let successCount = 0;
|
||||
@@ -391,7 +398,7 @@ CSV Format:
|
||||
if (!email) {
|
||||
console.log("\n❌ Error: Email is required");
|
||||
console.log(
|
||||
"Usage: node scripts/manageAlphaInvitations.js add <email> [notes]\n"
|
||||
"Usage: node scripts/manageAlphaInvitations.js add <email> [notes]\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -406,7 +413,7 @@ CSV Format:
|
||||
if (!code) {
|
||||
console.log("\n❌ Error: Code is required");
|
||||
console.log(
|
||||
"Usage: node scripts/manageAlphaInvitations.js revoke <code>\n"
|
||||
"Usage: node scripts/manageAlphaInvitations.js revoke <code>\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -418,7 +425,7 @@ CSV Format:
|
||||
if (!emailOrCode) {
|
||||
console.log("\n❌ Error: Email or code is required");
|
||||
console.log(
|
||||
"Usage: node scripts/manageAlphaInvitations.js resend <email|code>\n"
|
||||
"Usage: node scripts/manageAlphaInvitations.js resend <email|code>\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -430,7 +437,7 @@ CSV Format:
|
||||
if (!code) {
|
||||
console.log("\n❌ Error: Code is required");
|
||||
console.log(
|
||||
"Usage: node scripts/manageAlphaInvitations.js restore <code>\n"
|
||||
"Usage: node scripts/manageAlphaInvitations.js restore <code>\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -442,7 +449,7 @@ CSV Format:
|
||||
if (!csvPath) {
|
||||
console.log("\n❌ Error: CSV path is required");
|
||||
console.log(
|
||||
"Usage: node scripts/manageAlphaInvitations.js bulk <csvPath>\n"
|
||||
"Usage: node scripts/manageAlphaInvitations.js bulk <csvPath>\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -451,7 +458,7 @@ CSV Format:
|
||||
} else {
|
||||
console.log(`\n❌ Unknown command: ${command}`);
|
||||
console.log(
|
||||
"Run 'node scripts/manageAlphaInvitations.js help' for usage information\n"
|
||||
"Run 'node scripts/manageAlphaInvitations.js help' for usage information\n",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user