Please install the following to have this run locally:
-
Maven 3.9.5: https://maven.apache.org/download.cgi Follow exact instructions as the site provides.
-
JDK 17: This is what was used to implement the service, please make sure you use this JDK version as well: https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
-
Visual Studio Code: I used Visual Studio Code to implement the test cases and and run all command until deployment inclusive: https://code.visualstudio.com/download
-
Clone the Repository: This can be done from the startup of the VSCode window in the start display where it says clone Git Repository. You will be prompted to sign in into Github. Once signed in, copy and paste this url: https://github.com/cazuike/Smart-Programming-Baddies.git into the search box. Similar results are achieved in IntelliJ.
The .env file that is used for compilation and that contains the secret keys needs to be under serviceSPB/
bag2158@columbia.edu eam2316@columbia.edu ca2970@columbia.edu jam2509@columbia.edu- Start up Local Instance: Navigate to the serviceSPB Directory. Once there, run the following command:
mvn spring-boot:run
- Use Instance: The service can be used via a web browser or Postman with the index route of: http://127.0.0.1:8080/
All the endpoints are listed below, you can see all of their descriptions and what they are expected to do.
Tests are found under the serviceSPB/src/test directory. Once all the above requirements have been met, you can run our test with the following commands:
To run the tests provided in this project, run the following command in the serviceSPB directory:
mvn test
Result will be under serviceSPB/target/surefire-reports
A test Food Pantry app was created to do end-to-end testing for this service. The repository is located here: Link
Below is our team's project JIRA board: Link
We could not complete the Volunteer and Donations Logging that we proposed in our proposal
Our Deployed app can be found here: Link
To run the Jacoco Code Coverage test, run the following command in the serviceSPB directory:
mvn jacoco:report
The results are located here: serviceSPB/target/site/jacoco/index.html. Open this HTML file in your preferred web browser to see the Jacoco report with a nice UI.
To run the Maven style checker, run the following command in the serviceSPB directory:
mvn checkstyle:check
The result are located here: serviceSPB/target/checkstyle-result.xml
The CI reports can be found under: Link Click on any of the workflow runs and the files will be located under Artifacts for 90 days since ran.
Must have PMD installed. Please refer to the PMD website to receive instructions on how to install PMD. link
-
Once installed, Nagivate to the src folder within the serviceSPB directory.
-
Run the following command:
mvn pmd:check
- Results are located here: serviceSPB/target/pmd.xml.
1. Generate API Key Generates a new, unique API key for the client to use in requests to other services.
URL: /generateApiKey Method: GET Response: Success (200): A message containing the generated API key. Error (500): A message indicating the API key could not be generated.
2. Verify API Key Verifies if the provided API key exists in the database and is valid for use.
URL: /verifyApiKey Method: GET Query Parameters: apiKey (required): The API key to verify. Response: Success (200): A message indicating the API key is valid. Error (404): A message indicating the API key is not found.
3. Remove API Key Removes the specified API key from the database.
URL: /removeApiKey Method: DELETE Query Parameters: apiKey (required): The API key to remove. Response: Success (200): A message indicating the API key was removed. Error (500): A message indicating the API key could not be removed.
Error Handling 500 Internal Server Error: This status is returned when there is a failure during the API key generation or removal process. 404 Not Found: This status is returned when an API key could not be found in the database during verification.
1. Homepage Redirects users to the homepage of the system, providing a welcome message.
URL: /, /index, /home Method: GET Response: Success (200): Returns a welcome message indicating successful redirection to the homepage.
1. Enroll Volunteer Enrolls a volunteer into the system, associating the volunteer with the client identified by the provided API key.
URL: /enrollVolunteer Method: PATCH Query Parameters: apiKey (required): A valid API key provided by the client. name (required): The name of the volunteer being enrolled. Response: Success (200): A message containing the enrolled volunteer's ID. Error (404): A message indicating an invalid API key. Error (500): A message indicating an internal error occurred during enrollment.
2. Remove Volunteer Removes a volunteer from the system based on the provided volunteer ID and the associated API key.
URL: /removeVolunteer Method: DELETE Query Parameters: apiKey (required): A valid API key provided by the client. volunteerId (required): The unique ID of the volunteer to be removed. Response: Success (200): A message indicating the volunteer was successfully removed. Error (404): A message indicating an invalid API key. Error (500): A message indicating an internal error occurred during the removal process.
3. Update Name Update name of an existing volunteer.
URL: /updateName Method: PATCH Query Parameters: apiKey (required): A valid API key provided by the client. volunteerId (required): The unique ID of the volunteer. Response: Success (200): A message indicating the volunteer name was successfully updated. Error (404): A message indicating an invalid API key. Error (500): A message indicating an internal error occurred during the removal process.
4. Update Schedule Update schedule of an existing volunteer.
URL: /updateSchedule Method: PATCH Query Parameters: apiKey (required): A valid API key provided by the client. volunteerId (required): The unique ID of the volunteer. Response: Success (200): A message indicating the volunteer schedule was successfully updated. Error (404): A message indicating an invalid API key. Error (500): A message indicating an internal error occurred during the removal process.
3. Update Role Update role of an existing volunteer.
URL: /updateRole Method: PATCH Query Parameters: apiKey (required): A valid API key provided by the client. volunteerId (required): The unique ID of the volunteer. Response: Success (200): A message indicating the volunteer role was successfully updated. Error (404): A message indicating an invalid API key. Error (500): A message indicating an internal error occurred during the removal process.
5. RetrieveVolunteer Retrieve pertinent information about a volunteer such as their schedule, name, role.
URL: /retrieveVolunteer Method: GET Query Parameters: apiKey (required): A valid API key provided by the client. volunteerId (required): The unique ID of the volunteer. Response: Success (200): A string message with the information of the volunteer. Error (404): A message indicating an invalid API key. Error (500): A message indicating an internal error occurred during the removal process.
1. Create Event Creates a new event in the system, associating the event with the client identified by the provided API key.
URL: /createEvent Method: POST Query Parameters:
- apiKey (required): A valid API key provided by the client.
- name (required): The name of the event being created.
- description (required): The description of the event.
- date (required): The date of the event.
- time (required): The time of the event.
- location (required): The location of the event.
- organizer (required): The organizer of the event.
Response:
- Success (200): A message containing the created event's ID.
- Error (404): A message indicating an invalid API key.
- Error (500): A message indicating an internal error occurred during event creation.
2. Add Volunteer to Event Associates a volunteer with an event.
URL: /addVolunteerToEvent Method: POST Query Parameters:
- apiKey (required): A valid API key for authentication.
- eventId (required): The ID of the event.
- volunteerId (required): The ID of the volunteer.
Response:
- Success (200): A message confirming the volunteer was added to the event.
- Error (404): A message indicating an invalid API key, event ID, or volunteer ID.
- Error (500): A message indicating an internal error occurred while adding the volunteer.
markdown Copy code
1. Create Event Creates a new event and adds it to the system, associating it with a storage center and optional volunteers.
URL: /createEvent Method: POST Query Parameters:
- apiKey (required): A valid API key for authentication.
- name (required): The name of the event.
- description (required): A description of the event.
- date (required): The date of the event (YYYY-MM-DD format).
- startTime (required): The event's start time (HH:mm format).
- endTime (required): The event's end time (HH:mm format).
- location (required): The event location.
- storageCenterId (required): The ID of the associated storage center.
- organizationId (optional): The ID of the associated organization (currently unused).
Response:
- Success (200): A message with the event ID on successful creation.
- Error (404): A message indicating an invalid API key or storage center ID.
- Error (500): A message indicating an internal error occurred during event creation.
2. Add Volunteer to Event Associates a volunteer with an event.
URL: /addVolunteerToEvent Method: POST Query Parameters:
- apiKey (required): A valid API key for authentication.
- eventId (required): The ID of the event.
- volunteerId (required): The ID of the volunteer.
Response:
- Success (200): A message confirming the volunteer was added to the event.
- Error (404): A message indicating an invalid API key, event ID, or volunteer ID.
- Error (500): A message indicating an internal error occurred while adding the volunteer.
3. List All Events Fetches a list of all events in the system.
URL: /listEvents Method: GET Query Parameters:
- apiKey (required): A valid API key for authentication.
Response:
- Success (200): A list of all events.
- Error (404): A message indicating an invalid API key.
- Error (500): A message indicating an internal error occurred while fetching the events.
4. Retrieve Event Fetches the details of a specific event.
URL: /retrieveEvent Method: GET Query Parameters:
- apiKey (required): A valid API key for authentication.
- eventId (required): The ID of the event to retrieve.
Response:
- Success (200): Event details.
- Error (404): A message indicating an invalid API key or event ID.
- Error (500): A message indicating an internal error occurred while fetching the event.
5. Remove Event Deletes an event from the system.
URL: /removeEvent Method: DELETE Query Parameters:
- apiKey (required): A valid API key for authentication.
- eventId (required): The ID of the event to delete.
Response:
- Success (200): A confirmation message on successful deletion.
- Error (404): A message indicating an invalid API key or event ID.
- Error (500): A message indicating an internal error occurred during deletion.
6. Search Events by Date Fetches a list of events on a specified date.
URL: /searchEventsByDate Method: GET Query Parameters:
- apiKey (required): A valid API key for authentication.
- date (required): The date to search for events (YYYY-MM-DD format).
Response:
- Success (200): A list of events on the specified date.
- Error (404): A message indicating an invalid API key or no events found.
- Error (500): A message indicating an internal error occurred while searching for events.
7. Search Events by Location Fetches a list of events at a specified location.
URL: /searchEventsByLocation Method: GET Query Parameters:
- apiKey (required): A valid API key for authentication.
- location (required): The location to search for events.
Response:
- Success (200): A list of events at the specified location.
- Error (404): A message indicating an invalid API key or no events found.
- Error (500): A message indicating an internal error occurred while searching for events.
8. Retrieve Event Retrieves information of a specified event given by the event ID and the associated API key.
URL: /retrieveEvent Method: GET Query Parameters:
- apiKey (required): A valid API key provided by the client.
- eventId (required): The unique ID of the event to be retrieved.
Response:
- Success (200): A message containing the event information.
- Error (404): A message indicating an invalid API key.
- Error (500): A message indicating an internal error occurred during event retrieval.
URL: /createCenter
Method: POST
Query Parameters:
name
(required): A string representing the storage center's name.description
(required): A string representing the storage center's description.
Response:
String
(200): The ID of the storage center if created successfully.String
(500): An error message if an internal server error occurred.String
(400): An error message if any parameter is incorrectly formatted.
URL: /getCenterInfo
Method: GET
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.
Response:
StorageCenter
(200): The details of the storage center.String
(500): An error message if an internal server error occurred.String
(404): An error message if the storage center ID was not found.
URL: /deleteCenter
Method: DELETE
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.
Response:
String
(200): A message confirming the storage center was successfully deleted.String
(500): An error message if an internal server error occurred.String
(404): An error message if the storage center ID was not found.
URL: /updateCenterName
Method: PATCH
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.name
(required): A string representing the new name of the storage center.
Response:
String
(200): A message confirming the storage center's name was updated.String
(500): An error message if an internal server error occurred.String
(400): An error message if any parameter is incorrectly formatted.String
(404): An error message if the storage center ID was not found.
URL: /updateCenterDescription
Method: PATCH
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.description
(required): A string representing the new description of the storage center.
Response:
String
(200): A message confirming the storage center's description was updated.String
(500): An error message if an internal server error occurred.String
(400): An error message if any parameter is incorrectly formatted.String
(404): An error message if the storage center ID was not found.
URL: /updateCenterHours
Method: PATCH
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.day
(required): An integer representing the day of the week (1–7).open
(required): A string representing the opening time inHH:MM
format.close
(required): A string representing the closing time inHH:MM
format.
Response:
String
(200): A message confirming the storage center's operating hours were updated.String
(500): An error message if an internal server error occurred.String
(400): An error message if any parameter is incorrectly formatted.String
(404): An error message if the storage center ID was not found.
URL: /checkInItems
Method: PATCH
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.type
(required): A string representing the item type (FOOD, CLOTHES, or TOILETRIES).name
(required): A string representing the item's name.quantity
(required): An integer representing the item's quantity (positive value).expirationDate
(required): A string representing the item's expiration date inyyyy-MM-dd
format.
Response:
String
(200): A message confirming the item was successfully added.String
(500): An error message if an internal server error occurred.String
(400): An error message if any parameter is incorrectly formatted.String
(404): An error message if the storage center ID was not found.
URL: /checkOutItems
Method: PATCH
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.type
(required): A string representing the item type (FOOD, CLOTHES, or TOILETRIES).name
(required): A string representing the item's name.quantity
(required): An integer representing the item's quantity.
Response:
String
(200): A message confirming the item was successfully removed.String
(500): An error message if an internal server error occurred.String
(400): An error message if any parameter is incorrectly formatted.String
(404): An error message if the storage center ID was not found.
URL: /removeExpiredItems
Method: PATCH
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.
Response:
String
(200): A message confirming the expired items were successfully removed.String
(500): An error message if an internal server error occurred.String
(404): An error message if the storage center ID was not found.
URL: /listInventory
Method: GET
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.
Response:
List<Item>
(200): A list of items in the storage center's inventory.String
(500): An error message if an internal server error occurred.String
(404): An error message if the storage center ID was not found.
URL: /listTransactions
Method: GET
Query Parameters:
storageCenterId
(required): An integer representing the storage center's ID.
Response:
List<Transaction>
(200): A list of transactions from the storage center.String
(500): An error message if an internal server error occurred.String
(404): An error message if the storage center ID was not found.
URL: /registerClient
Method: POST
Response:
API Key
(200): With the new API Key.API Key
(500): If the API key could not be generated.
URL: /getOrganization
Method: GET
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.
Response:
Organization
(200): The organization's details if found successfully.String
(500): An error message if an internal server error occurred.String
(400): An error message if the organization was not found.
URL: /createOrganization
Method: GET
Query Parameters:
orgName
(required): the name of the Organization.orgType
(required): the type of the Organization.orgId
(required): An integer representing the organization's ID.
Response:
Organization
(200): The organization's details if found successfully.String
(500): An error message if an internal server error occurred.String
(403): If the API key is invalid.
URL: /changeSubscriptionStatus
Method: PATCH
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.
Response:
String
(200): A success message if the subscription status was updated.String
(500): An error message if an internal server error occurred.
URL: /deleteOrganization
Method: DELETE
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.
Response:
String
(200): A success message if the organization was deleted.String
(500): An error message if an internal server error occurred.
URL: /registerEvent
Method: POST
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.eventId
(required): An integer representing the event's ID.
Response:
String
(200): A success message if the event was registered.String
(500): An error message if an internal server error occurred.
URL: /unregisterEvent
Method: DELETE
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.eventId
(required): An integer representing the event's ID.
Response:
String
(200): A success message if the event was unregistered.String
(500): An error message if an internal server error occurred.
URL: /listOrganizationEvents
Method: GET
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.
Response:
List<Event>
(200): A list of events registered to the organization.String
(500): An error message if an internal server error occurred.
URL: /linkStorageCenter
Method: POST
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.storageId
(required): An integer representing the storage center's ID.
Response:
String
(200): A success message if the storage center was linked.String
(500): An error message if an internal server error occurred.
URL: /getStorageCenter
Method: GET
Query Parameters:
apiKey
(required): A string representing the client's API key.orgId
(required): An integer representing the organization's ID.
Response:
StorageCenter
(200): The details of the linked storage center.String
(500): An error message if an internal server error occurred.
- Spring Data JPA
- Google Cloud SQL
- Maven Package Manager
- GitHub Actions CI
- Checkstyle
- PMD Static Bug Analysis