Some db fixes

This commit is contained in:
2024-01-02 14:06:20 +03:00
parent 5197b3fbed
commit a35ee9fdf2
3 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
DATABASE_PASSWORD=postgres DATABASE_PASSWORD=postgres
DATABASE_NAME=bot_db DATABASE_NAME=bot_db
DATABASE_USER=postgres DATABASE_USERNAME=postgres
DATABASE_HOST=localhost DATABASE_HOST=localhost
DATABASE_PORT=5432 DATABASE_PORT=5432

View File

@@ -39,10 +39,12 @@ export class SettingsService {
editProfile.isActive = data.isActive; editProfile.isActive = data.isActive;
if (data.isActive) { if (data.isActive) {
const nowActive = await this.botSettingsRepository.findOneBy({ isActive: true }); const nowActive = await this.botSettingsRepository.findOneBy({ isActive: true });
if (nowActive) {
nowActive.isActive = false; nowActive.isActive = false;
await this.botSettingsRepository.save(nowActive); await this.botSettingsRepository.save(nowActive);
} }
} }
}
return await this.botSettingsRepository.save(editProfile); return await this.botSettingsRepository.save(editProfile);
} }

View File

@@ -5,7 +5,7 @@ services:
container_name: neuro_db container_name: neuro_db
image: postgres:alpine image: postgres:alpine
environment: environment:
- POSTGRES_USER=${DATABASE_USER} - POSTGRES_USER=${DATABASE_USERNAME}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD} - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
- POSTGRES_DB=${DATABASE_NAME} - POSTGRES_DB=${DATABASE_NAME}
- PGDATA=/var/lib/postgresql/data/pgdata - PGDATA=/var/lib/postgresql/data/pgdata