Skip to content

Commit d1f28ee

Browse files
committed
add files
0 parents  commit d1f28ee

16 files changed

+4995
-0
lines changed

.env.example

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PORT=
2+
DB_URI=
3+
SOURCE_EMAIL=
4+
SOURCE_EMAIL_APP_PASSWORD=
5+
EVENT_NAME=

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.env
3+
temp/*.pdf

LICENSE

+428
Large diffs are not rendered by default.

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Event Backend
2+
NodeJS backend for official SCCSBS events
3+
4+
## Built with
5+
- NodeJs
6+
- MongoDB
7+
- Express
8+
- Nodemailer
9+
- Puppeteer
10+
- Qrcode
11+
12+
## Installation
13+
- Create the `.env` file based on `.env.example`
14+
- Paste the MongoDB URI *( MongoDB Atlas > Database > Connect > Driver > Copy connection string )*
15+
e.g. `mongodb+srv://<user>:<password>@<cluster>.nteh6ar.mongodb.net/?retryWrites=true&w=majority`
16+
- Set up Node Mailer
17+
- Setup google account APP PASSWORD (https://youtu.be/klDTBiW6iiM)
18+
- SOURCE_EMAIL=[email protected]
19+
- SOURCE_EMAIL_APP_PASSWORD=YOUR_APP_PASSWORD_HERE
20+
21+
- Start the server
22+
```sh
23+
$ npm start
24+
(> npm start
25+
26+
27+
> nodemon server.js
28+
29+
[nodemon] starting `node server.js`
30+
[+] Server is running on port 5000
31+
[+] MongoDB is connected!
32+
```
33+
- Use this API URL - http://localhost:5000 to connect with the frontend
34+
35+
# License
36+
<p align="center">
37+
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.<br/> Read the <a href="LICENSE">LICENSE</a> for more details.
38+
</p>

db.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const mongoose = require("mongoose");
2+
3+
const DB_URI = process.env.DB_URI;
4+
5+
mongoose
6+
.connect(DB_URI, {
7+
useNewUrlParser: true,
8+
useUnifiedTopology: true,
9+
})
10+
.then(() => {
11+
console.log(`[+] MongoDB is connected!`);
12+
})
13+
.catch((e) => {
14+
console.log(`[x] Connection failed! ${e}`);
15+
});

models/RegistrationSchema.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const mongoose = require("mongoose");
2+
3+
const registrationSchema = new mongoose.Schema({
4+
team: {
5+
teamName: { type: String, required: true, unique: true },
6+
phone: { type: Number, required: true, unique: true },
7+
slot: { type: String, enum: ["Slot 1", "Slot 2"] },
8+
emailSent: { type: Boolean, default: false },
9+
attendance: { type: Boolean, default: false },
10+
},
11+
members: [
12+
{
13+
name: { type: String, required: true },
14+
email: { type: String, required: true, unique: true },
15+
year: { type: String, required: true },
16+
branch: { type: String, required: true },
17+
gender: { type: String, required: true },
18+
role: { type: String, enum: ["member", "leader"], required: true },
19+
},
20+
],
21+
payment: {
22+
method: { type: String, enum: ["online", "offline"], required: true },
23+
status: {
24+
type: String,
25+
enum: ["pending", "paid", "failed"],
26+
default: "pending",
27+
},
28+
totalAmount: Number,
29+
// transactionID: String
30+
},
31+
});
32+
33+
const Registration = mongoose.model("Registration", registrationSchema);
34+
35+
module.exports = Registration;

0 commit comments

Comments
 (0)