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

refactor: OrgId, WorkspaceId, SchemaName cleanup and refactor #379

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

ayushjain17
Copy link
Collaborator

Resolving the following issues
#353
#356
#361

@ayushjain17 ayushjain17 requested a review from a team as a code owner January 22, 2025 13:12
@ayushjain17 ayushjain17 changed the base branch from main to saas January 22, 2025 13:12
@ayushjain17 ayushjain17 changed the title Club org workspace refactor: OrgId, WorkspaceId, SchemaName cleanup and refactor Jan 22, 2025
}

impl fmt::Display for HeadersEnum {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::ConfigVersion => write!(f, "x-config-version"),
Self::TenantId => write!(f, "x-tenant"),
Self::WorkspaceId => write!(f, "x-tenant"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something for later: should we start supporting x-workspace-id below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to support x-org-id here, I had earlier added it but later removed, thinking it has some DB dependency for which I think I would need to update the list of enums in DB, if that is not the case then I can add it

also, we soon need to migrate x-tenant to x-workspace or x-workspace-id

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migration is difficult, we'll need to be backwards compatible for a bit. I need @mahatoankitkumar to weigh in on how this is being used

Comment on lines 137 to 139
log::error!("Schema name not found, please check that the organisation id and workspace id are being properly sent");
actix_web::error::ErrorInternalServerError("Schema name not found, please check that the organisation id and workspace id are being properly sent")
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saying schema_name not found and then asking for org id and workspace id is confusing, can we drop
Schema name not found

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Comment on lines +459 to +460
workspace_id: workspace_request.workspace_id.to_string(),
organisation_id: workspace_request.organisation_id.to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mahatoankitkumar do you have to make any changes to our webhook receiver? Are you dependent on the tenant_id?

@@ -462,24 +442,20 @@ pub async fn conclude(
let url = format!("{}/default-config/{}", state.cac_host, key);

let headers = construct_request_headers(&[
("x-tenant", tenant_name.as_str()),
("x-tenant", &workspace_request.workspace_id),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to call this x-tenant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this has not yet been migrated to something like x-workspace or x-workspace-id

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recap: This header is externally exposed, so we have to migrate those services as well.

crates/service_utils/src/middlewares/tenant.rs Outdated Show resolved Hide resolved
crates/service_utils/src/service/types.rs Outdated Show resolved Hide resolved
@ayushjain17 ayushjain17 requested a review from ShreyBana January 23, 2025 08:15
@ayushjain17 ayushjain17 force-pushed the club_org_workspace branch 2 times, most recently from c2df318 to 8d10270 Compare January 23, 2025 09:55
fn get_workspace_id(&self) -> Option<WorkspaceId>;
}

impl ServiceRequestExt for ServiceRequest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLEAN!

@ayushjain17 ayushjain17 merged commit 48213f1 into saas Jan 23, 2025
4 checks passed
@ayushjain17 ayushjain17 deleted the club_org_workspace branch January 23, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants