From d32fd6f44cdbf70a8533e7d2cdc363988ddcaf02 Mon Sep 17 00:00:00 2001
From: nl_0 <nl.imbecile@gmail.com>
Date: Thu, 24 Oct 2024 10:19:34 +0200
Subject: [PATCH] access counts schema draft

---
 shared/graphql/schema.graphql | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/shared/graphql/schema.graphql b/shared/graphql/schema.graphql
index 0bb997e7809..60c0fccb2b7 100644
--- a/shared/graphql/schema.graphql
+++ b/shared/graphql/schema.graphql
@@ -215,6 +215,7 @@ type User {
 type AccessCountForDate {
   date: Datetime!
   value: Int!
+  sum: Int!  # running sum
 }
 
 type AccessCounts {
@@ -222,6 +223,16 @@ type AccessCounts {
   counts: [AccessCountForDate!]!
 }
 
+type AccessCountsGroup {
+  ext: String!
+  counts: AccessCounts!
+}
+
+type BucketAccessCounts {
+  byExt(groups: Int): AccessCountsGroup[]
+  combined: AccessCounts
+}
+
 type PackageDir {
   path: String!
   metadata: JsonRecord
@@ -556,6 +567,9 @@ type Query {
   searchMorePackages(after: String!, size: Int = 30): PackagesSearchMoreResult!
   subscription: SubscriptionState!
 
+  bucketAccessCounts(bucket: String!, window: Int!): BucketAccessCounts
+  objectAccessCounts(bucket: String!, key: String!, window: Int!): AccessCounts
+
   admin: AdminQueries! @admin
 
   policies: [Policy!]! @admin