NAM-APJATEL-BACKEND/utils/helper/AGENTS.md

1.4 KiB

OVERVIEW: Utility helpers for image upload, geo conversions, and response construction used across NAM backend.

WHERE TO LOOK

  • utils/helper/image_uploader.go
    • Image uploaders: SaveDeviceImagesBulk, SaveTowerImagesBulk
    • Image upload constants: MaxFileSize (5MB), TowerUploadDir, DeviceUploadDir
  • utils/helper/geo_helpers.go
    • Geo helper functions: ConvertToDeviceResponse, ConvertToOLTResponse, etc.
  • utils/helper/response_builder.go
    • Centralized response builders used by delivery layer
  • Additional helper files under utils/helper/ as needed for conversions and validators

CONVENTIONS

  • File naming follows snake_case; exported functions use PascalCase.
  • Constants use CamelCase with explicit units (MaxFileSize int64 = 510241024).
  • Upload directories are defined as constants (TowerUploadDir, DeviceUploadDir) and used across helpers.
  • Errors propagate with context; use standard errors or fmt.Errorf wrappers.
  • Tests should cover public helpers; avoid testing private internals directly.

ANTI-PATTERNS

  • Do not hardcode absolute system paths; rely on defined constants for directories.
  • Do not bloat helper files with business logic; keep them pure and focused.
  • Do not create global mutable state in helpers.
  • Do not introduce circular imports between helper and delivery layers.
  • Do not bypass validation for uploads; enforce MaxFileSize and allowed MIME types.