33
44using NuGet . Services . Entities ;
55using NuGetGallery . Auditing . AuditedEntities ;
6+ using System . Linq ;
67
78namespace NuGetGallery . Auditing
89{
@@ -14,12 +15,15 @@ public class PackageAuditRecord : AuditRecord<AuditedPackageAction>
1415
1516 public AuditedPackage PackageRecord { get ; }
1617 public AuditedPackageRegistration RegistrationRecord { get ; }
18+ public AuditedPackageDeprecation DeprecationRecord { get ; }
1719
1820 public string Reason { get ; }
1921
2022 public PackageAuditRecord (
2123 string id , string version , string hash ,
22- AuditedPackage packageRecord , AuditedPackageRegistration registrationRecord ,
24+ AuditedPackage packageRecord ,
25+ AuditedPackageRegistration registrationRecord ,
26+ AuditedPackageDeprecation deprecationRecord ,
2327 AuditedPackageAction action , string reason )
2428 : base ( action )
2529 {
@@ -28,6 +32,7 @@ public PackageAuditRecord(
2832 Hash = hash ;
2933 PackageRecord = packageRecord ;
3034 RegistrationRecord = registrationRecord ;
35+ DeprecationRecord = deprecationRecord ;
3136 Reason = reason ;
3237 }
3338
@@ -37,6 +42,7 @@ public PackageAuditRecord(string id, string version, AuditedPackageAction action
3742 hash : "" ,
3843 packageRecord : null ,
3944 registrationRecord : null ,
45+ deprecationRecord : null ,
4046 action : action ,
4147 reason : reason )
4248 { }
@@ -47,11 +53,15 @@ public PackageAuditRecord(Package package, AuditedPackageAction action, string r
4753 package . Hash ,
4854 packageRecord : null ,
4955 registrationRecord : null ,
56+ deprecationRecord : null ,
5057 action : action ,
5158 reason : reason )
5259 {
5360 PackageRecord = AuditedPackage . CreateFrom ( package ) ;
5461 RegistrationRecord = AuditedPackageRegistration . CreateFrom ( package . PackageRegistration ) ;
62+ DeprecationRecord = package . Deprecations
63+ . Select ( d => AuditedPackageDeprecation . CreateFrom ( d ) )
64+ . SingleOrDefault ( ) ;
5565 }
5666
5767 public PackageAuditRecord ( Package package , AuditedPackageAction action )
@@ -60,11 +70,15 @@ public PackageAuditRecord(Package package, AuditedPackageAction action)
6070 package . Hash ,
6171 packageRecord : null ,
6272 registrationRecord : null ,
73+ deprecationRecord : null ,
6374 action : action ,
6475 reason : null )
6576 {
6677 PackageRecord = AuditedPackage . CreateFrom ( package ) ;
6778 RegistrationRecord = AuditedPackageRegistration . CreateFrom ( package . PackageRegistration ) ;
79+ DeprecationRecord = package . Deprecations
80+ . Select ( d => AuditedPackageDeprecation . CreateFrom ( d ) )
81+ . SingleOrDefault ( ) ;
6882 }
6983
7084 public override string GetPath ( )
0 commit comments