refactor: export full Gregorian range, add timezone fallback, cleanup rate limit, configurable schema path
- GenerateMonthlyReport now takes explicit Gregorian start/end range, computed via monthGregorianRange, so Jalali/Hijri months spanning two Gregorian months are fully covered in exports. - Added loadLocation helper (UTC fallback on error) and replaced all 11 ignored-error call sites in handlers + export. - Added periodicCleanup goroutine in NewHandler to prevent unbounded growth of the rateLimit map. - schemaPath is now read from SCHEMA_PATH env var (init), defaulting to /app/db/schema.sql. - Migrated sendDayView to use sendOrEdit helper, removing duplicated send/edit branching. - Removed dead code: userYearMonthToGregorian (unused), the old startOffset function (replaced). - Updated README with calendar docs, new env vars, full project tree. - Updated .env.example and docker-compose.yml with SCHEMA_PATH. - Simplified Makefile: added fmt, tidy, check, run-dev targets; removed broken Make-glob prerequisite pattern.
This commit is contained in:
24
Makefile
24
Makefile
@@ -1,24 +1,33 @@
|
||||
.PHONY: build run test clean docker docker-run lint vet
|
||||
|
||||
BINARY=worktime-bot
|
||||
BUILD_DIR=.build
|
||||
|
||||
build: $(BUILD_DIR)/$(BINARY)
|
||||
.PHONY: all build run test clean fmt tidy vet check docker docker-run
|
||||
|
||||
$(BUILD_DIR)/$(BINARY): cmd/bot/*.go internal/**/*.go go.mod go.sum
|
||||
mkdir -p $(BUILD_DIR)
|
||||
all: build test check
|
||||
|
||||
build:
|
||||
go build -o $(BUILD_DIR)/$(BINARY) ./cmd/bot/
|
||||
|
||||
run: build
|
||||
$(BUILD_DIR)/$(BINARY)
|
||||
|
||||
run-dev:
|
||||
go run ./cmd/bot/
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
lint: vet
|
||||
fmt:
|
||||
go fmt ./...
|
||||
|
||||
tidy:
|
||||
go mod tidy
|
||||
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
check: fmt vet
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
@@ -27,6 +36,3 @@ docker:
|
||||
|
||||
docker-run: docker
|
||||
docker compose up -d
|
||||
|
||||
.PHONY: all
|
||||
all: build test lint
|
||||
|
||||
Reference in New Issue
Block a user