diff --git a/packages/backend/src/modules/apps/apps.repository.ts b/packages/backend/src/modules/apps/apps.repository.ts index 13967a7fb6..3580faab20 100644 --- a/packages/backend/src/modules/apps/apps.repository.ts +++ b/packages/backend/src/modules/apps/apps.repository.ts @@ -100,7 +100,7 @@ export class AppsRepository { public async updateAppAppStoreIdWhereNull(appStoreId: number) { await this.db.db .update(app) - .set({ appStoreId, id: sql`CONCAT('${sql.raw(appStoreId.toString())}', '_', id)` }) + .set({ appStoreId, id: sql`CONCAT(id, '_', '${sql.raw(appStoreId.toString())}')` }) .where(isNull(app.appStoreId)) .returning() .execute(); diff --git a/packages/backend/src/modules/docker/builders/compose.builder.ts b/packages/backend/src/modules/docker/builders/compose.builder.ts index d1bb22918b..4694d34ced 100644 --- a/packages/backend/src/modules/docker/builders/compose.builder.ts +++ b/packages/backend/src/modules/docker/builders/compose.builder.ts @@ -59,7 +59,7 @@ export class DockerComposeBuilder { const service = new ServiceBuilder(); service .setImage(params.image) - .setName(`${storeId}_${params.name}`) + .setName(`${params.name}_${storeId}`) .setEnvironment(params.environment) .setCommand(params.command) .setHealthCheck(params.healthCheck) diff --git a/packages/backend/src/tests/integration/__snapshots__/app-lifecycle.test.ts.snap b/packages/backend/src/tests/integration/__snapshots__/app-lifecycle.test.ts.snap index 8cc0b3743c..4246c96dad 100644 --- a/packages/backend/src/tests/integration/__snapshots__/app-lifecycle.test.ts.snap +++ b/packages/backend/src/tests/integration/__snapshots__/app-lifecycle.test.ts.snap @@ -61,9 +61,9 @@ exports[`App lifecycle > install app > should successfully install app and creat exports[`App lifecycle > install app > should successfully install app and create expected directory structure 2`] = ` "services: - 1_test: + test_1: image: test - container_name: 1_test + container_name: test_1 restart: unless-stopped networks: - tipi_main_network diff --git a/packages/backend/src/tests/integration/app-lifecycle.test.ts b/packages/backend/src/tests/integration/app-lifecycle.test.ts index 00bdd81dbf..0ca18557e5 100644 --- a/packages/backend/src/tests/integration/app-lifecycle.test.ts +++ b/packages/backend/src/tests/integration/app-lifecycle.test.ts @@ -105,7 +105,7 @@ describe('App lifecycle', () => { it('should successfully install app and create expected directory structure', async () => { // arrange const appInfo = await createAppInStore(1, { id: 'test' }); - const appId = `1_${appInfo.id}`; + const appId = `${appInfo.id}_1`; // act await appLifecycleService.installApp({ appId, form: {} }); @@ -124,7 +124,7 @@ describe('App lifecycle', () => { it('should not delete an existing app-data folder even if the app is reinstalled', async () => { // arrange const appInfo = await createAppInStore(1, { id: 'test2' }); - const appId = `1_${appInfo.id}`; + const appId = `${appInfo.id}_1`; await fs.promises.mkdir(`${APP_DATA_DIR}/1_test2/data`, { recursive: true }); await fs.promises.writeFile(`${APP_DATA_DIR}/1_test2/data/test.txt`, 'test'); diff --git a/packages/frontend/src/components/page-title/page-title.tsx b/packages/frontend/src/components/page-title/page-title.tsx index a30e53e790..bfca53a87f 100644 --- a/packages/frontend/src/components/page-title/page-title.tsx +++ b/packages/frontend/src/components/page-title/page-title.tsx @@ -29,7 +29,7 @@ export const PageTitle = ({ apps }: Props) => { ); }; - const appTitle = apps.find((app) => app.id.split('_')[1] === pathArray.at(-1))?.name; + const appTitle = apps.find((app) => app.id.split('_')[0] === pathArray.at(-1))?.name; const title = appTitle ?? t(`HEADER_${pathArray[0]?.toUpperCase().replace('-', '_')}`); return (