@@ -17,8 +17,8 @@ import (
1717
1818// GitBotUsecase GitBot 业务逻辑
1919type GitBotUsecase struct {
20- cfg * config.Config
21- repo domain.GitBotRepo
20+ cfg * config.Config
21+ repo domain.GitBotRepo
2222 logger * slog.Logger
2323}
2424
@@ -40,9 +40,9 @@ func (u *GitBotUsecase) GetByID(ctx context.Context, id uuid.UUID) (*domain.GitB
4040 }
4141 return nil , err
4242 }
43- return ( & domain.GitBot {
43+ return cvt . From ( bot , & domain.GitBot {
4444 WebhookURL : u .webhookURL (bot ),
45- }). From ( bot ) , nil
45+ }), nil
4646}
4747
4848// GetInstallationID 获取 installation_id
@@ -78,9 +78,9 @@ func (u *GitBotUsecase) List(ctx context.Context, uid uuid.UUID) (*domain.ListGi
7878 }
7979 return & domain.ListGitBotResp {
8080 Bots : cvt .Iter (bots , func (_ int , bot * db.GitBot ) * domain.GitBot {
81- return ( & domain.GitBot {
81+ return cvt . From ( bot , & domain.GitBot {
8282 WebhookURL : u .webhookURL (bot ),
83- }). From ( bot )
83+ })
8484 }),
8585 }, nil
8686}
@@ -91,9 +91,9 @@ func (u *GitBotUsecase) Create(ctx context.Context, uid uuid.UUID, req domain.Cr
9191 if err != nil {
9292 return nil , err
9393 }
94- return ( & domain.GitBot {
94+ return cvt . From ( bot , & domain.GitBot {
9595 WebhookURL : u .webhookURL (bot ),
96- }). From ( bot ) , nil
96+ }), nil
9797}
9898
9999// Update 更新 GitBot
@@ -102,9 +102,9 @@ func (u *GitBotUsecase) Update(ctx context.Context, uid uuid.UUID, req domain.Up
102102 if err != nil {
103103 return nil , err
104104 }
105- return ( & domain.GitBot {
105+ return cvt . From ( bot , & domain.GitBot {
106106 WebhookURL : u .webhookURL (bot ),
107- }). From ( bot ) , nil
107+ }), nil
108108}
109109
110110// Delete 删除 GitBot
@@ -120,7 +120,7 @@ func (u *GitBotUsecase) ListTask(ctx context.Context, uid uuid.UUID, req domain.
120120 }
121121 return & domain.ListGitBotTaskResp {
122122 Tasks : cvt .Iter (tasks , func (_ int , t * db.GitBotTask ) * domain.GitBotTask {
123- return ( & domain.GitBotTask {}). From ( t )
123+ return cvt . From ( t , & domain.GitBotTask {})
124124 }),
125125 Page : pageInfo .TotalCount ,
126126 Size : int64 (req .Size ),
0 commit comments