Skip to content

Commit cbbf7f3

Browse files
authored
feat(events): Include invitation ID on event (#2302)
Signed-off-by: Javier Rodriguez <[email protected]>
1 parent 186984c commit cbbf7f3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

app/controlplane/pkg/auditor/events/organization.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ type OrgUserJoined struct {
8383
UserID uuid.UUID `json:"user_id,omitempty"`
8484
// UserEmail of the user that joined the organization
8585
UserEmail string `json:"user_email,omitempty"`
86+
// InvitationID is the ID of the invitation that was used to join the organization
87+
InvitationID uuid.UUID `json:"invitation_id,omitempty"`
8688
}
8789

8890
func (p *OrgUserJoined) ActionType() string {
@@ -94,8 +96,8 @@ func (p *OrgUserJoined) Description() string {
9496
}
9597

9698
func (p *OrgUserJoined) ActionInfo() (json.RawMessage, error) {
97-
if p.OrgName == "" || p.OrgID == nil || p.UserID == uuid.Nil || p.UserEmail == "" {
98-
return nil, errors.New("org name, org id, user id and user email are required")
99+
if p.OrgName == "" || p.OrgID == nil || p.UserID == uuid.Nil || p.UserEmail == "" || p.InvitationID == uuid.Nil {
100+
return nil, errors.New("org name, org id, user id, user email and invitation id are required")
99101
}
100102

101103
return json.Marshal(&p)

app/controlplane/pkg/biz/orginvitation.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,9 @@ func (uc *OrgInvitationUseCase) AcceptPendingInvitations(ctx context.Context, re
290290
OrgID: &orgUUID,
291291
OrgName: invitation.Org.Name,
292292
},
293-
UserID: userUUID,
294-
UserEmail: user.Email,
293+
UserID: userUUID,
294+
UserEmail: user.Email,
295+
InvitationID: invitation.ID,
295296
}, &orgUUID)
296297
}
297298

0 commit comments

Comments
 (0)