-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from scienmanas/mvp
Mvp
- Loading branch information
Showing
120 changed files
with
5,281 additions
and
39,362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import nodemailer from "nodemailer"; | ||
import multer from "multer"; | ||
|
||
const PORT: number = 465; | ||
const storage = multer.memoryStorage(); // Store the files in memory | ||
const upload = multer({ storage }); | ||
|
||
export async function sendMail({ | ||
fromName = "", | ||
toName = "", | ||
toEmail, | ||
subject, | ||
message, | ||
file, | ||
}: { | ||
fromName: string; | ||
toName?: string; | ||
toEmail: string; | ||
subject: string; | ||
message: string; | ||
file?: Express.Multer.File; | ||
}): Promise<void> { | ||
const EMAIL = process.env.ADMIN_EMAIL; | ||
const PASSWORD = process.env.ADMIN_APP_PASSWORD; | ||
|
||
if (!EMAIL || !PASSWORD) { | ||
throw new Error( | ||
"Email credentials are not set in the environment variables." | ||
); | ||
} | ||
|
||
// Create transporter | ||
const transporter = nodemailer.createTransport({ | ||
host: "smtppro.zoho.in", | ||
port: PORT, | ||
secure: true, // Use SSL | ||
auth: { | ||
user: EMAIL, | ||
pass: PASSWORD, | ||
}, | ||
}); | ||
|
||
// Mail options | ||
const mailOptions: nodemailer.SendMailOptions = { | ||
from: `${fromName} <${EMAIL}>`, | ||
to: `${toName} <${toEmail}>`, | ||
replyTo: `Manas <[email protected]>`, | ||
subject: subject, | ||
text: message, | ||
}; | ||
|
||
// Attach the file if present | ||
if (file) { | ||
mailOptions.attachments = [ | ||
{ | ||
filename: file.originalname, | ||
content: file.buffer, | ||
encoding: "base64", | ||
}, | ||
]; | ||
} | ||
|
||
// Send the mail | ||
await transporter.sendMail(mailOptions); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ export type waitlistParams = { | |
|
||
export type newsLetterParams = { | ||
email: string; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import mongoose from "mongoose"; | ||
|
||
const flaggedUserchema = new mongoose.Schema( | ||
{ | ||
email: { type: String, required: true }, | ||
registered: { type: String, required: true, enum: ["yes", "no"] }, | ||
time_stamp: { type: String, require: true, default: Date.now }, | ||
severity: { | ||
type: String, | ||
required: true, | ||
enum: ["yellow", "red"], | ||
}, | ||
}, | ||
{ | ||
collection: "flagged", | ||
} | ||
); | ||
|
||
export default mongoose.models.FlaggedUser || | ||
mongoose.model("FlaggedUser", flaggedUserchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import mongoose from "mongoose"; | ||
|
||
const newsLetterSchema = new mongoose.Schema( | ||
{ | ||
email: { type: String, required: true, unique: false } | ||
}, | ||
{ | ||
collection: 'newsletter' | ||
} | ||
{ | ||
email: { type: String, required: true, unique: false }, | ||
date: { type: Date, default: Date.now }, | ||
}, | ||
{ | ||
collection: "newsletter", | ||
} | ||
); | ||
|
||
export default mongoose.models.newsLetter || mongoose.model('newsLetter', newsLetterSchema) | ||
export default mongoose.models.newsLetter || | ||
mongoose.model("newsLetter", newsLetterSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import mongoose, { Schema } from "mongoose"; | ||
|
||
const OtpSchema = new mongoose.Schema({ | ||
_id: { | ||
type: Schema.Types.ObjectId, | ||
required: true, | ||
default:() => new mongoose.Types.ObjectId(), | ||
}, | ||
user_id: { | ||
type: Schema.Types.ObjectId, | ||
required: true, | ||
}, | ||
otp: { type: Number, required: true }, | ||
time_stamp: { type: String, required: true, default: Date.now() }, | ||
}); | ||
|
||
export default mongoose.models.Otp || mongoose.model("OTP", OtpSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import mongoose, { Schema } from "mongoose"; | ||
|
||
// In this password is not needed as it will be automatically generated by system, aslo user reaches this syaye only when he has confirmed OTP | ||
// also recapta will be added | ||
|
||
const pendingUserSchema = new mongoose.Schema( | ||
{ | ||
_id: { | ||
type: Schema.Types.ObjectId, | ||
required: true, | ||
default: () => new mongoose.Types.ObjectId(), | ||
}, | ||
name: { type: String, required: true }, | ||
email: { type: String, required: true, unique: true }, | ||
applier_type: { type: String, required: true, default: "none" }, | ||
logo_url: { type: String, required: true, default: "none" }, | ||
status: { | ||
type: String, | ||
required: true, | ||
enum: ["verified", "unverified"], | ||
default: "unverified", | ||
}, | ||
about: { type: String, required: true, default: "none" }, | ||
website: { type: String, required: true, default: "none" }, | ||
designation: { type: String, required: true, default: "none" }, | ||
reason: { type: String, required: true, default: "none" }, | ||
schema_complete: { type: Boolean, required: true, default: false }, | ||
date_of_request: { type: String, required: true, default: Date.now }, | ||
}, | ||
{ | ||
collection: "pendingusers", | ||
} | ||
); | ||
|
||
export default mongoose.models.PendingUser || | ||
mongoose.model("PendingUser", pendingUserSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.