Skip to content

Commit

Permalink
[backend] add publisher to PackageSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenVoich committed Nov 25, 2024
1 parent 001f2e3 commit 6e6a7f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/main/registry/getPackageSummary.mo
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ module {
public func getPackageSummary(registry : Registry.Registry, users : Users.Users, downloadLog : DownloadLog.DownloadLog, name : PackageName, version : PackageVersion) : ?PackageSummary {
do ? {
let config = registry.getPackageConfig(name, version)!;

let publication = registry.getPackagePublication(name, version)!;
users.ensureUser(publication.user);

let owners = registry.getPackageOwners(name);
for (owner in owners.vals()) {
Expand All @@ -47,6 +49,7 @@ module {
maintainers = Array.map(maintainers, users.getUser);
config = config;
publication = publication;
publisher = users.getUser(publication.user);
downloadsInLast7Days = downloadLog.getDownloadsByPackageNameIn(config.name, 7 * DAY, Time.now());
downloadsInLast30Days = downloadLog.getDownloadsByPackageNameIn(config.name, 30 * DAY, Time.now());
downloadsTotal = downloadLog.getTotalDownloadsByPackageName(config.name);
Expand Down
1 change: 1 addition & 0 deletions backend/main/types.mo
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module {
maintainers : [User];
config : PackageConfigV3;
publication : PackagePublication;
publisher : User;
downloadsTotal : Nat;
downloadsInLast30Days : Nat;
downloadsInLast7Days : Nat;
Expand Down

0 comments on commit 6e6a7f6

Please sign in to comment.