Skip to content

Commit

Permalink
feat: add hearts
Browse files Browse the repository at this point in the history
  • Loading branch information
Defelo committed Jan 7, 2025
1 parent a4cb50e commit 3dd0723
Show file tree
Hide file tree
Showing 49 changed files with 1,974 additions and 26 deletions.
33 changes: 33 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

172 changes: 172 additions & 0 deletions Cargo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,26 @@ rec {
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
"academy_core_heart_contracts" = rec {
packageId = "academy_core_heart_contracts";
build = internal.buildRustCrateWithFeatures {
packageId = "academy_core_heart_contracts";
};

# Debug support which might change between releases.
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
"academy_core_heart_impl" = rec {
packageId = "academy_core_heart_impl";
build = internal.buildRustCrateWithFeatures {
packageId = "academy_core_heart_impl";
};

# Debug support which might change between releases.
# File a bug if you depend on any for non-debug work!
debug = internal.debugCrate { inherit packageId; };
};
"academy_core_internal_contracts" = rec {
packageId = "academy_core_internal_contracts";
build = internal.buildRustCrateWithFeatures {
Expand Down Expand Up @@ -614,6 +634,10 @@ rec {
name = "academy_core_health_impl";
packageId = "academy_core_health_impl";
}
{
name = "academy_core_heart_impl";
packageId = "academy_core_heart_impl";
}
{
name = "academy_core_internal_impl";
packageId = "academy_core_internal_impl";
Expand Down Expand Up @@ -842,6 +866,10 @@ rec {
name = "academy_core_health_contracts";
packageId = "academy_core_health_contracts";
}
{
name = "academy_core_heart_contracts";
packageId = "academy_core_heart_contracts";
}
{
name = "academy_core_internal_contracts";
packageId = "academy_core_internal_contracts";
Expand Down Expand Up @@ -1241,6 +1269,12 @@ rec {
usesDefaultFeatures = false;
features = [ "std" ];
}
{
name = "chrono";
packageId = "chrono";
usesDefaultFeatures = false;
features = [ "serde" "clock" ];
}
{
name = "config";
packageId = "config";
Expand Down Expand Up @@ -1752,6 +1786,135 @@ rec {
}
];

};
"academy_core_heart_contracts" = rec {
crateName = "academy_core_heart_contracts";
version = "0.0.0";
edition = "2021";
src = lib.cleanSourceWith { filter = sourceFilter; src = ./academy_core/heart/contracts; };
dependencies = [
{
name = "academy_models";
packageId = "academy_models";
}
{
name = "anyhow";
packageId = "anyhow";
usesDefaultFeatures = false;
features = [ "std" ];
}
{
name = "mockall";
packageId = "mockall";
optional = true;
usesDefaultFeatures = false;
}
{
name = "thiserror";
packageId = "thiserror 2.0.9";
usesDefaultFeatures = false;
}
];
features = {
"mock" = [ "dep:mockall" ];
};
resolvedDefaultFeatures = [ "mock" ];
};
"academy_core_heart_impl" = rec {
crateName = "academy_core_heart_impl";
version = "0.0.0";
edition = "2021";
src = lib.cleanSourceWith { filter = sourceFilter; src = ./academy_core/heart/impl; };
dependencies = [
{
name = "academy_auth_contracts";
packageId = "academy_auth_contracts";
}
{
name = "academy_core_coin_contracts";
packageId = "academy_core_coin_contracts";
}
{
name = "academy_core_heart_contracts";
packageId = "academy_core_heart_contracts";
}
{
name = "academy_di";
packageId = "academy_di";
}
{
name = "academy_models";
packageId = "academy_models";
}
{
name = "academy_persistence_contracts";
packageId = "academy_persistence_contracts";
}
{
name = "academy_shared_contracts";
packageId = "academy_shared_contracts";
}
{
name = "academy_utils";
packageId = "academy_utils";
}
{
name = "anyhow";
packageId = "anyhow";
usesDefaultFeatures = false;
features = [ "std" ];
}
{
name = "chrono";
packageId = "chrono";
usesDefaultFeatures = false;
features = [ "serde" "clock" ];
}
{
name = "tracing";
packageId = "tracing";
usesDefaultFeatures = false;
features = [ "attributes" ];
}
];
devDependencies = [
{
name = "academy_auth_contracts";
packageId = "academy_auth_contracts";
features = [ "mock" ];
}
{
name = "academy_core_coin_contracts";
packageId = "academy_core_coin_contracts";
features = [ "mock" ];
}
{
name = "academy_core_heart_contracts";
packageId = "academy_core_heart_contracts";
features = [ "mock" ];
}
{
name = "academy_demo";
packageId = "academy_demo";
}
{
name = "academy_persistence_contracts";
packageId = "academy_persistence_contracts";
features = [ "mock" ];
}
{
name = "academy_shared_contracts";
packageId = "academy_shared_contracts";
features = [ "mock" ];
}
{
name = "tokio";
packageId = "tokio";
usesDefaultFeatures = false;
features = [ "rt-multi-thread" "macros" "sync" "fs" "process" ];
}
];

};
"academy_core_internal_contracts" = rec {
crateName = "academy_core_internal_contracts";
Expand Down Expand Up @@ -1804,6 +1967,10 @@ rec {
name = "academy_core_coin_contracts";
packageId = "academy_core_coin_contracts";
}
{
name = "academy_core_heart_contracts";
packageId = "academy_core_heart_contracts";
}
{
name = "academy_core_internal_contracts";
packageId = "academy_core_internal_contracts";
Expand Down Expand Up @@ -1853,6 +2020,11 @@ rec {
packageId = "academy_core_coin_contracts";
features = [ "mock" ];
}
{
name = "academy_core_heart_contracts";
packageId = "academy_core_heart_contracts";
features = [ "mock" ];
}
{
name = "academy_core_internal_contracts";
packageId = "academy_core_internal_contracts";
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ academy_core_finance_contracts.path = "academy_core/finance/contracts"
academy_core_finance_impl.path = "academy_core/finance/impl"
academy_core_health_contracts.path = "academy_core/health/contracts"
academy_core_health_impl.path = "academy_core/health/impl"
academy_core_heart_contracts.path = "academy_core/heart/contracts"
academy_core_heart_impl.path = "academy_core/heart/impl"
academy_core_internal_contracts.path = "academy_core/internal/contracts"
academy_core_internal_impl.path = "academy_core/internal/impl"
academy_core_mfa_contracts.path = "academy_core/mfa/contracts"
Expand Down
1 change: 1 addition & 0 deletions academy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ academy_core_contact_impl.workspace = true
academy_core_finance_contracts.workspace = true
academy_core_finance_impl.workspace = true
academy_core_health_impl.workspace = true
academy_core_heart_impl.workspace = true
academy_core_internal_impl.workspace = true
academy_core_mfa_impl.workspace = true
academy_core_oauth2_impl.workspace = true
Expand Down
20 changes: 15 additions & 5 deletions academy/src/environment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use academy_api_rest::{RestServerConfig, RestServerRealIpConfig};
use academy_auth_impl::AuthServiceConfig;
use academy_config::Config;
use academy_core_contact_impl::ContactFeatureConfig;
use academy_core_finance_impl::FinanceServiceConfig;
use academy_core_finance_impl::FinanceFeatureConfig;
use academy_core_health_impl::HealthFeatureConfig;
use academy_core_heart_impl::HeartFeatureConfig;
use academy_core_oauth2_impl::OAuth2FeatureConfig;
use academy_core_paypal_impl::PaypalFeatureConfig;
use academy_core_session_impl::SessionFeatureConfig;
Expand Down Expand Up @@ -58,7 +59,8 @@ provider! {
SessionFeatureConfig,
UserFeatureConfig,
PaypalFeatureConfig,
FinanceServiceConfig,
FinanceFeatureConfig,
HeartFeatureConfig,
}
}
}
Expand Down Expand Up @@ -104,7 +106,8 @@ provider! {
session_feature_config: SessionFeatureConfig,
user_feature_config: UserFeatureConfig,
paypal_feature_config: PaypalFeatureConfig,
finance_service_config: FinanceServiceConfig,
finance_feature_config: FinanceFeatureConfig,
heart_feature_config: HeartFeatureConfig,
}
}

Expand Down Expand Up @@ -231,13 +234,19 @@ impl ConfigProvider {
purchase_range: config.coin.purchase_min..=config.coin.purchase_max,
};

let finance_service_config = FinanceServiceConfig {
let finance_feature_config = FinanceFeatureConfig {
vat_percent: config.finance.vat_percent,
invoices_archive: config.finance.invoices_archive.clone().into(),
credit_notes_archive: config.finance.credit_notes_archive.clone().into(),
download_token_ttl: config.jwt.download_token_ttl.into(),
};

let heart_feature_config = HeartFeatureConfig {
hearts_max: config.heart.max,
hearts_refill_price: config.heart.refill_price,
auto_refill_time: config.heart.auto_refill_time,
};

Ok(Self {
_cache: Default::default(),

Expand Down Expand Up @@ -267,7 +276,8 @@ impl ConfigProvider {
session_feature_config,
user_feature_config,
paypal_feature_config,
finance_service_config,
finance_feature_config,
heart_feature_config,
})
}
}
Expand Down
Loading

0 comments on commit 3dd0723

Please sign in to comment.