初步实现审计

This commit is contained in:
2025-09-28 00:13:47 +08:00
parent b177781fa1
commit 1c7e13b965
9 changed files with 324 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ import (
"time"
"git.huangwc.com/pig/pig-farm-controller/internal/app/api"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/audit"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/device"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/task"
"git.huangwc.com/pig/pig-farm-controller/internal/app/service/token"
@@ -81,6 +82,12 @@ func NewApplication(configPath string) (*Application, error) {
// 初始化待采集请求仓库
pendingCollectionRepo := repository.NewGormPendingCollectionRepository(storage.GetDB())
// 初始化审计日志仓库
userActionLogRepo := repository.NewGormUserActionLogRepository(storage.GetDB())
// 初始化审计服务
auditService := audit.NewService(userActionLogRepo, logger)
// 初始化设备上行监听器
listenHandler := transport.NewChirpStackListener(logger, sensorDataRepo, deviceRepo, deviceCommandLogRepo, pendingCollectionRepo)
@@ -121,6 +128,7 @@ func NewApplication(configPath string) (*Application, error) {
deviceRepo,
planRepo,
tokenService,
auditService,
listenHandler,
analysisPlanTaskManager,
)