Skip to content

Releases: agentjimlam/SE8-Group5-API

Version 5.1.0

Choose a tag to compare

@agentjimlam agentjimlam released this 18 Jan 13:17

Changelog v5.1.0

Summary:
Added .circleci folder and config.yml

=== Files added or edited ===
config.yml [NEW]

Version 5.0.0

Choose a tag to compare

@agentjimlam agentjimlam released this 18 Jan 12:36

Changelog v5.0.0

Summary:

  • Renamed app.api.key to APP_API_KEY because circleCi do not allow dot ., only underscore for env variable name
  • Renamed UserAccessControllerTest.java to a .txt file

=== Files added or edited ===
application-dev.properties (Edited)
ApiKey.java (Edited)
ApiTestController.java (Edited)

META-INF/additional-spring-configuration-metadata.json (Edited)

Version 4.0.0

Choose a tag to compare

@agentjimlam agentjimlam released this 04 Jan 13:05
1cfc15c

This is latest version of our Spring Boot API app as of 4 Jan 2025.

Previous version is v0.3a. Why? Because we were not using proper Semantic Versioning then. From this version 4.0.0 onwards, will do Semantic Versioning. v4.0.0 because there is a major change to how the API work as the Bus Stop entity's validation was removed, hence from v3 (v0.3a bc not proper versioning) become v4.

Changelog v4.0.0

Version 4.0.0
Removed bus stop @DecimalMax @DecimalMin for Latitude and Longitude causes error during the pull of BusStops from LTA Datamall because there's bus stops in Malaysia but my Latitude Longitude min and max range settings to only Singapore land block those bus stops from getting pulled from LTA Datamall. This was causing issue when trying to build a Docker image

=== Files added or edited ===
BusStop.java [Edited]
Readme.md [Edited, added version name and the reason for the change]

Version 0.3a - Used for Presentation day

Choose a tag to compare

@agentjimlam agentjimlam released this 04 Jan 12:50

This follows incorrect Semantic Versioning, but for sake of no confusion, using the versioning as before.

Version 0.3a was used for presentation.

NOTE: I didn't make a backup copy of v0.3, so it's straight to v0.3a, which includes the changes in v0.3 listed below. In v0.3, Vincent's files for UserAccess (basically a user login database) is added. That's all. His files are standalone, they do not rely on the Bus Stop, Bus Service, Bus Route files. In v0.3a, that's when I merged my add Bus Stop validation codes in.

Changelog v0.3

Added Vincent's UserAccess files. This is done today 19 Dec, around 9.30pm

Grp repo is ready for sync @vincent | SE8 @chooi Chin | SE8 @joshua | SE8

=== Files added or edited ===
AppBusStopController.java [Edited - removed import RequestMapping that is not used]

controllerNote.md [Edited]
entityNote.md [Edited]
exceptionNote.md [Edited]
repositoryNote.md [Edited]
serviceNote.md [Edited]
application.properties [Edited - change back port to 5432, but main branch is already port 5432, not sure why it's marked as edited]
TestNotes.md [Edited]

UserAccess.java [NEW]
DataloaderUserAccess.java [NEW]
UserAccessController.java [NEW]

UserAccessNotFoundException [NEW]
UserAccessRepository.java [NEW]

UserAccessService.java [NEW]
UserAccessServiceImpl.java [NEW]

UserAccessControllerTest.java [NEW]

Changelog v0.3a

Merged my branch Jimmy/addBusStopValidation. Grp repo is ready for sync! @vincent | SE8 @chooi Chin | SE8 @joshua | SE8

Now when you try create a duplicate bus stop with an existing bus stop code that is alr in the database, it will throw an exception, and a error message will print out in Postman.

Added validation for bus stop entity's fields also.

=== Files added or edited ===
MainBusStopController.java [Edited - add the @Valid annotation in the createBusStop controller method]

BusStop.java [Edited - added validation annotations to certain fields]
entity.md[Edited - fixed typo]

BusStopDuplicateException.java [NEW]
GlobalExceptionHandler.java [Edited - added Bus Stop Duplicate exception handler, added Illegal Argument exception handler]
exceptionNote.md [Edited - updated it and fixed a typo]

BusStopRepository.java [Edited - added 2x new JPA Derived Query]
repositoryNote.md [Edited - updated the note on how to do JPA Query Creation From Method Name]

MainBusStopApiServiceImpl.java [Edited - modify the createBusStop method]

v0.2b-HideApiKey-patch

Choose a tag to compare

Changelog v0.2b-HideApiKey-patch

Merged Chooi Chin's pull request patch, environment variable app.api.key now works as intended. This was done today 19 Dec around 7pm.

Please follow Chooi Chin's steps in the post directly below

=== Files added or edited ===
README.md [edited]
.gitignore [edited]
application.properties [edited]

Chooi Chin's steps to set up environment variable app.api.key

Keep the .vscode folder as it is. No need to change anything.

Action:

In application.properties, put this in:

  spring.profiles.active=dev

Comment out the previous line by Jimmy :

#app.api.key=${MY_API_KEY}

Action:

Create a an application-dev.properties file in the same folder as the application.properties.

In the file, put this line:

app.api.key=<YOUR API KEY>

There is a main - resources - META-INF. Leave it as it is. No need to change anything.

Put this line in the .gitignore, so that the API key will not be uploaded to github.

/src/main/resources/application-dev.properties

Do a git status. You should not see any git tracking of the application-dev.properties.

That's all.
mvn spring-boot:run

Version 0.2b - Added method to hide API Key

Choose a tag to compare

@agentjimlam agentjimlam released this 04 Jan 12:32
910f200

This follows incorrect Semantic Versioning, but for sake of no confusion, using the versioning as before.

Changelog v0.2b

Grp repo is ready for sync! @liewchooichin @vincentnwa @JoshuaEmmanuel7

I'm not merging Vincent's pull request yet as it is an old commit.
Not wise to do 2 pull requests at same time for each version. Each version will be for one pull request's changes made, so it's more organized.

In v0.2b, the hide ApiKey method Sanjela showed has been added. You can now hide your ApiKey. You have to setup the Springboot environment variable first.

=== Files added or edited ===
BusApiApplication.java [Edited, added a logger.info line to print a message when Springboot app starts]

ApiTestController.java [Edited - removed extra import]

AppBusServiceController.java [Edited - added back the find all bus service GetMapping for testing purposes]
AppBusStopController.java [Edited - added back the find all bus stop GetMapping for testing purposes]

GlobalExceptionHandler [Edited - added one logger.error line]

ApiKey.java [Edited - changed it to use new method to get ApiKey]

AppBusArrivalService.java [Edited - now uses new method to get ApiKey]
BusRouteApiService.java [Edited - now uses new method to get ApiKey]
BusServiceApiService.java [Edited - now uses new method to get ApiKey]
BusStopApiService.java [Edited - now uses new method to get ApiKey]

MainBusRouteController.java [NEW]
MainBusServiceController.java [NEW]
MainBusStopController.java [NEW]

MainBusRouteApiService.java [NEW]
MainBusServiceApiService.java [NEW]
MainBusStopApiService.java [NEW]

MainBusRouteApiServiceImpl.java [NEW]
MainBusServiceApiServiceImpl.java [NEW]
MainBusStopApiServiceImpl.java [NEW]

application.properties [Edited - added Logger Configuration, and it is commented out. To always comment out Logger configuration part before git add -A or git push]

.gitignore [Corrected - "log/" changed to "logs/" to be correct and match folder name that logger configuration use

=====================

Version 0.2a

Choose a tag to compare

@agentjimlam agentjimlam released this 04 Jan 12:22

This follows incorrect Semantic Versioning, but for sake of no confusion, using the versioning as before.

I didn't have a backup copy of v0.1a and v0.2, so changes made in those are also included, documented below too, along with v0.2a changes. There is no v0.1b, went straight to v0.2.

Changelog v0.1a

[Edit] Group repo is ready for you to sync your forked repos and do a git pull, so that you have the latest main branch

commented out the Jackson dependencies as they are duplicates. Spring-boot-starter and spring-boot-starter-web dependency alr include these Jackson modules
Added ApiKey.java in the .gitignore so that we do not have to always remove API key in our local repo each time we just want to git push to our own forked repo. Git will just not track any future edits to ApiKey.java

===== Files added or edited =====

.gitignore (edited)
pom.xml (edited)

Changelog v0.2

Group repo is ready for you to sync your forked repos and do a git pull, so that you have the latest main branch

===== Files added or edited =====

README.md [edited]

DataLoader.java -> DataLoader.java.xxx (Become a text file now)

AppBusRouteController.java [edited]
AppBusServiceController.java [edited]
AppBusStopController.java [edited]

BusRouteRepository.java [edited, added a custom JPA Query to find route by service and direction, and it is case insensitive]

BusRouteApiService.java [edited]
BusServiceApiService.java [edited]
BusStopApiService.java [edited]

application.properties [edited, updated jpa.hibernate.dll.auto from =create to =update ]

AppBusArrivalControllerTest.java [NEW]
AppBusRouteControllerTest.java [NEW]
AppBusServiceControllerTest.java [NEW]
AppBusStopControllerTest.java [NEW]

=============================

Notes from Chooi Chin:

Change the application.properties to persist the database. Use jpa.hibernate.dll.auto=update. IMPORTANT: Must update the application.properties to make the database persist.

I remove the DataLoader by renaming its extention to .xxx. The data is too large to be loaded at once. Instead use the GET /datamall to load the table one by one.

The front-end point findAll is too large. So I replaced it with findFirstOne. This can be used as a test to make sure the endpoint is working.

Add in the following GET:

GET bus service by serviceNo.
GET bus stops by busStopCode.
Get bus route by serviceNo and direction.

Changelog v0.2a

Group repo is ready for you to sync your forked repos and do a git pull, so that you have the latest main branch

Vincent, do the pull request first for your UserAccess.java files, do that first before syncing your forked repo, to be safe.

===== Files added or edited =====

ApiTestController.java [NEW, used to test if I can return my Springboot environment variable app.api.key where I store my API key. Test is successful, can return my API key via the test endpoint]
this requires modifying the .vscode/launch.json by adding an env {} as below
also need to add a custom property in application.properties that has to be same name as environment variable, app.api.key

launch.json - have to add this in yourself, as it is an environment variable, and .vscode folder is not tracked by git

{
    "configurations": [
        {
            "type": "java",
            "name": "Spring Boot-BusApiApplication<bus-api>",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "mainClass": "sg.edu.ntu.bus_api.BusApiApplication",
            "projectName": "bus-api",
            "args": "",
            "envFile": "${workspaceFolder}/.env",
            "env": {
                "MY_API_KEY": "hHL3Rf0zTm6ibnuQLU228w=="
            }
        }
    ]
}

BusRouteNotFoundException.java [NEW]
BusServiceNotFoundException.java [NEW]
BusStopNotFoundException.java [NEW]
ErrorResponse.java [NEW]
GlobalExceptionHandler.java [NEW]

resources/static folder [NEW]
index.html [NEW]

resourecs/META-INF folder [NEW]
additional-spring-configuration-metadata.json [NEW, this is for creating custom property in application.properties]

=============================

I've reverted any temp changes from Chooi Chin files as requested (they were the service method findAll() and the controller endpoint for "get all Bus Stops" etc.). It is now reverted to what the files were in v0.2
Impt Note:
This version is still using API Key directly into ApiKey.java, meaning still need to remove your API key before you git add -A or git push.

Status of Springboot Env variable testing:
My attempt to add Springboot Environment variable doesn't seem to work when do the "Get Bus Arrival for one bus stop at a bus stop" endpoint (eg. http://localhost:8080/app/arrival?BusStopCode=75009&ServiceNo=10), which calls directly from LTA API. The others like get Bus Stop, get Bus Service work, which Chooi Chin said those call from database and not the LTA API.

Additional notes:
Added META-INF folder to create custom application.properties property app.api.key in attempt to add Springboot Environment variable to hide API Key. Right now the custom property app.api.key is sitting in application.properties but not used via the @value annotation in ApiKey.java, still using API key directly in ApiKey.java to run.

Version 0.1

Choose a tag to compare

@agentjimlam agentjimlam released this 04 Jan 12:13

This follows incorrect Semantic Versioning, should be v1.0.0 but for sake of no confusion, using the versioning as before.

Changelog v0.1

backup copy of the main branch after approving Chooi Chin's pull request and merge. No changes made by me after.

===== Files added or edited =====

Config folder:
DataLoader.java [NEW]

Controller folder:
ApiController.java [NEW]
AppBusArrivalController.java [NEW]
AppBusRouteController.java [NEW]
AppBusServiceController.java [NEW]
AppBusStopController.java [NEW]
controllerNote.md (edited)

Entity folder:
BusRoute.java [NEW]
BusService.java [NEW]
BusStop.java [NEW]

Repository folder:
BusRouteRepository.java [NEW]
BusServiceRepository.java [NEW]
BusStopRepository.java [NEW]

Service folder:
ApiKey.java [NEW]
AppBusArrivalService.java [NEW]
BusRouteApiService.java [NEW]
BusServiceApiService.java [NEW]
BusStopApiService.java [NEW]

Resources:
application.properties (edited*, superficial spacing changes)