Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: user usage data assertion #1231

Merged
merged 7 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: redo UserUsageData
  • Loading branch information
peterpeterparker committed Feb 11, 2025
commit 17006966a69e72e9d3ab5b225e98d38a3ba58546
6 changes: 3 additions & 3 deletions src/libs/satellite/src/usage/store.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::db::internal::{unsafe_get_doc, unsafe_set_doc};
use crate::rules::store::get_rule_db;
use crate::types::state::CollectionType;
use crate::usage::types::state::{UserUsage, UserUsageKey};
use crate::usage::types::state::{UserUsageData, UserUsageKey};
use crate::SetDoc;
use ic_cdk::id;
use junobuild_collections::constants::db::COLLECTION_USER_USAGE_KEY;
Expand All @@ -14,7 +14,7 @@ pub fn increment_usage(
collection_key: &CollectionKey,
collection_type: &CollectionType,
user_id: &UserId,
) -> Result<UserUsage, String> {
) -> Result<UserUsageData, String> {
let user_usage_key = UserUsageKey::create(user_id, collection_key, collection_type).to_key();

let user_usage_collection = COLLECTION_USER_USAGE_KEY.to_string();
Expand All @@ -29,7 +29,7 @@ pub fn increment_usage(
.map(|doc| decode_doc_data(&doc.data))
.transpose()?;

let update_usage = UserUsage::increment(&current_usage);
let update_usage = UserUsageData::increment(&current_usage);

let update_doc = SetDoc {
data: encode_doc_data(&update_usage)?,
Expand Down