File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
diracx-db/src/diracx/db/sql/pilot_agents Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -190,15 +190,19 @@ async def add_pilot_credentials(self, pilot_id: int) -> str:
190
190
return random_secret
191
191
192
192
async def get_pilots (self ):
193
- """Récupère tous les pilotes et les retourne sous forme de dictionnaires.
194
-
195
- :raises: NoResultFound
196
- """
197
- # La clause with_for_update empêche que le jeton soit récupéré plusieurs fois simultanément
198
193
stmt = select (PilotRegistrations ).with_for_update ()
199
194
result = await self .conn .execute (stmt )
200
195
201
196
# Convertir les résultats en dictionnaires
202
197
pilots = [dict (row ._mapping ) for row in result ]
203
198
204
199
return pilots
200
+
201
+ async def get_pilot_by_id (self , pilot_id : int ):
202
+ stmt = (
203
+ select (PilotRegistrations )
204
+ .with_for_update ()
205
+ .where (PilotRegistrations .pilot_id == pilot_id )
206
+ )
207
+
208
+ return dict ((await self .conn .execute (stmt )).one ()._mapping )
You can’t perform that action at this time.
0 commit comments