ByteBookshelf is a backend API service supporting a niche online bookstore specializing in technology books.
This API provides user and credit card management functionalities to enhance the user experience, making it possible to securely create and update user profiles and store credit card information.
The ByteBookshelf API Service offers the following capabilities:
- User Profile Management - Users can create, retrieve, update, and delete their profiles.
- Credit Card Management - Users can add credit cards to their profiles for secure checkout.
- Java
- Spring Boot
- MySQL
- Maven (for dependency management)
The ByteBookshelf API provides RESTful endpoints for user profile and credit card management.
-
Create a User
- Endpoint:
/users
- HTTP Method:
POST
- Description: Adds a new user with username, password, and optional details (name, email, home address).
- Request Body:
{ "username": "string", "password": "string", "name": "string", "email": "string", "homeAddress": "string" }
- Response: The created
User
object.
- Endpoint:
-
Retrieve a User by Username
- Endpoint:
/users/{username}
- HTTP Method:
GET
- Description: Fetches a user by their username.
- Response:
{ "id": "integer", "username": "string", "password": "string", "name": "string", "email": "string", "homeAddress": "string" }
- Endpoint:
-
Update a User
- Endpoint:
/users/{username}
- HTTP Method:
PUT
- Description: Updates all user fields except for email.
- Request Body:
{ "username": "string", "password": "string", "name": "string", "email": "string", "homeAddress": "string" }
- Response: The updated
User
object (except email).
- Endpoint:
-
Partial Update a User
- Endpoint:
/users/{username}
- HTTP Method:
PATCH
- Description: Allows partial updates on user fields.
- Request Body: Partial
User
object with fields to update.{ "username": "string", "password": "string", "name": "string", "email": "string", "homeAddress": "string" }
- Response: The updated
User
object (except email).
- Response: The updated
- Endpoint:
-
Delete a User
- Endpoint:
/users/{username}
- HTTP Method:
DELETE
- Description: Deletes a user profile.
- Endpoint:
- Create a Credit Card for a User
- Endpoint:
/creditcards/{username}
- HTTP Method:
POST
- Description: Adds a credit card to a userโs profile.
- Request Body:
{ "cardNumber": "string", "cardHolderName": "string", "expirationDate": "string", "cvv": "string" }
- Response: The created
CreditCard
object.
- Endpoint:
-
Clone the repository:
git clone https://github.com/mariarodr1136/ByteBookshelf.git
-
Navigate to the project directory:
cd ByteBookshelf
-
Install dependencies using Maven:
mvn clean install
-
Configure MySQL Database in the application.properties file, setting the appropriate username, password, and database URL
-
Run the Application:
mvn spring-boot:run
With the API running, you can make requests to the endpoints as listed above. You can use tools like Postman to interact with the API and test each endpoint.
Feel free to submit issues or pull requests for improvements or bug fixes. You can also open issues to discuss potential changes or enhancements. All contributions are welcome to enhance the appโs features or functionality!
To contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feat/your-feature-name
- Alternatively, for bug fixes:
git checkout -b fix/your-bug-fix-name
- Make your changes and run all tests before committing the changes and make sure all tests are passed.
- After all tests are passed, commit your changes with descriptive messages:
git commit -m 'add your commit message'
- Push your changes to your forked repository:
git push origin feat/your-feature-name.
- Submit a pull request to the main repository, explaining your changes and providing any necessary details.
If you have any questions or feedback, feel free to reach out at mrodr.contact@gmail.com.