add dukcapil

This commit is contained in:
Aditya Siregar
2026-05-07 04:01:32 +07:00
parent 9a975d146e
commit bc64eb20ea
235 changed files with 1197 additions and 28187 deletions
+57 -58
View File
@@ -1,9 +1,11 @@
#PROJECT_NAME = "enaklo-pos-backend"
DB_USERNAME :=eslogad_user
DB_PASSWORD :=M9u%24e%23jT2%40qR4pX%21zL
DB_HOST :=103.191.71.2
DB_PORT :=5432
DB_NAME :=eslogad_db
# Go Backend Template Makefile
# Database configuration (update these for your project)
DB_USERNAME := postgres
DB_PASSWORD := postgres
DB_HOST := localhost
DB_PORT := 5432
DB_NAME := template_db
DB_URL = postgres://$(DB_USERNAME):$(DB_PASSWORD)@$(DB_HOST):$(DB_PORT)/$(DB_NAME)?sslmode=disable
@@ -19,45 +21,31 @@ help:
@echo "Usage: make [command]"
@echo
@echo "Commands:"
@echo " rename-project name={name} Rename project"
@echo
@echo " build-http Build http server"
@echo
@echo " migration-create name={name} Create migration"
@echo " migration-up Up migrations"
@echo " migration-down Down last migration"
@echo
@echo " docker-up Up docker services"
@echo " docker-down Down docker services"
@echo
@echo " fmt Format source code"
@echo " build Build the application"
@echo " run Run the application"
@echo " test Run unit tests"
@echo " fmt Format source code"
@echo
@echo " migration-create name={name} Create a new migration"
@echo " migration-up Run all pending migrations"
@echo " migration-down Rollback last migration"
@echo
@echo " docker-up Start docker services"
@echo " docker-down Stop docker services"
@echo
# Build
.SILENT: rename-project
rename-project:
ifeq ($(name),)
@echo 'new project name not set'
else
ifeq ($(DETECTED_OS),Darwin)
@grep -RiIl '$(PROJECT_NAME)' | xargs sed -i '' 's/$(PROJECT_NAME)/$(name)/g'
endif
.SILENT: build
build:
@go build -o ./bin/server ./cmd/server/main.go
@echo "✓ Binary built: ./bin/server"
ifeq ($(DETECTED_OS),Linux)
@grep -RiIl '$(PROJECT_NAME)' | xargs sed -i 's/$(PROJECT_NAME)/$(name)/g'
endif
# Run
ifeq ($(DETECTED_OS),Windows)
@grep 'target is not implemented on Windows platform'
endif
endif
.SILENT: build-http
build-http:
@go build -o ./bin/http-server ./cmd/http/main.go
@echo executable file \"http-server\" saved in ./bin/http-server
.SILENT: run
run:
@ENV_MODE=development go run cmd/server/main.go
# Test
@@ -65,51 +53,62 @@ build-http:
test:
@go test ./... -v
# Create migration
# Format
.SILENT: fmt
fmt:
@go fmt ./...
@echo "✓ Code formatted"
# Migrations
.SILENT: migration-create
migration-create:
@if [ -z "$(name)" ]; then \
echo "Error: name parameter is required"; \
echo "Usage: make migration-create name=your_migration_name"; \
exit 1; \
fi
@migrate create -ext sql -dir ./migrations -seq $(name)
# Up migration
@echo "✓ Migration created: $(name)"
.SILENT: migration-up
migration-up:
@migrate -database $(DB_URL) -path ./migrations up
# Down migration
@echo "✓ Migrations applied"
.SILENT: migration-down
migration-down:
@migrate -database $(DB_URL) -path ./migrations down 1
.SILENT: seeder-create
seeder-create:
@migrate create -ext sql -dir ./seeders -seq $(name)
.SILENT: seeder-up
seeder-up:
@migrate -database $(DB_URL) -path ./seeders up
@echo "✓ Last migration rolled back"
# Docker
.SILENT: docker-up
docker-up:
@docker-compose up -d
@echo "✓ Docker services started"
.SILENT: docker-down
docker-down:
@docker-compose down
@echo "✓ Docker services stopped"
# Format
# Dependencies
.SILENT: fmt
fmt:
@go fmt ./...
.SILENT: deps
deps:
@go mod download
@go mod tidy
@echo "✓ Dependencies updated"
start:
go run main.go --env-path .env
# Clean
.SILENT: clean
clean:
@rm -rf ./bin
@echo "✓ Build artifacts cleaned"
# Default
.DEFAULT_GOAL := help
.DEFAULT_GOAL := help