Skip to content

Commit

Permalink
fix: save event access record when creating connections (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulkr authored Sep 13, 2024
1 parent 45ef410 commit 1466143
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 11 additions & 0 deletions integrationos-api/src/logic/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ pub async fn create_connection(
e
})?;

state
.app_stores
.event_access
.create_one(&event_access)
.await
.map_err(|e| {
error!("Error saving event access for connection: {:?}", e);

e
})?;

let auth_form_data_value =
serde_json::to_value(payload.auth_form_data.clone()).map_err(|e| {
error!("Error serializing auth form data for connection: {:?}", e);
Expand Down
12 changes: 11 additions & 1 deletion integrationos-api/src/logic/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,20 @@ async fn oauth_handler(
}
.as_event_access(&state.config)
.map_err(|e| {
error!("Error creating event access for connection: {:?}", e);
error!("Error creating event access for oauth connection: {:?}", e);
ApplicationError::service_unavailable("Failed to create event access", None)
})?;

state
.app_stores
.event_access
.create_one(&event_access)
.await
.map_err(|e| {
error!("Error saving event access for oauth connection: {:?}", e);
e
})?;

let connection = Connection {
id: Id::new(IdPrefix::Connection, Utc::now()),
platform_version: conn_definition.clone().platform_version,
Expand Down

0 comments on commit 1466143

Please sign in to comment.