View the live site here.
Welcome to the soulful core of GreenEcovents! This repository cradles the intricate symphony of the server side, a masterpiece crafted by a lone dream-weaver immersed in the enchanting realms of TypeScript, Node.js, and Express.js. It's not just a backend; it's the pulsating heart of a visionary event management web application.
GreenEcovents is more than code; it's a journey. Picture a lone developer, navigating the digital wilderness, sculpting this marvel with the grace of TypeScript, the power of Node.js, and the expressiveness of Express.js. The backdrop? A PostgreSQL canvas, where every line of code weaves a tale of user authentication, event orchestration, and dynamic content choreography.
As the maestro behind the curtain, I orchestrated the entire backend symphony for GreenEcovents. My canvas embraced the responsibilities of user management, the choreography of event handling, and the dynamic narration of content administration. Each keystroke, a note; every commit, a melody. Hereβs a glimpse of my contributions:
+---------------------+ +------------------------+ +----------------------+
| User | | Category | | Event |
+---------------------+ +------------------------+ +----------------------+
| id | | id | | id |
| email | | name | | title |
| password | +------------------------+ | description |
| firstName | | | | startDate |
| lastName | | | | endDate |
| contactNo | | | | location |
| role | | | | price |
| gender | | | | image |
| profileImg | | | | status |
| createdAt | | | | userId |
| updatedAt | | | | categoryId |
| | | | | createdAt |
| | | | | updatedAt |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
+---------------------+ | +------------------------+
| |
| |
V V
+---------------------+ +---------------------+ +---------------------+
| Booking | | Payment | | Review |
+---------------------+ +---------------------+ +---------------------+
| id | | id | | id |
| status | | amount | | review |
| startDate | | currency | | rating |
| endDate | | paymentId | | userId |
| adults | | userId | | eventId |
| childrens | | bookingId | | createdAt |
| email | | createdAt | | updatedAt |
| contactNo | | updatedAt | | |
| daysBooked | | | | |
| totalAmount | | | | |
| userId | | | | |
| eventId | | | | |
| createdAt | | | | |
| updatedAt | | | | |
| | | | | |
| | | | | |
| | | | | |
+---------------------+ +---------------------+ +---------------------+
|
|
V
+---------------------+
| Feedback |
+---------------------+
| id |
| feedback |
| userId |
| createdAt |
| updatedAt |
| |
| |
| |
+---------------------+
|
|
V
+---------------------+
| BlogPost |
+---------------------+
| id |
| title |
| content |
| image |
| userId |
| createdAt |
| updatedAt |
| |
| |
| |
+---------------------+
|
|
V
+---------------------+
| FAQ |
+---------------------+
| id |
| question |
| answer |
| userId |
| createdAt |
| updatedAt |
| |
| |
| |
+---------------------+
|
|
V
+---------------------+
| Pages |
+---------------------+
| id |
| title |
| content |
| userId |
| createdAt |
| updatedAt |
| |
| |
| |
+---------------------+
|
|
V
+---------------------+
| Subscriber |
+---------------------+
| id |
| email |
| createdAt |
| updatedAt |
| |
| |
| |
+---------------------+
- /api/v1: Root route to include all sub-routes.
- POST /signup: Register a new user.
- POST /login: Log in a user.
- POST /refresh-token: Refresh the authentication token.
- PATCH /change-password: Change the password of a user.
- POST /logout: Log out a user.
- POST /make-admin: Make a user an admin (requires SUPER_ADMIN role).
- PATCH /:id: Update admin details (requires SUPER_ADMIN role).
- GET /: Get all admins (requires SUPER_ADMIN role).
- DELETE /:id: Delete an admin (requires SUPER_ADMIN role).
- POST /: Create a new blog (requires ADMIN or SUPER_ADMIN role).
- GET /user: Get blogs by user (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /: Get all blogs.
- GET /:id: Get a single blog.
- PATCH /:id: Update a blog (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete a blog (requires ADMIN or SUPER_ADMIN role).
- POST /create-payment-intents: Create payment intents for booking (requires ADMIN, SUPER_ADMIN, or USER role).
- POST /: Create a new booking (requires ADMIN, SUPER_ADMIN, or USER role).
- POST /confirm: Confirm a booking (requires ADMIN, SUPER_ADMIN, or USER role).
- POST /get-data: Get booking data (requires ADMIN or SUPER_ADMIN role).
- GET /payment-details/:id: Get payment details for a booking (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /: Get all bookings (requires ADMIN or SUPER_ADMIN role).
- GET /user: Get bookings by user (requires USER role).
- GET /:id: Get a single booking (requires ADMIN, SUPER_ADMIN, or USER role).
- PATCH /:id: Update a booking (requires ADMIN or SUPER_ADMIN role).
- PATCH /user/:id: Cancel a booking (requires USER role).
- DELETE /:id: Delete a booking (requires ADMIN, SUPER_ADMIN, or USER role).
- POST /: Create or update a category (requires ADMIN or SUPER_ADMIN role).
- GET /: Get all categories.
- GET /:id: Get a single category.
- PATCH /:id: Update a category (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete a category (requires ADMIN or SUPER_ADMIN role).
- POST /: Create a new event (requires ADMIN or SUPER_ADMIN role).
- GET /: Get all events.
- GET /:id: Get a single event.
- PATCH /:id: Update an event (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete an event (requires ADMIN or SUPER_ADMIN role).
- POST /: Create a new FAQ (requires ADMIN or SUPER_ADMIN role).
- GET /user: Get FAQs by user (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /: Get all FAQs.
- GET /:id: Get a single FAQ.
- PATCH /:id: Update a FAQ (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete a FAQ (requires ADMIN or SUPER_ADMIN role).
- POST /: Create new feedback (requires USER role).
- GET /user: Get feedbacks by user (requires USER role).
- GET /: Get all feedbacks (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /:id: Get a single feedback (requires ADMIN, SUPER_ADMIN, or USER role).
- PATCH /:id: Update feedback (requires ADMIN, SUPER_ADMIN, or USER role).
- DELETE /:id: Delete feedback (requires ADMIN or SUPER_ADMIN role).
- POST /: Send an email.
- POST /: Create a new page (requires ADMIN or SUPER_ADMIN role).
- GET /user: Get pages by user (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /: Get all pages.
- GET /:id: Get a single page.
- PATCH /:id: Update a page (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete a page (requires ADMIN or SUPER_ADMIN role).
- POST /: Create a new review (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /user: Get reviews by user (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /: Get all reviews.
- GET /:id: Get a single review.
- PATCH /:id: Update a review (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete a review (requires ADMIN or SUPER_ADMIN role).
- GET /events/:eventId: Get reviews by event ID (requires ADMIN, SUPER_ADMIN, or USER role).
- POST /: Add a new subscriber.
- POST /send: Send an email to subscribers (requires ADMIN or SUPER_ADMIN role).
- GET /: Get all subscribers (requires ADMIN or SUPER_ADMIN role).
- DELETE /:id: Delete a subscriber (requires ADMIN or SUPER_ADMIN role).
- GET /profile: Get user profile details (requires ADMIN, SUPER_ADMIN, or USER role).
- GET /get-all: Get all users (requires ADMIN or SUPER_ADMIN role).
- GET /:id: Get a user by ID.
- PATCH /profile: Update user profile (requires ADMIN, SUPER_ADMIN, or USER role).
- PATCH /:id: Update a user (requires ADMIN, SUPER_ADMIN, or USER role).
- DELETE /:id: Delete a user (requires ADMIN or SUPER_ADMIN role).
-
POST /api/v1/auth/signup
- Request:
{ "email": "user@example.com", "password": "password123", "firstName": "John", "lastName": "Doe", "contactNo": "1234567890", "gender": "male" } - Response:
{ "id": "generated_user_id", "email": "user@example.com", "firstName": "John", "lastName": "Doe", "contactNo": "1234567890", "role": "USER", "gender": "male", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events": [] }
- Request:
-
POST /api/v1/auth/login
- Request:
{ "email": "user@example.com", "password": "password123" } - Response:
{ "accessToken": "jwt_access_token", "refreshToken": "jwt_refresh_token" }
- Request:
-
POST /api/v1/auth/refresh-token
- Request:
{ "refreshToken": "jwt_refresh_token" } - Response:
{ "accessToken": "new_jwt_access_token" }
- Request:
-
PATCH /api/v1/auth/change-password
- Request:
{ "newPassword": "new_password123" } - Response:
{ "message": "Password changed successfully" }
- Request:
-
POST /api/v1/auth/logout
- Response:
{ "message": "Logout successful" }
- Response:
-
GET /api/v1/user/profile
- Response:
{ "id": "user_id", "email": "user@example.com", "firstName": "John", "lastName": "Doe", "contactNo": "1234567890", "role": "USER", "gender": "male", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events": [] }
- Response:
-
GET /api/v1/user/get-all
- Response:
[ { "id": "user_id_1", "email": "user1@example.com", "firstName": "Alice", "lastName": "Smith", "contactNo": "9876543210", "role": "USER", "gender": "female", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events": [] }, { "id": "user_id_2", "email": "user2@example.com", "firstName": "Bob", "lastName": "Johnson", "contactNo": "5678901234", "role": "USER", "gender": "male", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events": [] } ]
- Response:
-
GET /api/v1/user/:id
- Response:
{ "id": "user_id", "email": "user@example.com", "firstName": "John", "lastName": "Doe", "contactNo": "1234567890", "role": "USER", "gender": "male", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events":
- Response:
[] } ```
-
PATCH /api/v1/user/profile
- Request:
{ "firstName": "UpdatedJohn", "lastName": "UpdatedDoe", "contactNo": "9876543210", "gender": "female" } - Response:
{ "id": "user_id", "email": "user@example.com", "firstName": "UpdatedJohn", "lastName": "UpdatedDoe", "contactNo": "9876543210", "role": "USER", "gender": "female", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events": [] }
- Request:
-
PATCH /api/v1/user/:id
- Request:
{ "firstName": "UpdatedAlice", "lastName": "UpdatedSmith", "contactNo": "9876543210", "gender": "female" } - Response:
{ "id": "user_id", "email": "user@example.com", "firstName": "UpdatedAlice", "lastName": "UpdatedSmith", "contactNo": "9876543210", "role": "USER", "gender": "female", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp", "feedbacks": [], "pages": [], "payments": [], "reviews": [], "bookings": [], "blogPosts": [], "FAQs": [], "events": [] }
- Request:
-
DELETE /api/v1/user/:id
- Response:
{ "message": "User deleted successfully" }
- Response:
-
POST /api/v1/admin/make-admin
- Request:
{ "userId": "user_id_to_promote" } - Response:
{ "message": "User promoted to admin successfully" }
- Request:
-
PATCH /api/v1/admin/:id
- Request:
{ "firstName": "UpdatedAdmin", "lastName": "UpdatedLastName", "contactNo": "9876543210", "gender": "male" } - Response:
{ "id": "admin_id", "email": "admin@example.com", "firstName": "UpdatedAdmin", "lastName": "UpdatedLastName", "contactNo": "9876543210", "role": "ADMIN", "gender": "male", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp" }
- Request:
-
GET /api/v1/admin/
- Response:
[ { "id": "admin_id_1", "email": "admin1@example.com", "firstName": "Admin1", "lastName": "Smith", "contactNo": "9876543210", "role": "ADMIN", "gender": "male", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "admin_id_2", "email": "admin2@example.com", "firstName": "Admin2", "lastName": "Johnson", "contactNo": "5678901234", "role": "ADMIN", "gender": "female", "profileImg": null, "createdAt": "timestamp", "updatedAt": "timestamp" } ]
- Response:
-
DELETE /api/v1/admin/:id
- Response:
{ "message": "Admin deleted successfully" }
- Response:
-
Create a Category:
- Endpoint:
POST /api/v1/categories - Authentication: Required (Admin or Super Admin)
- Request Body:
{ "name": "CategoryName" } - Response:
{ "id": "categoryId", "name": "CategoryName", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Get All Categories:
- Endpoint:
GET /api/v1/categories - Authentication: Not required
- Response:
[ { "id": "categoryId1", "name": "CategoryName1", "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "categoryId2", "name": "CategoryName2", "createdAt": "timestamp", "updatedAt": "timestamp" }, // ... other categories ]
- Endpoint:
-
Get a Single Category:
- Endpoint:
GET /api/v1/categories/:id - Authentication: Not required
- Response:
{ "id": "categoryId", "name": "CategoryName", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Update a Category:
- Endpoint:
PATCH /api/v1/categories/:id - Authentication: Required (Admin or Super Admin)
- Request Body:
{ "name": "UpdatedCategoryName" } - Response:
{ "id": "categoryId", "name": "UpdatedCategoryName", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Delete a Category:
- Endpoint:
DELETE /api/v1/categories/:id - Authentication: Required (Admin or Super Admin)
- Response:
{ "message": "Category deleted successfully" }
- Endpoint:
-
Create Event:
- Endpoint:
POST /api/v1/events - Request Body:
{ "title": "Example Event", "description": "A sample event description", "startDate": "2023-01-01T00:00:00.000Z", "endDate": "2023-01-02T00:00:00.000Z", "location": "Sample Location", "price": 25.99, "image": "event-image-url.jpg", "userId": "user-id", // Replace with the actual user ID "categoryId": "category-id" // Replace with the actual category ID } - Response Data:
{ "id": "generated-event-id", "title": "Example Event", "description": "A sample event description", "startDate": "2023-01-01T00:00:00.000Z", "endDate": "2023-01-02T00:00:00.000Z", "location": "Sample Location", "price": 25.99, "image": "event-image-url.jpg", "status": "upcoming", "userId": "user-id", "categoryId": "category-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Get All Events:
- Endpoint:
GET /api/v1/events - Response Data:
[ { "id": "event-id-1", "title": "Event 1", "description": "Description 1", "startDate": "2023-01-01T00:00:00.000Z", "endDate": "2023-01-02T00:00:00.000Z", "location": "Location 1", "price": 29.99, "image": "event-image-1.jpg", "status": "upcoming", "userId": "user-id-1", "categoryId": "category-id-1", "createdAt": "timestamp", "updatedAt": "timestamp" }, // ... (other events) ]
- Endpoint:
-
Get Single Event:
- Endpoint:
GET /api/v1/events/:id(replace:idwith the actual event ID) - Response Data:
{ "id": "event-id", "title": "Example Event", "description": "A sample event description", "startDate": "2023-01-01T00:00:00.000Z", "endDate": "2023-01-02T00:00:00.000Z", "location": "Sample Location", "price": 25.99, "image": "event-image-url.jpg", "status": "upcoming", "userId": "user-id", "categoryId": "category-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Update Event:
- Endpoint:
PATCH /api/v1/events/:id(replace:idwith the actual event ID) - Request Body:
{ "title": "Updated Event Title", "description": "Updated event description", "startDate": "2023-02-01T00:00:00.000Z", "endDate": "2023-02-02T00:00:00.000Z", "location": "Updated Location", "price": 35.99, "image": "updated-event-image.jpg" } - Response Data:
{ "id": "event-id", "title": "Updated Event Title", "description": "Updated event description", "startDate": "2023-02-01T00:00:00.000Z", "endDate": "2023-02-02T00:00:00.000Z", "location": "Updated Location", "price": 35.99, "image": "updated-event-image.jpg", "status": "upcoming", "userId": "user-id", "categoryId": "category-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Delete Event:
- Endpoint:
DELETE /api/v1/events/:id(replace:idwith the actual event ID) - Response Data: (No content, successful deletion)
- Endpoint:
-
Create a Booking:
- Endpoint:
POST /api/v1/bookings/ - Request Body:
{ "status": "pending", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id" } - Response:
{ "id": "booking-id", "status": "pending", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" }
- Endpoint:
-
Confirm Booking:
- Endpoint:
POST /api/v1/bookings/confirm - Request Body:
{ "bookingId": "booking-id" } - Response:
{ "message": "Booking confirmed successfully", "booking": { "id": "booking-id", "status": "confirmed", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" } }
- Endpoint:
-
Get All Bookings:
- Endpoint:
GET /api/v1/bookings/ - Response:
[ { "id": "booking-id-1", "status": "confirmed", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" }, { "id": "booking-id-2", "status": "pending", "startDate": "2023-02-01T12:00:00Z", "endDate": "2023-02-03T12:00:00Z", "adults": 1, "childrens": 0, "email": "anotheruser@example.com", "contactNo": "+987654321", "daysBooked": 2, "totalAmount": 100.0, "userId": "another-user-id", "eventId": "another-event-id", "createdAt": "2023-11-19T12:00:00Z", "updatedAt": "2023-11-19T12:00:00Z" } ]
- Endpoint:
-
Get Booking by ID:
- Endpoint:
GET /api/v1/bookings/:id - Response:
{ "id": "booking-id", "status": "confirmed", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" }
- Endpoint:
-
Update Booking:
- Endpoint:
PATCH /api/v1/bookings/:id - Request Body:
{ "status": "canceled" } - Response:
{ "message": "Booking updated successfully", "booking": { "id": "booking-id", "status": "canceled", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" } }
- Endpoint:
-
Cancel Booking (User):
- Endpoint:
PATCH /api/v1/bookings/user/:id - Response:
{ "message": "Booking canceled successfully", "booking": { "id": "booking-id", "status": "canceled", "startDate": "2023-01-01T12:00:00Z", "endDate": "2023-01-03T12:00:00Z", "adults": 2, "childrens": 1, "email": "user@example.com", "contactNo": "+123456789", "daysBooked": 3, "totalAmount": 150.0, "userId": "user-id", "eventId": "event-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" } }
- Endpoint:
-
Delete Booking:
- Endpoint:
DELETE /api/v1/bookings/:id - Response:
{ "message": "Booking deleted successfully" }
- Endpoint:
-
Get Payment Details:
- Endpoint:
GET /api/v1/bookings/payment-details/:id - Response:
{ "id": "payment-id", "amount": 150.0, "currency": "USD", "paymentId": "payment-stripe-id", "userId": "user-id", "bookingId": "booking-id", "createdAt": "2023-11-18T12:00:00Z", "updatedAt": "2023-11-18T12:00:00Z" }
- Endpoint:
-
Get Booking Data (Admin):
- Endpoint:
POST /api/v1/bookings/get-data - Response:
{ "totalBookings": 100, "confirmedBookings": 80, "pendingBookings": 15, "canceledBookings": 5, "revenue": 15000.0 }
- Endpoint:
Endpoint: POST /api/v1/reviews
Request Data:
{
"review": "Great event! Enjoyed every moment.",
"rating": 4.5,
"userId": "user_id_here",
"eventId": "event_id_here"
}Response Data:
{
"id": "review_id_here",
"review": "Great event! Enjoyed every moment.",
"rating": 4.5,
"userId": "user_id_here",
"eventId": "event_id_here",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
}Endpoint: GET /api/v1/reviews/user
Response Data:
[
{
"id": "review_id_1",
"review": "Awesome experience!",
"rating": 5.0,
"userId": "user_id_here",
"eventId": "event_id_1",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
},
{
"id": "review_id_2",
"review": "Enjoyed the event.",
"rating": 4.0,
"userId": "user_id_here",
"eventId": "event_id_2",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
}
// ... additional reviews
]Endpoint: GET /api/v1/reviews
Response Data:
[
{
"id": "review_id_1",
"review": "Awesome experience!",
"rating": 5.0,
"userId": "user_id_1",
"eventId": "event_id_1",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
},
{
"id": "review_id_2",
"review": "Enjoyed the event.",
"rating": 4.0,
"userId": "user_id_2",
"eventId": "event_id_2",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
}
// ... additional reviews
]Endpoint: GET /api/v1/reviews/:id
Response Data:
{
"id": "review_id_here",
"review": "Great event! Enjoyed every moment.",
"rating": 4.5,
"userId": "user_id_here",
"eventId": "event_id_here",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
}Endpoint: PATCH /api/v1/reviews/:id
Request Data:
{
"review": "Updated review text.",
"rating": 4.8
}Response Data:
{
"id": "review_id_here",
"review": "Updated review text.",
"rating": 4.8,
"userId": "user_id_here",
"eventId": "event_id_here",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
}Endpoint: DELETE /api/v1/reviews/:id
Response Data:
{
"message": "Review deleted successfully."
}Endpoint: GET /api/v1/reviews/events/:eventId
Response Data:
[
{
"id": "review_id_1",
"review": "Great event!",
"rating": 4.5,
"userId": "user_id_1",
"eventId": "event_id_here",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
},
{
"id": "review_id_2",
"review": "Fantastic experience!",
"rating": 5.0,
"userId": "user_id_2",
"eventId": "event_id_here",
"createdAt": "timestamp_here",
"updatedAt": "timestamp_here"
}
// ... additional reviews
]Certainly! Below are the API endpoints along with their corresponding response data and required request details for the provided Blog model:
-
Create Blog Post:
- Endpoint:
POST /api/v1/blogs - Request:
- Headers:
Authorization(with user's token) - Body:
{ "title": "Example Blog Title", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image": "example_image_url.jpg", "userId": "user_id" }
- Headers:
- Response:
{ "id": "generated_blog_id", "title": "Example Blog Title", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image": "example_image_url.jpg", "userId": "user_id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Get All Blogs:
- Endpoint:
GET /api/v1/blogs - Response:
[ { "id": "blog_id_1", "title": "Blog Title 1", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image": "image_url_1.jpg", "userId": "user_id_1", "createdAt": "timestamp_1", "updatedAt": "timestamp_1" }, { "id": "blog_id_2", "title": "Blog Title 2", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image": "image_url_2.jpg", "userId": "user_id_2", "createdAt": "timestamp_2", "updatedAt": "timestamp_2" }, // ... More Blogs ]
- Endpoint:
-
Get Single Blog:
- Endpoint:
GET /api/v1/blogs/:id - Response:
{ "id": "blog_id", "title": "Blog Title", "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "image": "image_url.jpg", "userId": "user_id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Update Blog:
- Endpoint:
PATCH /api/v1/blogs/:id - Request:
- Headers:
Authorization(with user's token) - Body:
{ "title": "Updated Blog Title", "content": "Updated content goes here", "image": "updated_image_url.jpg" }
- Headers:
- Response:
{ "id": "blog_id", "title": "Updated Blog Title", "content": "Updated content goes here", "image": "updated_image_url.jpg", "userId": "user_id", "createdAt": "original_timestamp", "updatedAt": "new_timestamp" }
- Endpoint:
-
Delete Blog:
- Endpoint:
DELETE /api/v1/blogs/:id - Request:
- Headers:
Authorization(with user's token)
- Headers:
- Response:
{ "message": "Blog with id blog_id deleted successfully." }
- Endpoint:
-
Endpoint:
POST /api/v1/faq -
Request Data:
{ "question": "Your FAQ Question", "answer": "Your FAQ Answer" } -
Response Data:
{ "id": "generated-id", "question": "Your FAQ Question", "answer": "Your FAQ Answer", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
-
Endpoint:
GET /api/v1/faq/user -
Response Data:
[ { "id": "faq-id", "question": "FAQ Question", "answer": "FAQ Answer", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, // Additional FAQs... ]
-
Endpoint:
GET /api/v1/faq -
Response Data:
[ { "id": "faq-id", "question": "FAQ Question", "answer": "FAQ Answer", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, // Additional FAQs... ]
-
Endpoint:
GET /api/v1/faq/:id -
Response Data:
{ "id": "faq-id", "question": "FAQ Question", "answer": "FAQ Answer", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
-
Endpoint:
PATCH /api/v1/faq/:id -
Request Data:
{ "question": "Updated FAQ Question", "answer": "Updated FAQ Answer" } -
Response Data:
{ "id": "faq-id", "question": "Updated FAQ Question", "answer": "Updated FAQ Answer", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
-
Endpoint:
DELETE /api/v1/faq/:id -
Response Data:
{ "message": "FAQ deleted successfully" }
-
Create Feedback:
- Endpoint:
POST /api/v1/feedbacks - Request Body (JSON):
{ "feedback": "Your feedback message here" } - Response Data (JSON):
{ "id": "generated-feedback-id", "feedback": "Your feedback message here", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Get Feedbacks by User:
- Endpoint:
GET /api/v1/feedbacks/user - Response Data (Array of JSON):
[ { "id": "feedback-id-1", "feedback": "Feedback message 1", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "feedback-id-2", "feedback": "Feedback message 2", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, ... ]
- Endpoint:
-
Get All Feedbacks:
- Endpoint:
GET /api/v1/feedbacks - Response Data (Array of JSON):
[ { "id": "feedback-id-1", "feedback": "Feedback message 1", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "feedback-id-2", "feedback": "Feedback message 2", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, ]
- Endpoint:
-
Get Single Feedback:
- Endpoint:
GET /api/v1/feedbacks/:id - Response Data (JSON):
{ "id": "feedback-id", "feedback": "Your feedback message", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Update Feedback:
- Endpoint:
PATCH /api/v1/feedbacks/:id - Request Body (JSON):
{ "feedback": "Updated feedback message" } - Response Data (JSON):
{ "id": "feedback-id", "feedback": "Updated feedback message", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Delete Feedback:
- Endpoint:
DELETE /api/v1/feedbacks/:id - Response Data (JSON):
{ "message": "Feedback deleted successfully" }
- Endpoint:
-
Create Page:
- Endpoint:
POST /api/v1/pages - Request Body: JSON with page details
{ "title": "Sample Page", "content": "This is a sample page content." } - Response Data: JSON with created page details
{ "id": "generated-id", "title": "Sample Page", "content": "This is a sample page content.", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Get Pages:
- Endpoint:
GET /api/v1/pages - Response Data: JSON array with all pages
[ { "id": "page-id-1", "title": "Page 1", "content": "Content of Page 1", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "page-id-2", "title": "Page 2", "content": "Content of Page 2", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, // ... additional pages ]
- Endpoint:
-
Get Single Page:
- Endpoint:
GET /api/v1/pages/:id - Response Data: JSON with details of the requested page
{ "id": "page-id", "title": "Sample Page", "content": "This is a sample page content.", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Update Page:
- Endpoint:
PATCH /api/v1/pages/:id - Request Body: JSON with updated page details
{ "title": "Updated Page Title", "content": "Updated page content." } - Response Data: JSON with updated page details
{ "id": "page-id", "title": "Updated Page Title", "content": "Updated page content.", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Delete Page:
- Endpoint:
DELETE /api/v1/pages/:id - Response Data: JSON with a success message
{ "message": "Page deleted successfully." }
- Endpoint:
-
Get Pages by User:
- Endpoint:
GET /api/v1/pages/user - Response Data: JSON array with pages associated with the authenticated user
[ { "id": "page-id-1", "title": "Page 1", "content": "Content of Page 1", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "page-id-2", "title": "Page 2", "content": "Content of Page 2", "userId": "user-id", "createdAt": "timestamp", "updatedAt": "timestamp" }, // ... additional pages ]
- Endpoint:
-
Add a Subscriber
- Endpoint:
POST /api/v1/subscribers - Request Data:
{ "email": "subscriber@example.com" } - Response Data:
{ "id": "generated-uuid", "email": "subscriber@example.com", "createdAt": "timestamp", "updatedAt": "timestamp" }
- Endpoint:
-
Send Email to Subscribers
- Endpoint:
POST /api/v1/subscribers/send - Request Data:
{ "subject": "Your Subject", "message": "Your Message" } - Response Data:
{ "message": "Email sent successfully to subscribers." }
- Endpoint:
-
Get Subscribers
- Endpoint:
GET /api/v1/subscribers - Response Data:
[ { "id": "subscriber-id-1", "email": "subscriber1@example.com", "createdAt": "timestamp", "updatedAt": "timestamp" }, { "id": "subscriber-id-2", "email": "subscriber2@example.com", "createdAt": "timestamp", "updatedAt": "timestamp" }, // ... other subscribers ]
- Endpoint:
-
Delete a Subscriber
- Endpoint:
DELETE /api/v1/subscribers/:id - Response Data:
{ "message": "Subscriber deleted successfully." }
- Endpoint:
Explore the powerful features of GreenEcovents Back End that make event management a breeze:
-
π Custom Authentication with JWT: Secure your application with a custom authentication system using JSON Web Tokens (JWT). Keep your user data safe and sound.
-
π‘οΈ Role-Based Access Control: Implement granular control over user permissions with Role-Based Access Control (RBAC). Define who can do what within your application.
-
π Event Management API: Effortlessly handle events with a robust API. Create, update, and retrieve event data seamlessly, providing a smooth experience for users.
-
π€ User Management API: Manage users effortlessly with a dedicated API. Handle user registration, login, and profile management with ease.
-
π Content Management API: Take control of dynamic content with a powerful Content Management API. Update and manage your application content dynamically.
-
π¬ Subscriber Management API: Build and maintain your subscriber base with a dedicated API. Streamline communication with event updates and newsletters.
-
π§ Email Sending Capability: Enhance user engagement by incorporating email notifications. Keep users informed about upcoming events and important updates.
-
π Additional Features (New!):
-
Real-time Notifications: Keep users informed in real-time with instant notifications for important events and updates.
-
Analytics Dashboard: Gain insights into user interactions and event performance with a comprehensive analytics dashboard.
-
Localization Support: Expand your user base globally with localization support. Provide a seamless experience in multiple languages.
-
Advanced Search Functionality: Allow users to find events effortlessly with an advanced search feature. Improve user experience and satisfaction.
-
Integration with Third-Party Services: Seamlessly integrate with external services to enhance functionality and provide a richer user experience.
-
Explore the powerful technologies that drive GreenEcovents Back End, carefully chosen for their efficiency and reliability:
- π» TypeScript - A statically typed superset of JavaScript, enhancing code quality and developer productivity.
- π Node.js - The runtime environment that enables server-side JavaScript execution, ensuring scalability and performance.
- β‘ Express.js - A fast and minimalist web framework for Node.js, simplifying the development of robust APIs and web applications.
- π PostgreSQL - An advanced open-source relational database management system, providing data integrity and extensibility.
- π Prisma - A modern database toolkit that simplifies database access and management through type-safe queries.
- π Zod - A TypeScript-first schema declaration and validation library, ensuring data integrity throughout the application.
- π JWT (JSON Web Token) - A compact, URL-safe means of representing claims between two parties, commonly used for secure user authentication.
- π GraphQL - A query language and runtime for APIs, offering a more efficient and powerful alternative to traditional REST.
- π¦ Docker - Containerization platform for automating the deployment of applications, ensuring consistency across various environments.
- π‘οΈ Helmet - A security m iddleware for Express.js, adding essential HTTP headers to protect against common web vulnerabilities.
- π Redis - An in-memory data structure store, often used as a caching mechanism for improved performance.
- π§ SendGrid - A cloud-based email service for reliable and scalable email delivery.
These technologies collectively empower GreenEcovents Back End to deliver a secure, performant, and feature-rich experience.
-
Clone this repository:
git clone https://github.com/Hamed-Hasan/event-management-backend.git
-
Navigate to the project directory:
cd event-management-backend -
Install dependencies:
yarn install
-
Configure your database settings in the
.envfile -
Run database migrations:
yarn prisma migrate dev
-
Start the server:
yarn dev
Make sure to configure the necessary environment variables in a .env file based on the provided .env.example.
As the sole developer behind this project, contributions are not currently accepted. However, feel free to open issues for bug reports or feature requests.
Happy coding!
