Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jagthefriend/backend-developer-assignment
This is a basic backend service to manage retreat data for a fictional wellness retreat platform built with Flask and SQLAlchemy.
https://github.com/jagthefriend/backend-developer-assignment
assignment flask flask-api flask-sqlalchemy python3
Last synced: about 2 months ago
JSON representation
This is a basic backend service to manage retreat data for a fictional wellness retreat platform built with Flask and SQLAlchemy.
- Host: GitHub
- URL: https://github.com/jagthefriend/backend-developer-assignment
- Owner: JagTheFriend
- License: cc0-1.0
- Created: 2024-07-25T06:02:50.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-27T05:56:51.000Z (6 months ago)
- Last Synced: 2024-07-27T08:25:53.544Z (6 months ago)
- Topics: assignment, flask, flask-api, flask-sqlalchemy, python3
- Language: Python
- Homepage: https://backend-developer-assignment.up.railway.app/
- Size: 164 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Backend Developer Assignment
## Description
This is a basic backend service to manage retreat data for a fictional wellness retreat platform built with Flask and SQLAlchemy.
## Using the API
### Retreats
Fetch all retreats:
```bash
curl -X GET http://localhost:5000/retreats
```Filter retreats by tag:
```bash
curl -X GET http://localhost:5000/retreats?filter=Stress
```Filter retreats by title:
```bash
curl -X GET http://localhost:5000/retreatstitle=Yoga%20Event%2019
```Filter retreats by type:
```bash
curl -X GET http://localhost:5000/retreats?type=Signature
```Filter retreats by duration:
```bash
curl -X GET http://localhost:5000/retreats?duration=3
```Filter retreats by location:
```bash
curl -X GET http://localhost:5000/retreats?location=Mumbai
```Search retreats:
```bash
curl -X GET http://localhost:5000/retreats?search=Fitness
```Pagination Example:
```bash
curl -X GET http://localhost:5000/retreats?page=2&limit=3
```### Booking for a retreat
Create a booking:
```bash
curl -X POST -H "Content-type: application/json" -d '{
"user_id": "1232",
"user_name": "Jag",
"user_email": "[email protected]",
"user_phone": "445678",
"retreat_id": "1232",
"retreat_title": "Hello",
"retreat_location": "Pune",
"retreat_price": "250",
"retreat_duration": "3",
"payment_details": "details",
"booking_date": "1233"
}' 'http://localhost:5000/book'
```Delete a booking:
```bash
curl -X DELETE http://localhost:5000/book/delete?id=1234
```#### Business Logic
- It allows user to book multiple retreats
- It doesn't allow user to double book the same retreat## Tech Stack
- [Flask](https://flask.palletsprojects.com/en/3.0.x/): To run the web application (API)
- [SQLAlchemy](https://flask-sqlalchemy.palletsprojects.com/en/3.1.x/): To interact with the database
- [PostgreSQL](https://www.postgresql.org/): Database in use## Running the application
### Docker
To simply run the application, you can use the following command:
```bash
docker compose up
```This will start the application on port 5000.\
You can access the application by navigating to in your web browser.### Manually
1. Clone the repository
2. Run `pip install poetry`
3. Install the dependencies `poetry install`
4. Run the application `python main.py`You can access the application by navigating to in your web browser.
### Replit
[![Run on Replit](https://replit.com/badge/github/jagtah/backend-developer-assignment)](https://replit.com/@JagTheFriend/Backend-Developer-Assignment)
## Testing
You can run the tests using the following command:
```bash
python -m unittest test/__init__.py
```