Skip to content

Conversation

ryanaidilp
Copy link
Contributor

Summary

  • Standardize error handling patterns in province case repository
  • Fix nullable pointer field compilation errors in model tests
  • Add comprehensive pagination support for national cases endpoint
  • Add missing test mock methods and integration tests
  • Fix file formatting issues (missing newlines)

Test plan

  • All repository tests pass (11/11)
  • All model tests pass (22/22)
  • All handler tests pass (8/8)
  • All integration tests pass (9/9)
  • Linter issues resolved
  • Compilation errors fixed
  • Backward compatibility maintained with all=true parameter

github-actions bot and others added 15 commits September 8, 2025 07:32
Following release branch creation for v2.2.0, updating develop
branch to target the next minor version v2.3.0.

Changes:
- Update version annotations to 2.3.0
- Regenerate API documentation
- Prepare for next development cycle

This maintains the Git Flow pattern where develop always contains
the next planned version.
chore: bump version to v2.3.0 for next development cycle
- Remove swagger file upload to server (HTML, JSON, YAML)
- Remove swagger documentation generation from deployment workflow
- Remove server-side documentation directory handling
- Simplify deployment to only handle binary deployment
- Keep swagger generation in repo for development/CI purposes only
- Create .htaccess configuration for Apache/LiteSpeed servers
- Proxy /api/v1/*, /swagger/*, and /docs requests to Go application
- Preserve static file serving for root domain and assets
- Add CORS headers and security headers
- Enable compression and caching for static assets
- Fix Swagger UI accessibility at /swagger/index.html
- Remove root redirect handler to avoid conflicts with static site
- Add test file version updates to release branch creation workflow
- Update both release branch and develop branch version bump sections
- Include covid_handler_test.go version assertions updates
- Fix test version expectations to match current version (2.3.0)
- Ensure all version-related files stay in sync during automated bumps
- Remove github.com/swaggo/http-swagger dependency
- Serve API spec via /api/v1/swagger.json endpoint
- Update .htaccess to serve static Swagger UI files
- Reduce binary size from 19MB to 6.8MB (64% reduction)
- Maintain same URLs: /swagger/ and /docs redirect
- Add API specification deployment step after binary deployment
- Generate and upload swagger.json to server docs directory
- Add Swagger JSON endpoint verification to health checks
- Update deployment summary to reflect optimized binary size
- Include Swagger endpoint verification in deployment status
refactor: migrate Swagger UI to static files
- Make nullable database fields properly nullable (*int64) in ProvinceCase model
- Add null-safe transformation in ProvinceCaseResponse
- Fix SQL scan errors for person_under_observation and related fields
- Add page parameter support in ParsePaginationParams utility function

Resolves SQL scan error: "converting NULL to int64 is unsupported"
- Consistent error messages for count and query operations
- Match patterns from national case repository
- Improve error context in paginated methods
- Convert direct integer values to pointer references
- Use inline pointer creation for nullable database fields
- Update test assertions to dereference pointers properly
- Fix compilation errors in model tests
- Implement paginated methods in national case repository
- Add pagination support to COVID service layer
- Update handlers with pagination parameters and responses
- Add comprehensive integration tests for paginated endpoints
- Maintain backward compatibility with all=true parameter
- Add newline to LICENSE file
- Add newline to Makefile
- Add newline to generate-changelog.rb
Copy link
Contributor

github-actions bot commented Sep 8, 2025

📊 Code Coverage Report

Total Coverage: 45.1%

Coverage by Package

Package Coverage
cmd 0.0%
docs 0.0%
internal/config 0.0%
internal/handler 75.9%
internal/middleware 57.5%
internal/models 98.1%
internal/repository 51.2%
internal/service 28.1%
pkg/database 0.0%
pkg/utils 50.0%

Detailed Coverage

Click to expand detailed coverage
github.com/banua-coder/pico-api-go/cmd/main.go:47:					main						0.0%
github.com/banua-coder/pico-api-go/docs/docs.go:830:					init						0.0%
github.com/banua-coder/pico-api-go/internal/config/config.go:42:			Load						0.0%
github.com/banua-coder/pico-api-go/internal/config/config.go:72:			getEnv						0.0%
github.com/banua-coder/pico-api-go/internal/config/config.go:79:			getEnvAsInt					0.0%
github.com/banua-coder/pico-api-go/internal/config/config.go:88:			getEnvAsDuration				0.0%
github.com/banua-coder/pico-api-go/internal/config/config.go:97:			getEnvAsBool					0.0%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:19:		NewCovidHandler					100.0%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:50:		GetNationalCases				84.6%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:126:		GetLatestNationalCase				77.8%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:155:		GetProvinces					69.2%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:199:		GetProvinceCases				63.6%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:334:		HealthCheck					64.7%
github.com/banua-coder/pico-api-go/internal/handler/covid_handler.go:391:		GetAPIIndex					100.0%
github.com/banua-coder/pico-api-go/internal/handler/response.go:16:			writeJSONResponse				75.0%
github.com/banua-coder/pico-api-go/internal/handler/response.go:24:			writeSuccessResponse				100.0%
github.com/banua-coder/pico-api-go/internal/handler/response.go:31:			writeErrorResponse				100.0%
github.com/banua-coder/pico-api-go/internal/handler/routes.go:11:			SetupRoutes					0.0%
github.com/banua-coder/pico-api-go/internal/middleware/cors.go:7:			CORS						0.0%
github.com/banua-coder/pico-api-go/internal/middleware/logging.go:15:			WriteHeader					0.0%
github.com/banua-coder/pico-api-go/internal/middleware/logging.go:20:			Write						0.0%
github.com/banua-coder/pico-api-go/internal/middleware/logging.go:26:			Logging						0.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:22:			writeRateLimitError				80.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:51:			NewRateLimiter					100.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:68:			Stop						100.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:76:			cleanup						75.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:88:			cleanOldClients					100.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:107:		getClientIP					100.0%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:134:		isAllowed					92.3%
github.com/banua-coder/pico-api-go/internal/middleware/ratelimit.go:183:		RateLimit					100.0%
github.com/banua-coder/pico-api-go/internal/middleware/recovery.go:10:			Recovery					0.0%
github.com/banua-coder/pico-api-go/internal/models/national_case.go:29:			Scan						92.3%
github.com/banua-coder/pico-api-go/internal/models/national_case.go:53:			Value						100.0%
github.com/banua-coder/pico-api-go/internal/models/national_case_response.go:51:	TransformToResponse				100.0%
github.com/banua-coder/pico-api-go/internal/models/national_case_response.go:88:	TransformSliceToResponse			100.0%
github.com/banua-coder/pico-api-go/internal/models/national_case_response.go:97:	calculatePercentages				100.0%
github.com/banua-coder/pico-api-go/internal/models/pagination.go:21:			CalculatePaginationMeta				100.0%
github.com/banua-coder/pico-api-go/internal/models/province_case_response.go:68:	TransformToResponse				90.9%
github.com/banua-coder/pico-api-go/internal/models/province_case_response.go:136:	TransformToResponse				100.0%
github.com/banua-coder/pico-api-go/internal/models/province_case_response.go:141:	TransformProvinceCaseSliceToResponse		100.0%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:28:	NewNationalCaseRepository			100.0%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:32:	GetAll						100.0%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:37:	GetAllSorted					76.5%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:72:	GetByDateRange					100.0%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:77:	GetByDateRangeSorted				76.5%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:114:	GetLatest					87.5%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:135:	GetByDay					87.5%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:156:	GetAllPaginatedSorted				0.0%
github.com/banua-coder/pico-api-go/internal/repository/national_case_repository.go:201:	GetByDateRangePaginatedSorted			0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:37:	NewProvinceCaseRepository			100.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:41:	GetAll						100.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:46:	GetAllSorted					100.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:62:	GetAllPaginated					0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:67:	GetAllPaginatedSorted				0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:100:	GetByProvinceID					100.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:117:	GetByProvinceIDPaginated			0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:152:	GetByProvinceIDAndDateRange			100.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:169:	GetByProvinceIDAndDateRangePaginated		0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:204:	GetByDateRange					0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:221:	GetByDateRangePaginated				0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:256:	GetLatestByProvinceID				85.7%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:282:	queryProvinceCases				78.9%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:327:	buildOrderClause				70.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:361:	GetByProvinceIDSorted				0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:378:	GetByProvinceIDPaginatedSorted			0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:412:	GetByProvinceIDAndDateRangeSorted		0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:429:	GetByProvinceIDAndDateRangePaginatedSorted	0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:463:	GetByDateRangeSorted				0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_case_repository.go:480:	GetByDateRangePaginatedSorted			0.0%
github.com/banua-coder/pico-api-go/internal/repository/province_repository.go:20:	NewProvinceRepository				100.0%
github.com/banua-coder/pico-api-go/internal/repository/province_repository.go:24:	GetAll						76.5%
github.com/banua-coder/pico-api-go/internal/repository/province_repository.go:54:	GetByID						100.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:46:		NewCovidService					100.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:58:		GetNationalCases				100.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:66:		GetNationalCasesSorted				0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:74:		GetNationalCasesByDateRange			90.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:92:		GetNationalCasesByDateRangeSorted		0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:110:		GetLatestNationalCase				75.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:118:		GetProvinces					75.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:126:		GetProvincesWithLatestCase			0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:156:		GetProvinceCases				75.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:164:		GetProvinceCasesByDateRange			70.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:182:		GetAllProvinceCases				75.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:190:		GetAllProvinceCasesSorted			0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:198:		GetAllProvinceCasesByDateRange			70.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:216:		GetProvinceCasesPaginated			0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:224:		GetProvinceCasesByDateRangePaginated		0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:242:		GetAllProvinceCasesPaginated			0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:250:		GetAllProvinceCasesByDateRangePaginated		0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:268:		GetAllProvinceCasesPaginatedSorted		0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:276:		GetAllProvinceCasesByDateRangeSorted		0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:294:		GetAllProvinceCasesByDateRangePaginatedSorted	0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:312:		GetProvinceCasesSorted				0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:320:		GetProvinceCasesPaginatedSorted			0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:328:		GetProvinceCasesByDateRangeSorted		0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:346:		GetProvinceCasesByDateRangePaginatedSorted	0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:364:		GetNationalCasesPaginatedSorted			0.0%
github.com/banua-coder/pico-api-go/internal/service/covid_service.go:372:		GetNationalCasesByDateRangePaginatedSorted	0.0%
github.com/banua-coder/pico-api-go/pkg/database/mysql.go:28:				NewMySQLConnection				0.0%
github.com/banua-coder/pico-api-go/pkg/database/mysql.go:41:				NewMySQLConnectionWithConfig			0.0%
github.com/banua-coder/pico-api-go/pkg/database/mysql.go:101:				DefaultConnectionConfig				0.0%
github.com/banua-coder/pico-api-go/pkg/database/mysql.go:113:				HealthCheck					0.0%
github.com/banua-coder/pico-api-go/pkg/database/mysql.go:131:				GetConnectionStats				0.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:10:				ParseIntQueryParam				100.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:25:				ParseBoolQueryParam				100.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:30:				ParseStringArrayQueryParam			100.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:57:				ParseSortParam					0.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:91:				IsValidSortField				0.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:109:				GetSQLOrderClause				0.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:138:				ValidatePaginationParams			100.0%
github.com/banua-coder/pico-api-go/pkg/utils/query.go:156:				ParsePaginationParams				0.0%
total:											(statements)					45.1%

@ryanaidilp ryanaidilp self-assigned this Sep 8, 2025
@ryanaidilp ryanaidilp merged commit ac7bddc into main Sep 8, 2025
4 checks passed
@ryanaidilp ryanaidilp deleted the feature/pagination-filtering-improvements branch September 8, 2025 14:36
@ryanaidilp ryanaidilp restored the feature/pagination-filtering-improvements branch September 8, 2025 14:38
@ryanaidilp ryanaidilp deleted the feature/pagination-filtering-improvements branch September 8, 2025 14:45
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.

1 participant