11import { Injectable } from '@nestjs/common' ;
22
33import type { DockerContainer } from '@app/graphql/generated/api/types.js' ;
4- import { getDockerContainers } from '@app/core/modules/docker/get-docker-containers.js' ;
4+ import {
5+ ContainerListingOptions ,
6+ getDockerContainers ,
7+ } from '@app/core/modules/docker/get-docker-containers.js' ;
58import { docker } from '@app/core/utils/clients/docker.js' ;
69
710@Injectable ( )
811export class DockerService {
9- public async getContainers ( useCache = false ) : Promise < DockerContainer [ ] > {
12+ public async getContainers ( { useCache } : ContainerListingOptions ) : Promise < DockerContainer [ ] > {
1013 return getDockerContainers ( { useCache } ) ;
1114 }
1215
1316 public async startContainer ( id : string ) : Promise < DockerContainer > {
1417 const container = docker . getContainer ( id ) ;
1518 await container . start ( ) ;
16- const containers = await this . getContainers ( false ) ;
19+ const containers = await this . getContainers ( { useCache : false } ) ;
1720 const updatedContainer = containers . find ( ( c ) => c . id === id ) ;
1821 if ( ! updatedContainer ) {
1922 throw new Error ( `Container ${ id } not found after starting` ) ;
@@ -24,7 +27,7 @@ export class DockerService {
2427 public async stopContainer ( id : string ) : Promise < DockerContainer > {
2528 const container = docker . getContainer ( id ) ;
2629 await container . stop ( ) ;
27- const containers = await this . getContainers ( false ) ;
30+ const containers = await this . getContainers ( { useCache : false } ) ;
2831 const updatedContainer = containers . find ( ( c ) => c . id === id ) ;
2932 if ( ! updatedContainer ) {
3033 throw new Error ( `Container ${ id } not found after stopping` ) ;
0 commit comments