-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5191 from systeminit/migrate-modules-to-v2
chore(sdf): Migrate list_modules to v2 endpoint
- Loading branch information
Showing
7 changed files
with
52 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use axum::{ | ||
extract::{Host, OriginalUri, Path}, | ||
Json, | ||
}; | ||
use dal::{module::Module, ChangeSetId, WorkspacePk}; | ||
use si_frontend_types::ModuleSummary; | ||
|
||
use super::ModuleAPIResult; | ||
use crate::extract::{AccessBuilder, HandlerContext, PosthogClient, RawAccessToken}; | ||
|
||
pub async fn list( | ||
HandlerContext(builder): HandlerContext, | ||
AccessBuilder(access_builder): AccessBuilder, | ||
RawAccessToken(_raw_access_token): RawAccessToken, | ||
PosthogClient(_posthog_client): PosthogClient, | ||
OriginalUri(_original_uri): OriginalUri, | ||
Host(_host_name): Host, | ||
Path((_workspace_pk, change_set_id)): Path<(WorkspacePk, ChangeSetId)>, | ||
) -> ModuleAPIResult<Json<Vec<ModuleSummary>>> { | ||
let ctx = builder | ||
.build(access_builder.build(change_set_id.into())) | ||
.await?; | ||
|
||
let installed_modules = Module::list_installed(&ctx).await?; | ||
|
||
let modules: Vec<ModuleSummary> = installed_modules | ||
.iter() | ||
.map(|module| ModuleSummary { | ||
name: module.name().to_owned(), | ||
hash: module.root_hash().to_string(), | ||
}) | ||
.collect(); | ||
|
||
Ok(Json(modules)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters