-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
730 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
title: Energize Swap Backend API | ||
--- | ||
|
||
# Energize Swap Backend API | ||
|
||
The Energize Swap Backend API is a RESTful API designed to manage battery swapping operations for electric vehicles. It provides endpoints for creating and managing drivers, batteries, swap stations, and battery swaps. | ||
|
||
## Features | ||
|
||
- **Driver Management:** Register new drivers and retrieve driver information. | ||
- **Battery Management:** Add batteries, track battery locations, and monitor battery status. | ||
- **Swap Station Management:** Create and manage swap stations, including their locations and available batteries. | ||
- **Battery Swap Operations:** Perform battery swaps by associating a driver with a battery and a swap station. | ||
|
||
## Technologies Used | ||
|
||
- **Python:** The backend is implemented in Python, utilizing the Flask framework. | ||
- **SQLAlchemy:** The database is managed using SQLAlchemy, an Object-Relational Mapping (ORM) library. | ||
- **MySql:** The default database is MySql, but it can be easily switched to other supported databases. | ||
- **RESTful API:** The API follows RESTful principles, allowing easy integration with frontend and mobile applications. | ||
- **Docker:** The project includes a Docker Compose configuration for easy deployment. | ||
|
||
## Installation and Setup | ||
|
||
To set up the Energize Swap Backend API, follow these steps: | ||
|
||
1. Clone the repository: `git clone https://github.com/your/repo.git` | ||
2. Install the required dependencies: `pip install -r requirements.txt` | ||
3. Set up the database: `python manage.py db upgrade` | ||
4. Start the development server: `python app.py` | ||
|
||
The API will be accessible at `http://localhost:5000`. | ||
|
||
## API ENDPOINTS | ||
|
||
| Ressource URL | Methods | Description | Authentication required | | ||
| -------------------------------- | ------- | ----------------------------------------------- | ----------------------- | | ||
| /api/v1/batteries | GET | Get a list of all batteries | Yes | | ||
| /api/v1/batteries/addbattery | POST | Create a new battery | Yes | | ||
| /api/v1/drivers | GET | GET a list of drivers | Yes | | ||
| /api/v1/drivers/addriver | POST | Create a new driver | Yes | | ||
| /api/v1/stations | GET | Get a list of stations | No | | ||
| /api/v1/stations/addstation | POST | Create a new Station | Yes | | ||
| /api/v1/stations/batteries | GET | Get all batteries of a specific stations | Yes | | ||
| /api/v1/swaps | GET | Get a list of all battery exchange | Yes | | ||
| /api/v1/swaps/addswap | POST | Create a new battery exchange | Yes | | ||
| /api/v1/swaps/stopswap/<swap_id> | PUT | Modify/Edit a specific swap to finish it | Yes | | ||
| /api/v1/swaps/totalswappedbattery| GET | Get a list of total battery exchanged | Yes | | ||
| /api/v1/swaps/<swap_id> | GET | Get information of one battery exchange | Yes | | ||
| /api/v1/movements/<serial_number>| POST | Update the movement of an active battery | Yes | | ||
| /api/v1/login | POST | Authentication | No | | ||
|
||
## Deployment | ||
|
||
The Energize Swap Backend API can be deployed to various environments, such as local servers, cloud platforms, or containerized environments. The project includes a Docker Compose configuration file that simplifies the deployment process. | ||
|
||
To deploy using Docker Compose, follow these steps: | ||
|
||
1. Install Docker and Docker Compose. | ||
2. Build the Docker image: `docker-compose build` | ||
3. Start the Docker containers: `docker-compose up -d` | ||
|
||
The API will be accessible at `http://localhost:5000`. | ||
|
||
## Contributing | ||
|
||
Contributions to the Energize Swap Backend API project are welcome! If you find any issues or have suggestions for improvements, please create an issue or submit a pull request. Make sure to follow the project's code style and guidelines. | ||
|
||
## License | ||
|
||
The Energize Swap Backend API is released under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute the code for both commercial and non-commercial purposes. See the `LICENSE` file for more details. | ||
|
||
## Acknowledgments | ||
|
||
This project was developed as part of the Energize Swap initiative to promote electric vehicle adoption and provide efficient battery swapping services. We would like to thank all the contributors and supporters who have made this project possible. | ||
|
||
For any inquiries or further information, please contact [Project Team Email]. |
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
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,66 @@ | ||
--- | ||
title: Energize Swap Frontend | ||
--- | ||
|
||
# Energize Swap Frontend | ||
|
||
The Energize Swap Frontend is a user interface built using modern web technologies to interact with the Energize Swap Backend API. It provides a user-friendly interface for managing drivers, batteries, swap stations, and battery swaps. | ||
|
||
## Features | ||
|
||
- **Driver Management:** Register new drivers, view driver information, and update driver details. | ||
- **Battery Management:** Add new batteries, track battery locations, and monitor battery status. | ||
- **Swap Station Management:** Create and manage swap stations, view station details, and assign batteries to stations. | ||
- **Battery Swap Operations:** Perform battery swaps, initiate battery movement, and track ongoing and completed swaps. | ||
|
||
## Technologies Used | ||
|
||
- **React:** The frontend is developed using the React library, providing a component-based architecture for building user interfaces. | ||
- **Redux:** Redux is used for state management, enabling efficient data flow and synchronization with the backend API. | ||
- **React Router:** React Router is utilized for client-side routing, allowing seamless navigation between different pages and components. | ||
- **Fetch:** Fetch is used for making HTTP requests to the backend API, facilitating data retrieval and modification. | ||
- **@mui/material:** Material UI is employed for styling and theming the frontend components, providing an aesthetic and responsive design. | ||
|
||
## Installation and Setup | ||
|
||
To set up the Energize Swap Frontend, follow these steps: | ||
|
||
1. Clone the repository: `git clone https://github.com/your/repo.git` | ||
2. Install the required dependencies: `yarn install` | ||
3. Configure the backend API endpoint: Update the API endpoint in the configuration file (`src/config.js`) to match your backend server address. | ||
4. Start the development server: `yarn start` | ||
|
||
The frontend will be accessible at `http://localhost:5173`. | ||
|
||
## Folder Structure | ||
|
||
The frontend project follows a modular folder structure, allowing easy organization and maintenance of the codebase. Here's an overview of the main folders: | ||
|
||
- `src/components`: Contains reusable UI components used throughout the application. | ||
- `src/pages`: Contains the main application pages, each representing a specific route. | ||
- `src/redux`: Includes Redux actions, reducers, and store configuration for managing application state. | ||
- `src/services`: Contains service modules for interacting with the backend API. | ||
- `src/configs`: Includes utility functions and helper modules used across the application. | ||
- `src/routes`: Contains configuration for all pages routes | ||
|
||
## Deployment | ||
|
||
The Energize Swap Frontend can be deployed to various hosting platforms or integrated into existing web applications. It's recommended to build the production version of the frontend before deployment. | ||
|
||
To build the production version, run: `npm run build` | ||
|
||
This command will generate optimized and minified static files in the `build` directory. You can then deploy these files to a static file server or integrate them with your backend server. | ||
|
||
## Contributing | ||
|
||
Contributions to the Energize Swap Frontend project are welcome! If you encounter any issues or have suggestions for improvements, please create an issue or submit a pull request. Make sure to follow the project's coding style and guidelines. | ||
|
||
## License | ||
|
||
The Energize Swap Frontend is released under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute the code for both commercial and non-commercial purposes. See the `LICENSE` file for more details. | ||
|
||
## Acknowledgments | ||
|
||
This project was developed as part of the Energize Swap initiative to promote electric vehicle adoption and provide efficient battery swapping services. We extend our gratitude to all the contributors and supporters who have made this project possible. | ||
|
||
For any inquiries or further information, please contact [[email protected]]. |
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
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 @@ | ||
export const BASE_URL = 'http://localhost:5000/api/v1/' |
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
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
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
Oops, something went wrong.