@@ -29,6 +29,7 @@ import (
2929var (
3030 _ auditor.LogEntry = (* ProjectCreated )(nil )
3131 _ auditor.LogEntry = (* ProjectVersionCreated )(nil )
32+ _ auditor.LogEntry = (* ProjectVersionUpdated )(nil )
3233 _ auditor.LogEntry = (* ProjectVersionDeleted )(nil )
3334 _ auditor.LogEntry = (* ProjectMembershipAdded )(nil )
3435 _ auditor.LogEntry = (* ProjectMembershipRemoved )(nil )
@@ -39,6 +40,7 @@ const (
3940 ProjectType auditor.TargetType = "Project"
4041 ProjectCreatedActionType string = "ProjectCreated"
4142 ProjectVersionCreatedActionType string = "ProjectVersionCreated"
43+ ProjectVersionUpdatedActionType string = "ProjectVersionUpdated"
4244 ProjectVersionDeletedActionType string = "ProjectVersionDeleted"
4345 ProjectMembershipAddedActionType string = "ProjectMembershipAdded"
4446 ProjectMembershipRemovedActionType string = "ProjectMembershipRemoved"
@@ -156,6 +158,42 @@ func (p *ProjectVersionDeleted) Description() string {
156158 return fmt .Sprintf ("%s has deleted %s version '%s' for project '%s'" , auditor .GetActorIdentifier (), releaseType , p .Version , p .ProjectName )
157159}
158160
161+ // ProjectVersionUpdated represents the update of a project version
162+ type ProjectVersionUpdated struct {
163+ * ProjectBase
164+ VersionID * uuid.UUID `json:"version_id,omitempty"`
165+ Version string `json:"version,omitempty"`
166+ NewVersion * string `json:"new_version,omitempty"`
167+ }
168+
169+ func (p * ProjectVersionUpdated ) ActionType () string {
170+ return ProjectVersionUpdatedActionType
171+ }
172+
173+ func (p * ProjectVersionUpdated ) ActionInfo () (json.RawMessage , error ) {
174+ if _ , err := p .ProjectBase .ActionInfo (); err != nil {
175+ return nil , err
176+ }
177+
178+ if p .VersionID == nil || p .Version == "" {
179+ return nil , errors .New ("version id and version are required" )
180+ }
181+
182+ return json .Marshal (& p )
183+ }
184+
185+ func (p * ProjectVersionUpdated ) Description () string {
186+ desc := fmt .Sprintf ("%s has updated version '%s' for project '%s'" ,
187+ auditor .GetActorIdentifier (), p .Version , p .ProjectName )
188+
189+ if p .NewVersion != nil {
190+ desc = fmt .Sprintf ("%s has renamed version '%s' to '%s' for project '%s'" ,
191+ auditor .GetActorIdentifier (), p .Version , * p .NewVersion , p .ProjectName )
192+ }
193+
194+ return desc
195+ }
196+
159197// Helper function to make role names more user-friendly
160198func prettyRole (role string ) string {
161199 // Convert the role to a prettier format
0 commit comments