541-implement-vasttrafik-card #958
No reviewers
Labels
No labels
_CRITICAL_
API
app
backEnd
Blocked, waiting for further changes
bug
cleanup
close
design
duplicate
enhancement
feature request
frontEnd
help wanted
invalid
low priority
needs input
needs review
project documentation
question
research
reviewed
script
security
SQL
style
testing
topLevel
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Andras/BoundlessFlowCampus2K!958
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "541-implement-vasttrafik-card"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implemented a complete Västtrafik dashboard card with real-time departures and arrivals from the Västtrafik API.
Features
Added new
VasttrafikViewdashboard cardAdded departures and arrivals tab switching
Added reusable
useVasttrafikcustom hook for API fetchingAdded loading and error handling states
Added formatted Swedish departure/arrival times
Added responsive and styled traffic list UI
Added backend
vasttrafikServiceAdded OAuth token handling with automatic token refresh
Added Västtrafik API integration for:
Added nginx reverse proxy routing
Added Docker Compose integration for the new service
Technical Details
/api/vasttrafik/*da2ac63239tofc4a9dbce1fc4a9dbce1to8c1c1944df/TempSensorMockup var data= new{sensor1} chaged to var data= new[]{sensor1,sensor2..} It used to give back a object with data of a single sensor now it returns an array with data from multiple sensors /readTempSensorMockup the read function used to expect an single object from tempSensorMockup but as its an array now its been changed to expect an array and a foreach loop have been intruduced to read and store the data from all sensors in the array /tempService i have included the sensorId in the class TempratureData, even if we stored sensorId,timestamp and temperature in the db we could only use the last two before in the View's/app it doesnt do anything now but its added to be able to make out witch sensor gives the reading.+ Added the small feature loginService + How it works + Endpoints -> AuthService -> DatabaseQueries->DATABASE + DATABASE -> DatabaseQueries->AuthService->Endpoint->frontend + This is done to separate the different layers. + Entrypoint receives requests + AuthService should apply all logic + DatabaseQueries should only fetch data + Tested on my own computer Fedora 43 using curl + get container ip using this command ``` bash docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id ``` + possible to create a user using endpoint ``` bash curl -X POST http://172.18.0.3:8080/auth/SignUp \ -H "Content-Type: application/json" \ -d '{ "Username": "jag orkar inte", "Firstname": "Eric", "Lastname": "Grandinger", "Email": "eric@example.com", "Password": "Let me in" }' ``` + possible to sign in using endpoint ``` bash curl -X POST http://172.18.0.10:8080/auth/login \ -H "Content-Type: application/json" \ -d '{"Username": "jag orkar inte", "Password": "Let me in"}' }' ``` + Acess not granted if wrong password is used I know the commit is on the larger side and i am sorry about that :(added style={{ overflowX: 'hidden', width: '100%' }} to the <div class='Dashboard Parent Div' > will check tomorrow how it behaves with diffrent sized screens and if it works add to css style fileOnly aadded "style={{ overflowX: 'hidden', width: '100%' }} // to fix drag problem horizontoly add in css later" to the dashboard div will let i be in inline for now as we will probebly look over the structure of the css files in our project+ The endpoint send to tempService + Received from tempService model TempRespons + TempRespons contains + bool IsSuccess + string? ErrorMessage + object? Data + all data from tempService is stored as object+ nvim.appimage: Remove + DatabaseQueries.cs line 39: Split into two lines + TempRespons.cs: Rename file to TempResponse.cs + Program.cs: Remove duplicate AddScoped<ITempService, TempService> + TempService.cs: Change ValidSensorRequest to check for "temp-sensor-" instead of "temp-sensor-001" + TempEndpoints.cs: Add {sensorId} to the /temperature/sensors route or remove the parameter/*using (var connection = new SQLiteConnection($"Data Source={databasePath};Version=3;")) { connection.Open(); string insertQuery = "INSERT INTO EnergySensorValues (SensorId, Timestamp, Kilowatt) VALUES (@sensorid, @timestamp, @kilowatt)"; using (var command = new SQLiteCommand(insertQuery, connection)) { // Parameters to prevent SQL injection command.Parameters.AddWithValue("@sensorid", response?.sensorId ?? "unknown"); command.Parameters.AddWithValue("@timestamp", response?.timestamp ?? null); command.Parameters.AddWithValue("@kilowatt", response?.kilowatt ?? null); int rowsAffected = command.ExecuteNonQuery(); Console.WriteLine($"Sqllite rows inserted: {rowsAffected}"); } connection.Close(); } } // Loop end } }*/Review on #958
Whats done
Implemented västtrafik view
Tested on Windows using Chrome
Inspected following files
Everything else looks good and is commented on. Unsure if some changes were done on purpose or happened when fixing merge issue (such as roomBookingService to roomBookingApiMockup or parkingService being removed)
What needs to be done
Conclusion
Missing this line in the rebuilds:
::västtrafikService
docker build -t vasttrafikservice ./service/vasttrafikService/vasttrafikService
Ppl should add VASTTRAFIK_ID and VASTTRAFIK_SECRET to their envs
Unsure if parkingService is needed, but that is still removed in the compose.yaml.
In scripts/WindowsInstallation.bat, there is a merge/change request
It is missing a unit test
Not ready for merge
Re-base after merge, fix the problems and create a new PR
Pull request closed