8c1e593686
- Introduced a new customer management domain, including entities, services, handlers, and forms for customer operations. - Added JWT-based user authorization settings in the configuration file for both user and customer management. - Updated API endpoints to reflect the new structure, including changes to health check and user management routes. - Enhanced Swagger documentation to include new customer-related endpoints and authorization details. - Refactored the Makefile to include a target for generating API documentation. - Removed obsolete documentation files to streamline the project structure.
112 lines
2.7 KiB
Makefile
112 lines
2.7 KiB
Makefile
# Tender Management Backend Makefile
|
|
|
|
.PHONY: help build run test clean docker-build docker-run docs run-docs
|
|
|
|
# Default target
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " build - Build the web server"
|
|
@echo " build-mac - Build for macOS (Intel)"
|
|
@echo " build-mac-arm64 - Build for macOS (Apple Silicon)"
|
|
@echo " build-all - Build for all platforms"
|
|
@echo " run - Run the web server"
|
|
@echo " test - Run tests"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " docker-build - Build Docker image"
|
|
@echo " docker-run - Run Docker container"
|
|
|
|
# Build the web server
|
|
build:
|
|
@echo "Building web server..."
|
|
@mkdir -p bin
|
|
@go build -o bin/web ./cmd/web
|
|
@echo "Build completed successfully!"
|
|
|
|
# Build for macOS (Intel)
|
|
build-mac:
|
|
@echo "Building web server for macOS (Intel)..."
|
|
@mkdir -p bin
|
|
@GOOS=darwin GOARCH=amd64 go build -o bin/web-mac ./cmd/web
|
|
@echo "macOS Intel build completed successfully!"
|
|
|
|
# Build for macOS (Apple Silicon)
|
|
build-mac-arm64:
|
|
@echo "Building web server for macOS (Apple Silicon)..."
|
|
@mkdir -p bin
|
|
@GOOS=darwin GOARCH=arm64 go build -o bin/web-mac-arm64 ./cmd/web
|
|
@echo "macOS ARM64 build completed successfully!"
|
|
|
|
# Build for all platforms
|
|
build-all: build build-mac build-mac-arm64
|
|
@echo "All platform builds completed successfully!"
|
|
|
|
# Run the web server
|
|
run: build
|
|
@echo "Starting web server..."
|
|
@./bin/web
|
|
|
|
# Run tests
|
|
test:
|
|
@echo "Running tests..."
|
|
@go test ./...
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
@echo "Cleaning build artifacts..."
|
|
@rm -rf bin/
|
|
@go clean
|
|
|
|
# Build Docker image
|
|
docker-build:
|
|
@echo "Building Docker image..."
|
|
@docker build -t tender-management-api .
|
|
|
|
# Run Docker container
|
|
docker-run:
|
|
@echo "Running Docker container..."
|
|
@docker run -p 8081:8081 tender-management-api
|
|
|
|
# Development with hot reload (requires air)
|
|
dev:
|
|
@echo "Starting development server with hot reload..."
|
|
@air
|
|
|
|
# Install development dependencies
|
|
install-dev:
|
|
@echo "Installing development dependencies..."
|
|
@go install github.com/cosmtrek/air@latest
|
|
|
|
# Format code
|
|
fmt:
|
|
@echo "Formatting code..."
|
|
@go fmt ./...
|
|
|
|
# Vet code
|
|
vet:
|
|
@echo "Vetting code..."
|
|
@go vet ./...
|
|
|
|
# Lint code (requires golangci-lint)
|
|
lint:
|
|
@echo "Linting code..."
|
|
@golangci-lint run
|
|
|
|
# Generate API documentation
|
|
# Marked as .PHONY to avoid collision with the top-level docs directory
|
|
docs:
|
|
@echo "Generating API documentation..."
|
|
@swag init -g cmd/web/main.go -o cmd/web/docs
|
|
@echo "Swagger documentation generated successfully!"
|
|
|
|
# Run server with documentation
|
|
run-docs: docs run
|
|
|
|
# Database migrations (placeholder)
|
|
migrate:
|
|
@echo "Running database migrations..."
|
|
@echo "TODO: Implement database migrations"
|
|
|
|
# Seed database (placeholder)
|
|
seed:
|
|
@echo "Seeding database..."
|
|
@echo "TODO: Implement database seeding"
|