refactor: clean code

This commit is contained in:
Fu Diwei
2024-12-27 19:35:50 +08:00
parent 047479426a
commit 86133ba52b
41 changed files with 396 additions and 544 deletions

View File

@@ -103,13 +103,13 @@ func (a *applyNode) Run(ctx context.Context) error {
CertUrl: certificate.CertUrl,
CertStableUrl: certificate.CertStableUrl,
ExpireAt: cert.NotAfter,
Workflow: GetWorkflowId(ctx),
NodeId: a.node.Id,
WorkflowId: GetWorkflowId(ctx),
WorkflowNodeId: a.node.Id,
}
if err := a.outputRepo.Save(ctx, output, certificateRecord, func(id string) error {
if certificateRecord != nil {
certificateRecord.Output = id
certificateRecord.WorkflowOutputId = id
}
return nil

View File

@@ -53,7 +53,7 @@ func (d *deployNode) Run(ctx context.Context) error {
// 部署过但是证书更新了,重新部署
// 部署过且证书未更新,直接返回
if d.deployed(output) && cert.Created.Before(output.Updated) {
if d.deployed(output) && cert.CreatedAt.Before(output.UpdatedAt) {
d.AddOutput(ctx, d.node.Name, "已部署过且证书未更新")
return nil
}

View File

@@ -9,7 +9,7 @@ import (
)
type SettingRepository interface {
GetByName(ctx context.Context, name string) (*domain.Setting, error)
GetByName(ctx context.Context, name string) (*domain.Settings, error)
}
type notifyNode struct {
node *domain.WorkflowNode