mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-07 16:16:37 +08:00
refactor(layout): relocate go.mod to backend/ and clean import paths to module root
- Relocated go.mod and go.sum into backend/ root directory - Stripped redundant backend/ segments from all Go imports (github.com/Rain-kl/Wavelet/...) - Unified Makefile, swagger, and build-test to execute in backend/ module context - Ensured 100% build-test, code-check, format, and swagger pass
This commit is contained in:
@@ -33,7 +33,7 @@ package order
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed migrations/*.sql
|
//go:embed migrations/*.sql
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/internal/apps/upload"
|
"github.com/Rain-kl/Wavelet/internal/apps/upload"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/model"
|
"github.com/Rain-kl/Wavelet/pkg/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ingestMirrorFile(ctx context.Context, userID uint64, data []byte, hash, filename, mime, ext string) (model.Upload, error) {
|
func ingestMirrorFile(ctx context.Context, userID uint64, data []byte, hash, filename, mime, ext string) (model.Upload, error) {
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ backend/plugins/domain/order/
|
|||||||
package order
|
package order
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Plugin struct {
|
type Plugin struct {
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ package user
|
|||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p *Plugin) Apply(ctx *core.Context) error {
|
func (p *Plugin) Apply(ctx *core.Context) error {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/internal/apps/admin/push"
|
"github.com/Rain-kl/Wavelet/internal/apps/admin/push"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/listener"
|
"github.com/Rain-kl/Wavelet/pkg/listener"
|
||||||
)
|
)
|
||||||
|
|
||||||
var NewUserRegistered = push.EventMetadata{
|
var NewUserRegistered = push.EventMetadata{
|
||||||
@@ -84,7 +84,7 @@ func Register() {
|
|||||||
在业务逻辑完成处(如 `internal/apps/user/routers.go`)仅 import `internal/listener` 并发射事件:
|
在业务逻辑完成处(如 `internal/apps/user/routers.go`)仅 import `internal/listener` 并发射事件:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/Rain-kl/Wavelet/backend/pkg/listener"
|
import "github.com/Rain-kl/Wavelet/pkg/listener"
|
||||||
|
|
||||||
func Register(c *gin.Context) {
|
func Register(c *gin.Context) {
|
||||||
// ... 注册成功逻辑 ...
|
// ... 注册成功逻辑 ...
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
VERSION ?= dev
|
VERSION ?= dev
|
||||||
BUILD_DATE ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
|
BUILD_DATE ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
MODULE := $(shell go list -m)
|
MODULE := $(shell cd backend && go list -m)
|
||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
scripts/swagger.sh
|
scripts/swagger.sh
|
||||||
@@ -15,7 +15,7 @@ license-check:
|
|||||||
|
|
||||||
format:
|
format:
|
||||||
@echo "==> Formatting backend Go source..."
|
@echo "==> Formatting backend Go source..."
|
||||||
gofmt -w $$(find . -type f -name '*.go' -not -path './.git/*' -not -path './frontend/*')
|
gofmt -w $$(find backend -type f -name '*.go' -not -path './.git/*')
|
||||||
@echo "==> Formatting frontend source..."
|
@echo "==> Formatting frontend source..."
|
||||||
cd frontend && pnpm format
|
cd frontend && pnpm format
|
||||||
|
|
||||||
@@ -27,11 +27,11 @@ build-embedded:
|
|||||||
pnpm build:embed
|
pnpm build:embed
|
||||||
rm -rf backend/plugins/drivers/driver_http/dist
|
rm -rf backend/plugins/drivers/driver_http/dist
|
||||||
cp -R frontend/out backend/plugins/drivers/driver_http/dist
|
cp -R frontend/out backend/plugins/drivers/driver_http/dist
|
||||||
go build \
|
cd backend && go build \
|
||||||
-tags embed_frontend \
|
-tags embed_frontend \
|
||||||
-ldflags "-s -w -X '$(MODULE)/backend/pkg/buildinfo.Version=$(VERSION)' -X '$(MODULE)/backend/pkg/buildinfo.BuildTime=$(BUILD_DATE)'" \
|
-ldflags "-s -w -X '$(MODULE)/pkg/buildinfo.Version=$(VERSION)' -X '$(MODULE)/pkg/buildinfo.BuildTime=$(BUILD_DATE)'" \
|
||||||
-o bin/wavelet \
|
-o ../bin/wavelet \
|
||||||
backend/main.go
|
main.go
|
||||||
|
|
||||||
code-check:
|
code-check:
|
||||||
@echo "==> Architecture guards..."
|
@echo "==> Architecture guards..."
|
||||||
@@ -54,7 +54,7 @@ code-check:
|
|||||||
@echo " → plugins/domain/ must not import other plugins/domain/..."
|
@echo " → plugins/domain/ must not import other plugins/domain/..."
|
||||||
@for d in backend/plugins/domain/*/; do \
|
@for d in backend/plugins/domain/*/; do \
|
||||||
name=$$(basename $$d); \
|
name=$$(basename $$d); \
|
||||||
imports=$$(rg -n '"github.com/Rain-kl/Wavelet/backend/plugins/domain/' backend/plugins/domain/"$$name" -g '*.go' 2>/dev/null | rg -v "backend/plugins/domain/$$name/" | rg -v '_test.go' || true); \
|
imports=$$(rg -n '"$(MODULE)/plugins/domain/' backend/plugins/domain/"$$name" -g '*.go' 2>/dev/null | rg -v "backend/plugins/domain/$$name/" | rg -v '_test.go' || true); \
|
||||||
if [ -n "$$imports" ]; then \
|
if [ -n "$$imports" ]; then \
|
||||||
echo "error: backend/plugins/domain/$$name must not import other domain plugins" >&2; \
|
echo "error: backend/plugins/domain/$$name must not import other domain plugins" >&2; \
|
||||||
echo "$$imports" >&2; \
|
echo "$$imports" >&2; \
|
||||||
@@ -62,15 +62,15 @@ code-check:
|
|||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@echo " → Architecture guards PASS"
|
@echo " → Architecture guards PASS"
|
||||||
golangci-lint run ./backend/...
|
cd backend && golangci-lint run
|
||||||
cd frontend && pnpm tsc --noEmit --jsx preserve && npx eslint . --max-warnings 0
|
cd frontend && pnpm tsc --noEmit --jsx preserve && npx eslint . --max-warnings 0
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
@echo "==> Building backend version=$(VERSION) build_date=$(BUILD_DATE)..."
|
@echo "==> Building backend version=$(VERSION) build_date=$(BUILD_DATE)..."
|
||||||
go build \
|
cd backend && go build \
|
||||||
-ldflags "-s -w -X '$(MODULE)/backend/pkg/buildinfo.Version=$(VERSION)' -X '$(MODULE)/backend/pkg/buildinfo.BuildTime=$(BUILD_DATE)'" \
|
-ldflags "-s -w -X '$(MODULE)/pkg/buildinfo.Version=$(VERSION)' -X '$(MODULE)/pkg/buildinfo.BuildTime=$(BUILD_DATE)'" \
|
||||||
-o bin/wavelet \
|
-o ../bin/wavelet \
|
||||||
backend/main.go
|
main.go
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
@echo "==> Building frontend version=$(VERSION) build_date=$(BUILD_DATE)..."
|
@echo "==> Building frontend version=$(VERSION) build_date=$(BUILD_DATE)..."
|
||||||
@@ -84,7 +84,7 @@ build-test:
|
|||||||
@PIDS=""; \
|
@PIDS=""; \
|
||||||
STATUS=0; \
|
STATUS=0; \
|
||||||
( cd frontend && pnpm build:embed 2>&1 | sed 's/^/[frontend] /' ) & PIDS="$$PIDS $$!"; \
|
( cd frontend && pnpm build:embed 2>&1 | sed 's/^/[frontend] /' ) & PIDS="$$PIDS $$!"; \
|
||||||
( go test ./... && go build -o /dev/null ./... 2>&1 | sed 's/^/[backend] /' ) & PIDS="$$PIDS $$!"; \
|
( cd backend && go test ./... && go build -o /dev/null ./... 2>&1 | sed 's/^/[backend] /' ) & PIDS="$$PIDS $$!"; \
|
||||||
for PID in $$PIDS; do \
|
for PID in $$PIDS; do \
|
||||||
wait $$PID || STATUS=1; \
|
wait $$PID || STATUS=1; \
|
||||||
done; \
|
done; \
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+18
-18
@@ -10,24 +10,24 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/admin"
|
"github.com/Rain-kl/Wavelet/plugins/domain/admin"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/cap"
|
"github.com/Rain-kl/Wavelet/plugins/domain/cap"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/system"
|
"github.com/Rain-kl/Wavelet/plugins/domain/system"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/upload"
|
"github.com/Rain-kl/Wavelet/plugins/domain/upload"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/user"
|
"github.com/Rain-kl/Wavelet/plugins/domain/user"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_cron"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_cron"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_worker"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_worker"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_http"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_http"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
"github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
infradb "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
infradb "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/logger"
|
"github.com/Rain-kl/Wavelet/plugins/infra/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/storage"
|
"github.com/Rain-kl/Wavelet/plugins/infra/storage"
|
||||||
"github.com/pressly/goose/v3"
|
"github.com/pressly/goose/v3"
|
||||||
goosedb "github.com/pressly/goose/v3/database"
|
goosedb "github.com/pressly/goose/v3/database"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewWaveletAppProfiles(t *testing.T) {
|
func TestNewWaveletAppProfiles(t *testing.T) {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/buildinfo"
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
//nolint:unused // startup banner formatting utilities
|
//nolint:unused // startup banner formatting utilities
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/buildinfo"
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFormatStartupBanner(t *testing.T) {
|
func TestFormatStartupBanner(t *testing.T) {
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
userdomain "github.com/Rain-kl/Wavelet/backend/plugins/domain/user"
|
userdomain "github.com/Rain-kl/Wavelet/plugins/domain/user"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
"github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/testhelper"
|
"github.com/Rain-kl/Wavelet/pkg/testhelper"
|
||||||
userdomain "github.com/Rain-kl/Wavelet/backend/plugins/domain/user"
|
userdomain "github.com/Rain-kl/Wavelet/plugins/domain/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResetPasswdCmd_WithUserAndPassword(t *testing.T) {
|
func TestResetPasswdCmd_WithUserAndPassword(t *testing.T) {
|
||||||
|
|||||||
+4
-4
@@ -9,10 +9,10 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/buildinfo"
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/trace"
|
"github.com/Rain-kl/Wavelet/pkg/trace"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
// appMockDriver is a test driver tracking its start/stop lifecycle.
|
// appMockDriver is a test driver tracking its start/stop lifecycle.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Context is the central micro-kernel service bus and runtime lifecycle container.
|
// Context is the central micro-kernel service bus and runtime lifecycle container.
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sample services for testing
|
// Sample services for testing
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserRegisteredEvent struct {
|
type UserRegisteredEvent struct {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRouterExtension(t *testing.T) {
|
func TestRouterExtension(t *testing.T) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Standard sentinel errors returned by core operations.
|
// Standard sentinel errors returned by core operations.
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ package custom_example
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
// Package main 是 Wavelet 平台的程序入口
|
// Package main 是 Wavelet 平台的程序入口
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/Rain-kl/Wavelet/backend/cmd"
|
import "github.com/Rain-kl/Wavelet/cmd"
|
||||||
|
|
||||||
// @title Wavelet API
|
// @title Wavelet API
|
||||||
// @version 1.0.0
|
// @version 1.0.0
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/bwmarrin/snowflake"
|
"github.com/bwmarrin/snowflake"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
package testhelper
|
package testhelper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/alicebob/miniredis/v2"
|
"github.com/alicebob/miniredis/v2"
|
||||||
"github.com/glebarez/sqlite"
|
"github.com/glebarez/sqlite"
|
||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/httppool"
|
"github.com/Rain-kl/Wavelet/pkg/httppool"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsLocalhost 检查 URL 是否为 localhost
|
// IsLocalhost 检查 URL 是否为 localhost
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
"github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/storage/diskcache"
|
"github.com/Rain-kl/Wavelet/plugins/infra/storage/diskcache"
|
||||||
)
|
)
|
||||||
|
|
||||||
type updateCacheConfigRequest struct {
|
type updateCacheConfigRequest struct {
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
mail "github.com/Rain-kl/Wavelet/backend/pkg/mail"
|
mail "github.com/Rain-kl/Wavelet/pkg/mail"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/cap"
|
"github.com/Rain-kl/Wavelet/plugins/domain/cap"
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/storage/objectstore"
|
"github.com/Rain-kl/Wavelet/plugins/infra/storage/objectstore"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_worker"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_worker"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
|
||||||
)
|
)
|
||||||
|
|
||||||
var startTime = time.Now()
|
var startTime = time.Now()
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_cron"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_cron"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_worker"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListTaskTypes 获取支持的任务类型列表
|
// ListTaskTypes 获取支持的任务类型列表
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateTemplateRequest 创建模板请求
|
// CreateTemplateRequest 创建模板请求
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"golang.org/x/mod/semver"
|
"golang.org/x/mod/semver"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/buildinfo"
|
"github.com/Rain-kl/Wavelet/pkg/buildinfo"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
|
"github.com/Rain-kl/Wavelet/pkg/idgen"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const minPasswordLength = 8
|
const minPasswordLength = 8
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/trace"
|
"github.com/Rain-kl/Wavelet/pkg/trace"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/admin"
|
"github.com/Rain-kl/Wavelet/plugins/domain/admin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAdminPluginUnit(t *testing.T) {
|
func TestAdminPluginUnit(t *testing.T) {
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ import (
|
|||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/cache/ram"
|
"github.com/Rain-kl/Wavelet/pkg/cache/ram"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
|
"github.com/Rain-kl/Wavelet/pkg/idgen"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
const installedBinaryMode = 0o755
|
const installedBinaryMode = 0o755
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import (
|
|||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/cache/ram"
|
"github.com/Rain-kl/Wavelet/pkg/cache/ram"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
"github.com/redis/go-redis/v9/maintnotifications"
|
"github.com/redis/go-redis/v9/maintnotifications"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
"github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
"github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupSystemConfigTest(t *testing.T) (*gorm.DB, func()) {
|
func setupSystemConfigTest(t *testing.T) (*gorm.DB, func()) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
|
|
||||||
"github.com/coreos/go-oidc/v3/oidc"
|
"github.com/coreos/go-oidc/v3/oidc"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/cache/ram"
|
"github.com/Rain-kl/Wavelet/pkg/cache/ram"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import (
|
|||||||
"github.com/redis/go-redis/v9"
|
"github.com/redis/go-redis/v9"
|
||||||
"github.com/redis/go-redis/v9/maintnotifications"
|
"github.com/redis/go-redis/v9/maintnotifications"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupOauthCacheTest(t *testing.T) (*miniredis.Miniredis, func()) {
|
func setupOauthCacheTest(t *testing.T) (*miniredis.Miniredis, func()) {
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
|
"github.com/Rain-kl/Wavelet/pkg/idgen"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/coreos/go-oidc/v3/oidc"
|
"github.com/coreos/go-oidc/v3/oidc"
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/trace"
|
"github.com/Rain-kl/Wavelet/pkg/trace"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var authSourceNamePattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$`)
|
var authSourceNamePattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$`)
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed migrations/*.sql
|
//go:embed migrations/*.sql
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testUser struct {
|
type testUser struct {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package auth
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetAuthSourceByID 根据 ID 获取认证源
|
// GetAuthSourceByID 根据 ID 获取认证源
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ package cap
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/cap/pow"
|
"github.com/Rain-kl/Wavelet/plugins/domain/cap/pow"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/cap/pow"
|
"github.com/Rain-kl/Wavelet/plugins/domain/cap/pow"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package cap
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VerifyMiddleware returns a Gin middleware that checks and consumes the X-Cap-Token header.
|
// VerifyMiddleware returns a Gin middleware that checks and consumes the X-Cap-Token header.
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
package cap
|
package cap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Plugin implements core.Plugin to provide CAPTCHA generation, validation, and route protection.
|
// Plugin implements core.Plugin to provide CAPTCHA generation, validation, and route protection.
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/sync/singleflight"
|
"golang.org/x/sync/singleflight"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
database "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
database "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/admin"
|
"github.com/Rain-kl/Wavelet/plugins/domain/admin"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/auth"
|
"github.com/Rain-kl/Wavelet/plugins/domain/auth"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/user"
|
"github.com/Rain-kl/Wavelet/plugins/domain/user"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
"github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/logger"
|
"github.com/Rain-kl/Wavelet/plugins/infra/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/infra/storage"
|
"github.com/Rain-kl/Wavelet/plugins/infra/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupTestDB(t *testing.T) *gorm.DB {
|
func setupTestDB(t *testing.T) *gorm.DB {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
"github.com/tencent-connect/botgo"
|
"github.com/tencent-connect/botgo"
|
||||||
"github.com/tencent-connect/botgo/dto"
|
"github.com/tencent-connect/botgo/dto"
|
||||||
"github.com/tencent-connect/botgo/event"
|
"github.com/tencent-connect/botgo/event"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHandleEvent_DropsNonC2C(t *testing.T) {
|
func TestHandleEvent_DropsNonC2C(t *testing.T) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
tele "gopkg.in/telebot.v4"
|
tele "gopkg.in/telebot.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
tele "gopkg.in/telebot.v4"
|
tele "gopkg.in/telebot.v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdminLogin is the metadata definition for the admin login event.
|
// AdminLogin is the metadata definition for the admin login event.
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/testhelper"
|
"github.com/Rain-kl/Wavelet/pkg/testhelper"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUpsertPairingCode_ReusesUnexpired(t *testing.T) {
|
func TestUpsertPairingCode_ReusesUnexpired(t *testing.T) {
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/extpoints"
|
"github.com/Rain-kl/Wavelet/core/extpoints"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core"
|
"github.com/Rain-kl/Wavelet/core"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMessageGatewayPluginUnit(t *testing.T) {
|
func TestMessageGatewayPluginUnit(t *testing.T) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/httppool"
|
"github.com/Rain-kl/Wavelet/pkg/httppool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"net/smtp"
|
"net/smtp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/httppool"
|
"github.com/Rain-kl/Wavelet/pkg/httppool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/httppool"
|
"github.com/Rain-kl/Wavelet/pkg/httppool"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
pkgpush "github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway/push"
|
pkgpush "github.com/Rain-kl/Wavelet/plugins/domain/message_gateway/push"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
|
|
||||||
pkgpush "github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway/push"
|
pkgpush "github.com/Rain-kl/Wavelet/plugins/domain/message_gateway/push"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
pkgpush "github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway/push"
|
pkgpush "github.com/Rain-kl/Wavelet/plugins/domain/message_gateway/push"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
pkgpush "github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway/push"
|
pkgpush "github.com/Rain-kl/Wavelet/plugins/domain/message_gateway/push"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_worker"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_worker"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_worker"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterTaskListeners subscribes push notification handlers to task completion events.
|
// RegisterTaskListeners subscribes push notification handlers to task completion events.
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/message_gateway/push"
|
"github.com/Rain-kl/Wavelet/plugins/domain/message_gateway/push"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/drivers/driver_asynq_worker"
|
"github.com/Rain-kl/Wavelet/plugins/drivers/driver_asynq_worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import (
|
|||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
|
"github.com/Rain-kl/Wavelet/pkg/idgen"
|
||||||
cachepkg "github.com/Rain-kl/Wavelet/backend/plugins/infra/cache"
|
cachepkg "github.com/Rain-kl/Wavelet/plugins/infra/cache"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Runner manages lifecycle for long-lived channel adapters (WebSocket, long-polling, etc.).
|
// Runner manages lifecycle for long-lived channel adapters (WebSocket, long-polling, etc.).
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CredentialKey is AES-256 hex derived from the session secret.
|
// CredentialKey is AES-256 hex derived from the session secret.
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/batchwriter"
|
"github.com/Rain-kl/Wavelet/pkg/batchwriter"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const hoursInDay = 24
|
const hoursInDay = 24
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupChGormDB(t *testing.T) *gorm.DB {
|
func setupChGormDB(t *testing.T) *gorm.DB {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BatchInsert writes access logs to ClickHouse using the native batch API.
|
// BatchInsert writes access logs to ClickHouse using the native batch API.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
|
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type clickhouseUserAccessLogStore struct {
|
type clickhouseUserAccessLogStore struct {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
|
"github.com/Rain-kl/Wavelet/pkg/idgen"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import (
|
|||||||
// plugins/domain 不得直接 import 已废弃的 internal。
|
// plugins/domain 不得直接 import 已废弃的 internal。
|
||||||
var forbiddenImports = []string{
|
var forbiddenImports = []string{
|
||||||
"github.com/Rain-kl/Wavelet/internal",
|
"github.com/Rain-kl/Wavelet/internal",
|
||||||
"github.com/Rain-kl/Wavelet/backend/internal",
|
"github.com/Rain-kl/Wavelet/internal",
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAppsMustNotImportPersistenceDirectly(t *testing.T) {
|
func TestAppsMustNotImportPersistenceDirectly(t *testing.T) {
|
||||||
t.Chdir("../../../../..")
|
t.Chdir("../../../..")
|
||||||
out, err := exec.Command("go", "list", "-test", "-f", `{{.ImportPath}} {{join .Imports " "}}`, "./backend/plugins/domain/...").Output()
|
out, err := exec.Command("go", "list", "-test", "-f", `{{.ImportPath}} {{join .Imports " "}}`, "./plugins/domain/...").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("go list: %v", err)
|
t.Fatalf("go list: %v", err)
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ func TestAppsMustNotImportPersistenceDirectly(t *testing.T) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
pkg := fields[0]
|
pkg := fields[0]
|
||||||
if !strings.HasPrefix(pkg, "github.com/Rain-kl/Wavelet/backend/plugins/domain") {
|
if !strings.HasPrefix(pkg, "github.com/Rain-kl/Wavelet/plugins/domain") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, imp := range fields[1:] {
|
for _, imp := range fields[1:] {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/logger"
|
"github.com/Rain-kl/Wavelet/pkg/logger"
|
||||||
db "github.com/Rain-kl/Wavelet/backend/plugins/infra/database"
|
db "github.com/Rain-kl/Wavelet/plugins/infra/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Rain-kl/Wavelet/backend/core/contracts"
|
"github.com/Rain-kl/Wavelet/core/contracts"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/config"
|
"github.com/Rain-kl/Wavelet/pkg/config"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/idgen"
|
"github.com/Rain-kl/Wavelet/pkg/idgen"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/response"
|
"github.com/Rain-kl/Wavelet/pkg/response"
|
||||||
"github.com/Rain-kl/Wavelet/backend/pkg/util"
|
"github.com/Rain-kl/Wavelet/pkg/util"
|
||||||
"github.com/Rain-kl/Wavelet/backend/plugins/domain/risk_control/logstore"
|
"github.com/Rain-kl/Wavelet/plugins/domain/risk_control/logstore"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user