#519-Break-out-temp-service-to-follow-new-service-structure #563

Merged
c24elipe merged 13 commits from #519-Break-out-temp-service-to-follow-new-service-structure into team_2_week_3 2026-04-28 07:25:41 +00:00
Collaborator

Refactor of tempService

My task was to refactor the old tempService to follow a better standard to enhance readability, scalability and testability.

  • Follows the standard of services
    • Endpoints
      • All endpoints
    • Services
      • All business logic here
    • DatabaseLogic
      • All accesses to the database
    • Models
      • creates the Dto that transports the data
      • TempResponse is the standard way for a service to send back a result to the Endpoint

Dataflow

  • FRONTEND --> Endpoint --> TempService --> DatabaseLogic --> TempService --> Endpoint --> FRONTEND

My testing

  • Tested reachability of all endpoints.
    • I reached all endpoints
    • I received error messages Name or service not known. This occured during request to database. Probably due to refactoring of middleware
    • Verified that the request moves through all of the steps
      • FRONTEND --> Endpoint --> TempService --> DatabaseLogic --> TempService --> Endpoint --> FRONTEND
    • Unable to verify what results the frontend receives due to out of data database queries.
      • This could be problematic because a object is sent back.

Conclusion

  • Tested as best as i could.
  • Be aware and verify that that the fronted results are readable
  • The HTTP requests could not be converted to HTTPS. program.cs 17/18. In the future this should be implemented
  • Did not receive any data from the database due to middleware changes. The queries are the once from pre refactoring.
  • Unit tests not yet implemented
# Refactor of tempService My task was to refactor the old tempService to follow a better standard to enhance readability, scalability and testability. + Follows the standard of services + Endpoints + All endpoints + Services + All business logic here + DatabaseLogic + All accesses to the database + Models + creates the Dto that transports the data + TempResponse is the standard way for a service to send back a result to the Endpoint ## Dataflow + **FRONTEND** --> Endpoint --> TempService --> DatabaseLogic --> TempService --> Endpoint --> **FRONTEND** ## My testing + Tested reachability of all endpoints. + I reached all endpoints + I received error messages _Name or service not known_. This occured during request to database. Probably due to refactoring of middleware + Verified that the request moves through all of the steps + **FRONTEND** --> Endpoint --> TempService --> DatabaseLogic --> TempService --> Endpoint --> **FRONTEND** + Unable to verify what results the frontend receives due to out of data database queries. + This could be problematic because a object is sent back. ## Conclusion + Tested as best as i could. + Be aware and verify that that the fronted results are readable + The HTTP requests could not be converted to HTTPS. program.cs 17/18. In the future this should be implemented + Did not receive any data from the database due to middleware changes. The queries are the once from pre refactoring. + Unit tests not yet implemented
+ 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
+ TempData
  + string sensorId
  + DateTime timestamp
  + double temperature
+ TempResponse
  + acts as a wrapper
# TempService
+ Is the file containing all logic
+ acts as a middleman between database and endpoints
+ all database logic appears here. Important to note that these files
only execute database commands. Nothing more
+ Note was not able to translate http to https. This should be
implemented in the future
+ Have tested all the endpoints on my computer. They successfully
reaches the database layer but because of the changes in middleware i
did not reive any data from the database. I was able to test the error
messages tho
Author
Collaborator

when merging team 2_week_3 into this branch accidentally added layoutServie directories

when merging team 2_week_3 into this branch accidentally added layoutServie directories
Collaborator

Review on #519

Whats done

Tested on Windows using Firefox

  • App starts
    • /temperature/sensors returns HTTP 400 because the route is missing the sensorId parameter

Inspected following files

  • service/tempService/tempService/Program.cs
    • Indentation/code styling
      • Follows wiki standards
    • Naming convention
      • Follows wikistandards
    • Comments
      • TODO comment present for HTTPS
    • General code quality
      • ITempService is duplicated with AddScoped on lines 11 and 15
  • service/tempService/tempService/Endpoints/TempEndpoints.cs
    • Indentation/code styling
      • Follows wiki standards
    • Naming convention
      • Follows wiki standards
    • Comments
      • Comment explaining structure
    • General code quality
      • /temperature/sensors on line 37 is missing sensorId in the route, causing HTTP 400
  • service/tempService/tempService/Services/TempService.cs
    • Indentation/code styling
      • Follows wiki standards
    • Naming convention
      • Follows wiki standards
    • Comments
      • Comments good but they have two typos on line 72, 95 sensorIdD
    • General code quality
      • ValidSensorRequest on line 25 hardcodes "temp-sensor-001" in StartsWith check, should probably check for "temp-sensor-" instead
  • service/tempService/tempService/DatabaseLogic/DatabaseQueries.cs
    • Indentation/code styling
      • Line 39 has two statements on one line, C# wiki standards says one per line
    • Naming convention
      • Follows Wiki standards
    • Comments
      • Clear comment explaining file purpose
    • General code quality
      • Looks good
  • service/tempService/tempService/DatabaseLogic/IDatabaseQueries.cs
    • Follows wiki standards
  • service/tempService/tempService/Models/TempData.cs
    • Looks good
  • service/tempService/tempService/Models/TempRespons.cs
    • Filename has a typo, should be TempResponse.cs
  • service/tempService/tempService.Test/nvim.appimage
    • Accidentally committed? should probably be removed and added to .gitignore
  • service/tempService/tempService.csproj
    • Added xunit package

What needs to be done

  • TempEndpoints.cs: Add {sensorId} to the /temperature/sensors route or remove the parameter
  • TempService.cs: Change ValidSensorRequest to check for "temp-sensor-" instead of "temp-sensor-001"
  • Program.cs: Remove duplicate AddScoped<ITempService, TempService>
  • TempRespons.cs: Rename file to TempResponse.cs
  • nvim.appimage: Remove
  • DatabaseQueries.cs line 39: Split into two lines

Conclusion

  • There are a couple of issues that need fixing before merge.
# Review on #519 ## Whats done ### Tested on Windows using Firefox + App starts + /temperature/sensors returns HTTP 400 because the route is missing the sensorId parameter ### Inspected following files + service/tempService/tempService/Program.cs + Indentation/code styling + Follows wiki standards + Naming convention + Follows wikistandards + Comments + TODO comment present for HTTPS + General code quality + ITempService is duplicated with AddScoped on lines 11 and 15 + service/tempService/tempService/Endpoints/TempEndpoints.cs + Indentation/code styling + Follows wiki standards + Naming convention + Follows wiki standards + Comments + Comment explaining structure + General code quality + /temperature/sensors on line 37 is missing sensorId in the route, causing HTTP 400 + service/tempService/tempService/Services/TempService.cs + Indentation/code styling + Follows wiki standards + Naming convention + Follows wiki standards + Comments + Comments good but they have two typos on line 72, 95 sensorIdD + General code quality + ValidSensorRequest on line 25 hardcodes "temp-sensor-001" in StartsWith check, should probably check for "temp-sensor-" instead + service/tempService/tempService/DatabaseLogic/DatabaseQueries.cs + Indentation/code styling + Line 39 has two statements on one line, C# wiki standards says one per line + Naming convention + Follows Wiki standards + Comments + Clear comment explaining file purpose + General code quality + Looks good + service/tempService/tempService/DatabaseLogic/IDatabaseQueries.cs + Follows wiki standards + service/tempService/tempService/Models/TempData.cs + Looks good + service/tempService/tempService/Models/TempRespons.cs + Filename has a typo, should be TempResponse.cs + service/tempService/tempService.Test/nvim.appimage + Accidentally committed? should probably be removed and added to .gitignore + service/tempService/tempService.csproj + Added xunit package ## What needs to be done + TempEndpoints.cs: Add {sensorId} to the /temperature/sensors route or remove the parameter + TempService.cs: Change ValidSensorRequest to check for "temp-sensor-" instead of "temp-sensor-001" + Program.cs: Remove duplicate AddScoped<ITempService, TempService> + TempRespons.cs: Rename file to TempResponse.cs + nvim.appimage: Remove + DatabaseQueries.cs line 39: Split into two lines ## Conclusion + There are a couple of issues that need fixing before merge.
+ 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
a24vinla approved these changes 2026-04-28 07:21:24 +00:00
a24vinla left a comment
Collaborator

Changes look good!

Changes look good!
Collaborator

Get merged

Get merged
c24elipe merged commit 71f7a8a0be into team_2_week_3 2026-04-28 07:25:41 +00:00
c24elipe deleted branch #519-Break-out-temp-service-to-follow-new-service-structure 2026-04-28 07:25:41 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Andras/BoundlessFlowCampus2K!563
No description provided.