Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit b07a106

Browse files
author
noah
committed
Change the slack message format
1 parent d05faa1 commit b07a106

File tree

7 files changed

+187
-124
lines changed

7 files changed

+187
-124
lines changed

internal/interactor/interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type (
4343
// PermStore defines operations for working with deployment_statuses.
4444
DeploymentStatusStore interface {
4545
ListDeploymentStatuses(ctx context.Context, d *ent.Deployment) ([]*ent.DeploymentStatus, error)
46+
FindDeploymentStatusByID(ctx context.Context, id int) (*ent.DeploymentStatus, error)
4647
// CreateEntDeploymentStatus create a DeploymentStatus entity to the store.
4748
// Ent is appended to distinguish it from the interactor.
4849
CreateEntDeploymentStatus(ctx context.Context, s *ent.DeploymentStatus) (*ent.DeploymentStatus, error)

internal/interactor/mock/pkg.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/pkg/store/deploymentstatus.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,12 @@ func (s *Store) CreateEntDeploymentStatus(ctx context.Context, ds *ent.Deploymen
4949

5050
return ret, nil
5151
}
52+
53+
func (s *Store) FindDeploymentStatusByID(ctx context.Context, id int) (*ent.DeploymentStatus, error) {
54+
ds, err := s.c.DeploymentStatus.Get(ctx, id)
55+
if ent.IsNotFound(err) {
56+
return nil, e.NewError(e.ErrorCodeEntityNotFound, err)
57+
}
58+
59+
return ds, nil
60+
}

internal/pkg/store/event.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ func (s *Store) CreateEvent(ctx context.Context, e *ent.Event) (*ent.Event, erro
4747
SetKind(e.Kind).
4848
SetType(e.Type)
4949

50-
if e.Type == event.TypeDeleted {
51-
qry = qry.SetDeletedID(e.DeletedID)
52-
} else if e.Kind == event.KindDeployment {
53-
qry = qry.SetDeploymentID(e.DeploymentID)
50+
if e.Kind == event.KindDeploymentStatus {
51+
qry = qry.SetDeploymentStatusID(e.DeploymentStatusID)
5452
} else if e.Kind == event.KindReview {
5553
qry = qry.SetReviewID(e.ReviewID)
5654
}

internal/server/slack/interface.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ type (
1717
UpdateChatUser(ctx context.Context, cu *ent.ChatUser) (*ent.ChatUser, error)
1818
DeleteChatUser(ctx context.Context, cu *ent.ChatUser) error
1919

20+
FindDeploymentByID(ctx context.Context, id int) (*ent.Deployment, error)
21+
FindDeploymentStatusByID(ctx context.Context, id int) (*ent.DeploymentStatus, error)
22+
23+
FindReviewByID(ctx context.Context, id int) (*ent.Review, error)
24+
2025
SubscribeEvent(fn func(e *ent.Event)) error
2126
UnsubscribeEvent(fn func(e *ent.Event)) error
2227
}

internal/server/slack/mock/interactor.go

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)