mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -34,4 +34,7 @@ export class Post {
|
|||||||
|
|
||||||
@OneToMany(() => Image, (image) => image.post)
|
@OneToMany(() => Image, (image) => image.post)
|
||||||
public images: Image[];
|
public images: Image[];
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
public message_entities?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ import { ApiProperty } from '@nestjs/swagger';
|
|||||||
export class ICreatePost {
|
export class ICreatePost {
|
||||||
@ApiProperty({ description: 'Post text', example: 'Post text' }) readonly text!: string;
|
@ApiProperty({ description: 'Post text', example: 'Post text' }) readonly text!: string;
|
||||||
|
|
||||||
@ApiProperty({ description: 'An id of user that creating post', example: '1234' }) readonly from_user_id!: string;
|
@ApiProperty({ description: 'The id of user that creating post', example: '1234' }) readonly from_user_id!: string;
|
||||||
|
|
||||||
@ApiProperty({ description: 'Post media group id', example: '123' }) readonly media_group_id?: string;
|
@ApiProperty({ description: 'Post media group id', example: '123' }) readonly media_group_id?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Message entities of text', example: '[]' }) readonly message_entities?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IEditPost {
|
export class IEditPost {
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ export class PostService {
|
|||||||
media_group_id: data.media_group_id,
|
media_group_id: data.media_group_id,
|
||||||
from_user: user,
|
from_user: user,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
message_entities: data.message_entities,
|
||||||
});
|
});
|
||||||
this.logger.log(`Created new post: ${result.uuid}`);
|
this.logger.log(`Created new post: ${result.uuid}`);
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.debug(`[post.newPost] error: ${JSON.stringify(error)}`);
|
this.logger.debug(`[post.newPost] error: ${error}`);
|
||||||
throw new HttpException('No user with this id', HttpStatus.BAD_REQUEST);
|
throw new HttpException('No user with this id', HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ export class PostService {
|
|||||||
if (!post) throw new Error("Can't find post");
|
if (!post) throw new Error("Can't find post");
|
||||||
return post;
|
return post;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.debug(`[post.getByMediaGroup] error: ${JSON.stringify(error)}`);
|
this.logger.debug(`[post.getByMediaGroup] error: ${error}`);
|
||||||
throw new HttpException("Can't find post with this media group id", HttpStatus.BAD_REQUEST);
|
throw new HttpException("Can't find post with this media group id", HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ 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 });
|
||||||
nowActive.isActive = false;
|
if (nowActive) {
|
||||||
await this.botSettingsRepository.save(nowActive);
|
nowActive.isActive = false;
|
||||||
|
await this.botSettingsRepository.save(nowActive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await this.botSettingsRepository.save(editProfile);
|
return await this.botSettingsRepository.save(editProfile);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Submodule neuro-reply-bot-reworked updated: 43b1c5ecf4...230850bf65
Reference in New Issue
Block a user