Skip to content

fix(docker): Fix docker-compose stack#10

Merged
ATMackay merged 2 commits intomainfrom
fix/docker-compose
Oct 6, 2025
Merged

fix(docker): Fix docker-compose stack#10
ATMackay merged 2 commits intomainfrom
fix/docker-compose

Conversation

@ATMackay
Copy link
Copy Markdown
Owner

@ATMackay ATMackay commented Oct 6, 2025

No description provided.

@ATMackay ATMackay requested a review from Copilot October 6, 2025 00:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the application from using float64 for monetary values to using the shopspring/decimal library for more precise financial calculations, and significantly improves the Docker Compose configuration with proper service orchestration and environment variable management.

  • Replaces all monetary float64 fields with decimal.Decimal for precise financial arithmetic
  • Adds comprehensive Docker Compose setup with PostgreSQL and SQLite profiles, health checks, and environment variable configuration
  • Refactors code structure with improved naming and reduced duplication

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
model/items.go Updates Item.Price field to use decimal.Decimal with appropriate validation
model/order.go Changes Order.Price field to decimal.Decimal with database column type update
server/purchase.go Converts price calculations to use decimal operations with float conversion for totals
server/item.go Updates price response handling to convert decimals to float64 for API responses
promotions/promotion.go Refactors discount calculations to use decimal arithmetic
promotions/promotion_test.go Updates test data to use decimal.NewFromFloat for price initialization
client/client_test.go Modifies test assertions to work with decimal price calculations
docker-compose.yml Complete rewrite with PostgreSQL/SQLite profiles, health checks, and environment variables
cmd/run.go Refactors flag binding with helper function and improves code organization
cmd/version.go Renames function for consistency
cmd/cmd_test.go Updates test to use renamed function
cmd/cmd.go Adds environment prefix constant
Makefile Improves DIRTY flag detection and updates Docker targets
Dockerfile Updates Alpine base image version
go.mod Adds shopspring/decimal dependency
docs/openapi/openapi.json/swagger.json Updates API schema to reflect price field name change
Comments suppressed due to low confidence (1)

server/purchase.go:1

  • The environment variable uses PG_HOST_PORT but should use 5432 as the container port since the application connects to the database service internally, not via the host port mapping.
package server

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ATMackay ATMackay merged commit 8fbd272 into main Oct 6, 2025
2 checks passed
@ATMackay ATMackay deleted the fix/docker-compose branch October 6, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants