2026-07-10 12:54:45 +00:00
|
|
|
|
# 只保留會重複打的指令;其餘直接 go / migrate。
|
|
|
|
|
|
|
2026-07-13 01:15:30 +00:00
|
|
|
|
.PHONY: build test test-integration gen-api tidy migrate-up migrate-down
|
2026-07-10 12:54:45 +00:00
|
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
|
|
go build -o bin/gateway .
|
|
|
|
|
|
go build -o bin/worker ./cmd/worker
|
|
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
|
go test ./...
|
|
|
|
|
|
|
2026-07-13 01:15:30 +00:00
|
|
|
|
# M1–M5 integration gates
|
|
|
|
|
|
test-integration:
|
|
|
|
|
|
go test ./internal/module/member/usecase/ ./internal/middleware/ \
|
|
|
|
|
|
./internal/module/threads/... ./internal/module/job/... ./internal/module/appnotif/... \
|
|
|
|
|
|
./internal/module/usage/... ./internal/module/ai/... ./internal/module/search/... \
|
|
|
|
|
|
./internal/module/permission/... ./internal/module/studio/... \
|
|
|
|
|
|
./internal/module/inspire/... ./internal/module/scout/... \
|
|
|
|
|
|
./internal/logic/extension/ ./internal/logic/media/ \
|
|
|
|
|
|
-count=1 -timeout 180s
|
|
|
|
|
|
|
2026-07-10 12:54:45 +00:00
|
|
|
|
# 改 generate/api/*.api 後執行;handler 勿手寫
|
|
|
|
|
|
gen-api:
|
|
|
|
|
|
goctl api go -api generate/api/gateway.api -dir . -style go_zero --home generate/goctl
|
|
|
|
|
|
|
|
|
|
|
|
tidy:
|
|
|
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
|
|
|
|
# DB:檔案在 generate/database/mongo;需本機已裝 migrate(mongodb tag)
|
|
|
|
|
|
# 例:MONGO_URL=mongodb://127.0.0.1:27017/haixun
|
|
|
|
|
|
MONGO_URL ?= mongodb://127.0.0.1:27017/haixun
|
|
|
|
|
|
|
|
|
|
|
|
migrate-up:
|
|
|
|
|
|
migrate -path generate/database/mongo -database "$(MONGO_URL)" up
|
|
|
|
|
|
|
|
|
|
|
|
migrate-down:
|
|
|
|
|
|
migrate -path generate/database/mongo -database "$(MONGO_URL)" down 1
|