Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eunoia-scu/eunoia-api
Graduation Project
https://github.com/eunoia-scu/eunoia-api
cloudinary ec2 expressjs mongodb mongoose multer nodejs nodemailer paymob pug redis stripe
Last synced: 2 days ago
JSON representation
Graduation Project
- Host: GitHub
- URL: https://github.com/eunoia-scu/eunoia-api
- Owner: Eunoia-SCU
- License: other
- Created: 2024-07-17T19:09:02.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-17T19:19:23.000Z (5 months ago)
- Last Synced: 2024-11-13T17:32:09.953Z (about 1 month ago)
- Topics: cloudinary, ec2, expressjs, mongodb, mongoose, multer, nodejs, nodemailer, paymob, pug, redis, stripe
- Language: JavaScript
- Homepage: http://ec2-3-129-5-59.us-east-2.compute.amazonaws.com/api/v1/
- Size: 118 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Eunoia API
# ๐ซ Eunoia Project (Graduation Project)
Eunoia simplifies event planning by integrating services like venues, catering, and photography into a single platform. Accessible via app and web, it features AI-powered recommendations and secure booking.
## ๐ Eunoia API
This project offers APIs for efficient event planning, enabling access to service provider directories, booking services, and user account management. Built with Express.js and tested with Jest, it includes AI-powered recommendations and secure transactions to enhance user experience.
## ๐ Table of Contents
- [๐ Eunoia API](#-eunoia-api)
- [๐ Table of Contents](#-table-of-contents)
- [๐ Getting Started](#-getting-started)
- [๐ง Prerequisites](#-prerequisites)
- [๐ฆ Installation](#-installation)
- [๐ฅ๏ธ Running the Server](#๏ธ-running-the-server)
- [๐งช Running Tests](#-running-tests)
- [๐ API Documentation](#-api-documentation)
- [๐ฅ Authentication Endpoints](#-authentication-endpoints)
- [๐ Services Endpoints](#-services-endpoints)
- [๐ API Complete Docs](#-api-complete-Docs)
- [๐๏ธ Project Structure](#๏ธ-project-structure)
- [๐ License](#-license)## ๐ Getting Started
### ๐ง Prerequisites
Ensure you have the following installed:
- Node.js
- npm or yarn### ๐ฆ Installation
1. Clone the repository:
```bash
git clone https://github.com/your-username/Eunoia-Backend.git
cd Eunoia-Backend
```2. Install dependencies:
```bash
npm install
# or
yarn install
```### ๐ฅ๏ธ Running the Server
1. Start the development server :
```bash
npm run dev
# or
yarn dev
```2. The server should now be running at `http://localhost:3000`.
### ๐งช Running Tests
To run the test suite:
```bash
npm test
# or
yarn test
```## ๐ API Documentation
### ๐ฅ Authentication Endpoints
- **Endpoint:** `api/v1/auth/register`
- **Method:** `Post`
- **Body:**- `name` (string): user name
- `email` (string): user email
- `password` (string): user password
- `passwordConfirm` (string): user confirm password
- `role` (string): user role (user/serviceProvider)- **Example Request:**
```bash
curl "http://localhost:3000/api/v1/auth/register"
```- **Example Response:**
```json
[
{
"status": "success",
"token": "JWT TOKEN"
}
]
```- **Endpoint:** `api/v1/auth/login`
- **Method:** `Post`
- **Body:**- `email` (string): user email
- `password` (string): user password- **Example Request:**
```bash
curl "http://localhost:3000/api/v1/auth/login"
```- **Example Response:**
```json
[
{
"status": "success",
"token": "JWT TOKEN"
}
]
```- **Endpoint:** `api/v1/auth/logout`
- **Method:** `Post`
- **Body:**- empty
- **Example Request:**
```bash
curl "http://localhost:3000/api/v1/auth/logout"
```- **Example Response:**
```json
[
{
"status": "success"
}
]
```- **Endpoint:** `api/v1/auth/forgotPassword`
- **Method:** `Post`
- **Body:**- `email` (string): user email
- **Example Request:**
```bash
curl "http://localhost:3000/api/v1/auth/forgotPassword"
```- **Example Response:**
```json
[
{
"status": "Success",
"message": "Reset code sent to email"
}
]
```- **Endpoint:** `api/v1/auth/forgotPassword`
- **Method:** `Post`
- **Body:**- `otp` (number): The code sent to the email
- **Example Request:**
```bash
curl "http://localhost:3000/api/v1/auth/verfiyCode"
```- **Example Response:**
```json
[
{
"status": "Success",
"messgae": "Your Code has been successfully verified. You can now proceed to reset your password."
}
]
```- **Endpoint:** `api/v1/auth/resetPassword`
- **Method:** `Patch`
- **Body:**- `email` (string): your email
- `newPassword` (string): your new password- **Example Request:**
```bash
curl "http://localhost:3000/api/v1/auth/resetPassword"
```- **Example Response:**
```json
[
{
"status": "success",
"token": "JWT TOKEN"
}
]
```### ๐ Services Endpoints
- **Endpoint:** `api/v1/services`
- **Method:** `POST`
- **Body:**- `businessName` (String)
- `about` (string)
- `location` (string)
- `businessCategory` (string)
- `phoneNumber` (number)
- `avatar` (FormData)
- `images` (FormData):array of images
- `imageCover`(FormData)- **Example Request:**
```bash
curl "http://127.0.0.1:3000/api/v1/services/"
```- **Example Response:**
```json
{
"status": "success",
"message": "Service Profile created successfully",
"data": {
"_id": "660878526adb0cb6ece59904",
"businessName": "The Garden",
"about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.",
"location": "Ismailia",
"businessCategory": "Venues",
"phoneNumber": "01234567890",
"avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg",
"imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg",
"images": [
"http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg"
],
"owner": "660860be6adb0cb6ece598fe",
"createdAt": "2024-03-30T20:38:43.001Z",
"updatedAt": "2024-06-21T13:32:59.867Z",
"ratingsAverage": 4,
"ratingsQuantity": 2,
"id": "660878526adb0cb6ece59904"
}
}
```- **Endpoint:** `api/v1/services`
- **Method:** `GET`
- **Query Parameters:**- `page` (number): the number of page you want to return.
- `limit` (number): the number of document you want to return in the page.
- `sort` (string): (ratingsQuantity|ratingsAverage|updatedAt|updatedAt)
- `limitFields` (string): name of field you want to return in the response (\_id|businessName|about|location|businessCategory|phoneNumber|images|owner|ratingsQuantity|ratingsAverage)
- `ratingsAverage` return the services which have ratingsAverage[gte(greater than or equal) || gt(greater than) || ls(less than ) || lte(less than or equal) ]:(number)
- `sort` (field name): sort by filed name like ratingsAverage or ratingsquantity- **Example Request:**
```bash
curl "http://127.0.0.1:3000/api/v1/services/?page=2&limit=5&ratingsAverage[gte]=4.3&filter=DJs&sort=createdAt"
```- **Example Response:**
```json
{
"results": 7,
"paginationResult": {
"currntPage": 1,
"limit": 50,
"numberOfPages": 1
},
"data": [
{
"_id": "660878526adb0cb6ece59904",
"businessName": "The Garden",
"about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.",
"location": "Ismailia",
"businessCategory": "Venues",
"phoneNumber": "01234567890",
"avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg",
"imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg",
"images": [
"http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg"
],
"owner": "660860be6adb0cb6ece598fe",
"createdAt": "2024-03-30T20:38:43.001Z",
"updatedAt": "2024-06-21T13:32:59.867Z",
"ratingsAverage": 4,
"ratingsQuantity": 2,
"id": "660878526adb0cb6ece59904"
}
// more services ...
]
}
```- **Endpoint:** `api/v1/services/:id`
- **Method:** `GET`
- **Query params:**- `id` (mongoID): mongoId of exist document
- **Example Request:**
```bash
curl "http://127.0.0.1:3000/api/v1/services/660878526adb0cb6ece59904"
```- **Example Response:**
```json
{
"data": {
"_id": "660878526adb0cb6ece59904",
"businessName": "The Garden",
"about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.",
"location": "Ismailia",
"businessCategory": "Venues",
"phoneNumber": "01234567890",
"avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg",
"imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg",
"images": [
"http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg",
"http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673192/Albums/serviceProfile/Albums0-2e6d3f3e-c654-4fc2-a0f0-64ab474406dc.jpg"
],
"owner": "660860be6adb0cb6ece598fe",
"createdAt": "2024-03-30T20:38:43.001Z",
"updatedAt": "2024-06-21T13:32:59.867Z",
"__v": 5,
"ratingsAverage": 4,
"ratingsQuantity": 2,
"reviews": [
{
"_id": "662aa6131bef1b61ca7c3e8e",
"title": "amazing service\n",
"ratings": 3,
"user": {
"_id": "6612f57ad4ff84c0ed4acced",
"name": "omar ",
"avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1713651559/avatar.jpg"
},
"service": "660878526adb0cb6ece59904",
"createdAt": "2024-04-25T18:50:59.017Z",
"updatedAt": "2024-04-25T18:50:59.017Z",
"__v": 0
},
{
"_id": "6675810af4e1130ec348b254",
"title": "",
"ratings": 5,
"user": {
"_id": "6674a92b8217a177b6921aa0",
"name": "Ali Nour",
"avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1718922031/ProfilePicture/avatar/7219325b-667c-47db-a7f1-b25128955cc0.jpg"
},
"service": "660878526adb0cb6ece59904",
"createdAt": "2024-06-21T13:32:58.550Z",
"updatedAt": "2024-06-21T13:32:58.550Z",
"__v": 0
}
],
"packages": [],
"id": "660878526adb0cb6ece59904"
}
}
```- **Endpoint:** `api/v1/services/:id`
- **Method:** `DELETE`
- **Query params:**- `id` (mongoID): mongoId of exist document (You should be the owner of the service to delete it)
- **Example Request:**
```bash
curl "http://127.0.0.1:3000/api/v1/services/660878526adb0cb6ece59904"
```- **Example Response:**
```json
{}
```- **Endpoint:** `api/v1/services/:id`
- **Method:** `PATCH`
- **Query params:**- `id` (mongoID): mongoId of exist document (You should be the owner of the service to delete it)
- **Body:**
- `businessName`:(String)
- `about`:(String)
- `images`:(formData)
- `location`:(String)
- `businessCategory`:(String)
- `phoneNumber`:(number)
- `avatar`:(formData)
- `imageCover`:(formData)
- `latitude`:(number)
- `longitude`:(number)
- **Example Request:**```bash
curl "http://127.0.0.1:3000/api/v1/services/660878526adb0cb6ece59904"
```- **Example Response:**
```json
{
"data": {
"_id": "660878526adb0cb6ece59904",
"businessName": "The Garden",
"about": "The Garden features three main spaces for your wedding day: a Rooftop Terrace with a picturesque views of Bryant Park, the Grill Dining Room, and the South Garden. The terrace is best suited for your wedding ceremony and can accommodate up to 220 guests. The restaurant can host a seated dinner for up to 220 guests. For couples interested in booking the full venue, up to 1,000 guests can be serviced.",
"location": "Ismailia",
"businessCategory": "Venues",
"phoneNumber": "01234567890",
"avatar": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1711831118/avatar.jpg",
"imageCover": "http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673495/CoverImages/serviceProfile/cb13896a-1d0c-4d66-b7e0-9334a9c4cc37.jpg",
"images": [
"http://res.cloudinary.com/dbrywi5aw/image/upload/v1714669784/Albums/serviceProfile/Albums0-10974f93-dd59-435f-9c34-a15e14e0dcff.jpg",
"http://res.cloudinary.com/dbrywi5aw/image/upload/v1714673192/Albums/serviceProfile/Albums0-2e6d3f3e-c654-4fc2-a0f0-64ab474406dc.jpg"
],
"__v": 5,
"ratingsAverage": 4,
"ratingsQuantity": 2
}
}
```### ๐ API Complete Docs
_You can see all API docs [here](http://ec2-3-129-5-59.us-east-2.compute.amazonaws.com/api/v1/)_
```
- Postman Docs will be avaliable soon.
```## ๐๏ธ Project Structure
```
Here's the project structure based on the provided image:eunoia-backend/
โโโ **tests**/
โ โโโ service.test.js
โโโ src/
โ โโโ config/
โ โ โโโ db.js
โ โโโ controllers/
โ โ โโโ authController.js
โ โ โโโ errorController.js
โ โ โโโ handelFactory.js
โ โ โโโ orderController.js
โ โ โโโ reviewController.js
โ โ โโโ serviceController.js
โ โ โโโ userController.js
โ โ โโโ packageController.js
โ โ โโโ requestController.js
โ โ โโโ wishlistController.js
โ โโโ middlewares/
โ โ โโโ uploadImageMiddleware.js
โ โ โโโ emailMiddleware.js
โ โ โโโ validatorMiddleware.js
โ โ โโโ verifyPaymobRequest.js
โ โโโ models/
โ โ โโโ orderModel.js
โ โ โโโ packageModel.js
โ โ โโโ requestModel.js
โ โ โโโ reviewModel.js
โ โ โโโ serviceModel.js
โ โ โโโ userModel.js
โ โโโ routes/
โ โ โโโ authRoutes.js
โ โ โโโ orderRoutes.js
โ โ โโโ packageRoutes.js
โ โ โโโ requestRoutes.js
โ โ โโโ reviewRoutes.js
โ โ โโโ serviceRoutes.js
โ โ โโโ userRoutes.js
โ โ โโโ welcomeRoutes.js
โ โ โโโ wishlistRoutes.js
โ โโโ utils/
โ โ โโโ paymob/
โ โ โ โโโ authenticate.js
โ โ โ โโโ checkout.js
โ โ โโโ validators/
โ โ โ โโโ packageValidator.js
โ โ โ โโโ requestValidator.js
โ โ โ โโโ reviewValidator.js
โ โ โ โโโ serviceValidator.js
โ โ โโโ apiFeatures.js
โ โ โโโ appError.js
โ โ โโโ catchAsync.js
โ โ โโโ cloudinary.js
โ โ โโโ createToken.js
โ โ โโโ logger.js
โ โ โโโ paymob.js
โ โ โโโ redis.js
โ โโโ app.js
โ โโโ server.js
โโโ views/
โ โโโ email/
โ โ โโโ \_style.pug
โ โ โโโ baseEmail.pug
โ โ โโโ passwordChanged.pug
โ โ โโโ passwordReset.pug
โ โ โโโ requestAccepted.pug
โ โ โโโ requestDecline.pug
โ โ โโโ welcome.pug
โ โโโ index.pug
โโโ .env
โโโ app.js
โโโ server.js
โโโ .gitignore
โโโ package.json
โโโ README.md```
## ๐ License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
---
This README provides a comprehensive guide for setting up, running, and testing the project, as well as detailed API documentation and project structure information.
# Worked on this Project
ยฉ [Ali Nour](https://github.com/alin00r) ยฉ [Mazen](https://github.com/mazenmohamedmahmoudatia666) ยฉ [Kareem](https://github.com/karemhamed)