GameBuddy Application Service is a microservice in the GameBuddy project. The service is built using Spring Java and provides a set of RESTful APIs to handle various functionalities related to user profiles, friends, achievements, marketplace, and more.
- Description: Retrieve user information by user ID.
- Request Header: Authorization (Bearer Token)
- Path Variable: userId (The ID of the user whose information is requested)
- Response: UserInfoResponse
- Description: Get the list of keywords (interests).
- Response: KeywordsResponse
- Description: Get the list of games available on the platform.
- Response: GamesResponse
- Description: Get detailed information about a specific game.
- Request Header: Authorization (Bearer Token)
- Path Variable: gameId (The ID of the game)
- Response: GameResponse
- Description: Get a list of popular games on the platform.
- Response: GamesResponse
- Description: Get the list of available avatars for the user.
- Request Header: Authorization (Bearer Token)
- Response: AvatarsResponse
- Description: Get the list of achievements earned by the user.
- Request Header: Authorization (Bearer Token)
- Response: AchievementResponse
- Description: Collect an achievement by its ID.
- Request Header: Authorization (Bearer Token)
- Path Variable: achievementId (The ID of the achievement to be collected)
- Response: DefaultMessageResponse
- Description: Get the list of items available in the marketplace.
- Response: MarketplaceResponse
- Description: Purchase an item from the marketplace by its ID.
- Request Header: Authorization (Bearer Token)
- Path Variable: itemId (The ID of the item to be purchased)
- Response: DefaultMessageResponse
- Description: Get the list of user's friends.
- Request Header: Authorization (Bearer Token)
- Response: FriendsResponse
- Description: Get the list of pending friend requests.
- Request Header: Authorization (Bearer Token)
- Response: FriendsResponse
- Description: Get the list of blocked friends.
- Request Header: Authorization (Bearer Token)
- Response: FriendsResponse
- Description: Accept a friend request from another user.
- Request Header: Authorization (Bearer Token)
- Request Body: FriendRequest
- Response: DefaultMessageResponse
- Description: Reject a friend request from another user.
- Request Header: Authorization (Bearer Token)
- Request Body: FriendRequest
- Response: DefaultMessageResponse
- Description: Remove a friend from the user's friend list.
- Request Header: Authorization (Bearer Token)
- Request Body: FriendRequest
- Response: DefaultMessageResponse
- Description: Block a friend from contacting the user.
- Request Header: Authorization (Bearer Token)
- Request Body: FriendRequest
- Response: DefaultMessageResponse
- Description: Unblock a blocked friend.
- Request Header: Authorization (Bearer Token)
- Request Body: FriendRequest
- Response: DefaultMessageResponse
- Description: Send a friend request to another user.
- Request Header: Authorization (Bearer Token)
- Request Body: FriendRequest
- Response: DefaultMessageResponse
-
Clone the GameBuddy Application Service repository from GitHub.
-
Open the project with your preferred IDE. (Use Gradle.)
-
Configure the necessary database and messaging services (e.g., PostgreSQL).
-
Update the application.yml file with the database credential and run the notification service. (Notification service is optional.)
-
Run the application using Gradle or your preferred IDE. (Initial port is 4567. You can change it from application.yml)
To build, test, and run the GameBuddy Application Service, you can use the following Gradle commands:
To clean the build artifacts and build the project, run:
./gradlew clean build
The built JAR file will be located in the build/libs/ directory.
To run the tests for your GameBuddy Application Service, you can use the following Gradle command:
./gradlew test
This command will execute all the unit tests in the project. The test results will be displayed in the console, indicating which tests passed and which ones failed.
Additionally, if you want to generate test reports, you can use the following command:
./gradlew jacocoTestReport
This will generate test reports using the JaCoCo plugin. The test reports can be found in the build/reports/tests and build/reports/jacoco directories. The JaCoCo report will provide code coverage information to see how much of your code is covered by the tests.
This project has Spotless rules. If the code is unformatted, building the project will generate error. To format the code according to the configured Spotless rules, run:
./gradlew spotlessApply
To perform a SonarQube analysis of the project, first, ensure you have SonarQube configured and running. Then, run:
./gradlew sonarqube
To run the GameBuddy Application Service locally using Gradle, use the following command:
./gradlew bootRun
This will start the service, and you can access the APIs at http://localhost:4567.
To containerize the GameBuddy Application Service using Docker, follow the steps below:
-
Make sure you have Docker installed on your system. You can download Docker from the official website: https://www.docker.com/get-started
-
Project already has a Dockerfile. Examine the Dockerfile in the root directory of the project. The Dockerfile define the container image configuration.
-
Build the Docker image using the Dockerfile. Open a terminal and navigate to the root directory of the project.
docker build -t gamebuddy-application-service .
This will create a Docker image with the name gamebuddy-application-service.
- Run the Docker container from the image you just built.
docker run -d -p 4567:4567 --name gamebuddy-application gamebuddy-application-service
This will start the GameBuddy Application Service container, and it will be accessible at http://localhost:4567.
This project is licensed under the MIT License.