Skip to content

Commit

Permalink
Fixed missing relation types in plugin date_time
Browse files Browse the repository at this point in the history
  • Loading branch information
aschaeffer committed Sep 11, 2024
1 parent 71ba254 commit ed7bb6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/date-time/crates/plugin/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ pub struct DateTimePluginImpl {
#[component(default = "entity_behaviour_registry")]
entity_behaviour_registry: Arc<dyn EntityBehaviourRegistry + Send + Sync>,

relation_types_provider: Arc<dyn TypeProvider<RelationTypes> + Send + Sync>,

#[component(default = "relation_types_provider_registry")]
relation_type_provider_registry: Arc<dyn RelationTypeProviderRegistry + Send + Sync>,

time_graph: Arc<dyn TimeGraph + Send + Sync>,
}

Expand All @@ -46,6 +51,9 @@ impl Plugin for DateTimePluginImpl {
async fn activate(&self) -> Result<(), PluginActivationError> {
self.component_provider_registry.register_provider(self.component_provider.clone()).await;
self.entity_type_provider_registry.register_provider(self.entity_types_provider.clone()).await;
self.relation_type_provider_registry
.register_provider(self.relation_types_provider.clone())
.await;
// Utc Timestamp
let factory = Arc::new(UtcTimestampFactory::new(BEHAVIOUR_UTC_TIMESTAMP.clone()));
self.entity_behaviour_registry.register(ENTITY_BEHAVIOUR_UTC_TIMESTAMP.clone(), factory).await;
Expand All @@ -70,6 +78,9 @@ impl Plugin for DateTimePluginImpl {
self.entity_behaviour_registry.unregister(&ENTITY_BEHAVIOUR_UTC_TIMESTAMP).await;
self.entity_behaviour_registry.unregister(&ENTITY_BEHAVIOUR_UTC_NOW).await;

self.relation_type_provider_registry
.unregister_provider(self.relation_types_provider.id())
.await;
self.entity_type_provider_registry.unregister_provider(self.entity_types_provider.id()).await;
self.component_provider_registry.unregister_provider(self.component_provider.id()).await;
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions plugins/date-time/crates/plugin/src/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ pub struct DateTimeComponentsProvider {}
#[derive(TypeProvider, Component)]
#[type_provider(tys = "EntityTypes", path = "types/entities")]
pub struct DateTimeEntityTypesProvider {}

#[derive(TypeProvider, Component)]
#[type_provider(tys = "RelationTypes", path = "types/relations")]
pub struct DateTimeRelationTypesProvider {}

0 comments on commit ed7bb6a

Please sign in to comment.