Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions httpServer/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
func setupHandlers(router *gin.Engine) {
// TODO: Replace gin default logger with zap
// router.Use(gin.Recovery())
router.GET("/", func(ctx *gin.Context) {})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Empty root handler will hang requests
The GET “/” handler is currently a no-op and doesn’t write any response. In Gin, if you don’t send a status or body, the client will wait indefinitely. At minimum, return a health-check response (e.g., ctx.JSON(200, gin.H{"status":"ok"})) or set a status code.

🤖 Prompt for AI Agents
In httpServer/endpoint.go at line 16, the root GET handler is empty and does not
send any response, causing requests to hang. Modify the handler to send a
response by returning a status code and a simple JSON body, such as
ctx.JSON(200, gin.H{"status":"ok"}), to ensure the client receives a timely
response.


router.Use(middleware.CorsHeader())
api := router.Group("/api")
Comment on lines 15 to 19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Register CORS middleware before routes
You apply router.Use(middleware.CorsHeader()) after the root route, so that endpoint won’t get CORS headers. To ensure CORS on all endpoints, move the middleware registration above any router.GET/router.POST calls.

🤖 Prompt for AI Agents
In httpServer/endpoint.go around lines 15 to 19, the CORS middleware is
registered after the root route, so the root endpoint does not get CORS headers.
Move the line `router.Use(middleware.CorsHeader())` above the `router.GET("/",
...)` call to ensure the CORS middleware applies to all routes including the
root.

Expand Down
7 changes: 4 additions & 3 deletions scipt/create_vehicle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

# --- Configuration ---
# !!! REPLACE WITH YOUR ACTUAL API BASE URL !!!
API_BASE_URL="http://localhost:8090/api" # Example: might be http://localhost:8080
API_BASE_URL="http://192.168.0.127:8090/api" # Example: might be http://localhost:8080
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Parameterize the API base URL
The base URL is hard-coded. Allow overriding via an environment variable for flexibility across environments. For example:

API_BASE_URL="${API_BASE_URL:-http://192.168.0.127:8090/api}"
🤖 Prompt for AI Agents
In scipt/create_vehicle.sh at line 8, the API base URL is hard-coded, limiting
flexibility. Modify the assignment to allow overriding via an environment
variable by using parameter expansion syntax: set API_BASE_URL to
"${API_BASE_URL:-http://192.168.0.127:8090/api}" so it uses the environment
variable if set, otherwise defaults to the current hard-coded URL.


# --- Existing User Credentials and UUID ---
# !!! REPLACE WITH THE DETAILS OF AN EXISTING USER !!!
EXISTING_USER_EMAIL="bash.user@example.com"
# EXISTING_USER_EMAIL="bash.user@example.com"
EXISTING_USER_EMAIL="lkovacic@test.hr"
Comment on lines +12 to +13
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Clean up stale commented placeholders
The placeholder # EXISTING_USER_EMAIL="bash.user@example.com" is now outdated. Removing commented-out defaults will reduce confusion and improve readability.

🤖 Prompt for AI Agents
In scipt/create_vehicle.sh around lines 12 to 13, remove the commented-out
placeholder line `# EXISTING_USER_EMAIL="bash.user@example.com"` as it is
outdated and only adds confusion. Keep the active assignment line and delete the
commented default to improve script readability.

EXISTING_USER_PASSWORD='Pa$$w0rd'
EXISTING_USER_UUID="9fea1366-82fe-4775-ba1e-772b77105bb0" # e.g., "a1b2c3d4-e5f6-7890-1234-567890abcdef"
EXISTING_USER_UUID="d0499fb2-9d15-47c0-9cfc-408295407349" # e.g., "a1b2c3d4-e5f6-7890-1234-567890abcdef"

# --- New Vehicle Details ---
# Generate a somewhat unique identifier for testing vehicle details
Expand Down