@@ -89,6 +89,22 @@ async def _post(_: Request, user: base_models.APIUser, body: apispec.ProjectPost
8989
9090 return "/projects" , ["POST" ], _post
9191
92+ def get_all_migrations (self ) -> BlueprintFactoryResponse :
93+ """List all project migrations."""
94+
95+ @authenticate (self .authenticator )
96+ @only_authenticated
97+ async def _get_all_migrations (_ : Request , user : base_models .APIUser ) -> JSONResponse :
98+ project_migrations = self .project_migration_repo .get_project_migrations (user = user )
99+
100+ migrations_list = []
101+ async for migration in project_migrations :
102+ migrations_list .append (self ._dump_project_migration (migration ))
103+
104+ return validated_json (apispec .ProjectMigrationList , migrations_list )
105+
106+ return "/renku_v1_projects/migrations" , ["GET" ], _get_all_migrations
107+
92108 def get_migration (self ) -> BlueprintFactoryResponse :
93109 """Get project migration by project v1 id."""
94110
@@ -381,6 +397,16 @@ def _dump_project(project: project_models.Project, with_documentation: bool = Fa
381397 result = dict (result , documentation = project .documentation )
382398 return result
383399
400+ @staticmethod
401+ def _dump_project_migration (project_migration : project_models .ProjectMigrationInfo ) -> dict [str , Any ]:
402+ """Dumps a project migration for API responses."""
403+ result = dict (
404+ project_id = project_migration .project_id ,
405+ v1_id = project_migration .v1_id ,
406+ launcher_id = project_migration .launcher_id ,
407+ )
408+ return result
409+
384410
385411@dataclass (kw_only = True )
386412class ProjectSessionSecretBP (CustomBlueprint ):
0 commit comments