diff --git a/ars/elk/logstash/logstash.conf b/ars/elk/logstash/logstash.conf index 0807a5c..871a546 100644 --- a/ars/elk/logstash/logstash.conf +++ b/ars/elk/logstash/logstash.conf @@ -2,7 +2,6 @@ input { jdbc { jdbc_driver_library => "/usr/share/logstash/mysql-connector-java-8.0.28.jar" jdbc_driver_class => "com.mysql.cj.jdbc.Driver" - #jdbc_connection_string => "jdbc:mysql://10.90.0.4:3306/ars" jdbc_connection_string => "jdbc:mysql://my_database:3306/ars" jdbc_user => "root" jdbc_password => "3160" diff --git a/ars/src/apis/art/art.module.ts b/ars/src/apis/art/art.module.ts index 13abb77..322f743 100644 --- a/ars/src/apis/art/art.module.ts +++ b/ars/src/apis/art/art.module.ts @@ -1,8 +1,5 @@ import { Module } from '@nestjs/common'; -import { - ElasticsearchModule, - ElasticsearchService, -} from '@nestjs/elasticsearch'; +import { ElasticsearchModule } from '@nestjs/elasticsearch'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ArtImage } from '../artImage/entities/artImage.entity'; import { Engage } from '../engage/entities/engage.entity'; diff --git a/ars/src/apis/art/art.resolver.ts b/ars/src/apis/art/art.resolver.ts index 7c5c952..820455c 100644 --- a/ars/src/apis/art/art.resolver.ts +++ b/ars/src/apis/art/art.resolver.ts @@ -38,9 +38,10 @@ export class ArtResolver { if (redisValue) { return redisValue; } - const result = await this.elasticsearchService.search({ index: 'artipul00', + from: 0, + size: 500, query: { bool: { must: [{ match: { tag1: tags[0] } }], @@ -56,7 +57,6 @@ export class ArtResolver { title: el._source.title, start_price: el._source.start_price, instant_bid: el._source.instant_bid, - price: el._source.price, deadline: el._source.deadline, thumbnail: el._source.thumbnail, tag1: el._source.tag1, @@ -79,6 +79,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul00', + from: 0, + size: 500, query: { bool: { must: [{ match: { tag1: tags[0] } }, { match: { tag2: tags[1] } }], @@ -94,7 +96,6 @@ export class ArtResolver { title: el._source.title, start_price: el._source.start_price, instant_bid: el._source.instant_bid, - price: el._source.price, deadline: el._source.deadline, thumbnail: el._source.thumbnail, tag1: el._source.tag1, @@ -118,6 +119,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul00', + from: 0, + size: 500, query: { bool: { must: [ @@ -137,7 +140,6 @@ export class ArtResolver { title: el._source.title, start_price: el._source.start_price, instant_bid: el._source.instant_bid, - price: el._source.price, deadline: el._source.deadline, thumbnail: el._source.thumbnail, tag1: el._source.tag1, @@ -162,6 +164,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul00', + from: 0, + size: 500, query: { bool: { must: [ @@ -182,7 +186,6 @@ export class ArtResolver { title: el._source.title, start_price: el._source.start_price, instant_bid: el._source.instant_bid, - price: el._source.price, deadline: el._source.deadline, thumbnail: el._source.thumbnail, tag1: el._source.tag1, diff --git a/ars/src/apis/art/art.service.ts b/ars/src/apis/art/art.service.ts index 67205f5..9c781b6 100644 --- a/ars/src/apis/art/art.service.ts +++ b/ars/src/apis/art/art.service.ts @@ -127,6 +127,8 @@ export class ArtService { .createQueryBuilder('art') .leftJoinAndSelect('art.payment', 'payment') .leftJoinAndSelect('payment.user', 'user') + .take(10) + .skip(10 * (page - 1)) .where('user.id =:id', { id: currentUser.id }) .withDeleted() .getMany(); @@ -217,6 +219,7 @@ export class ArtService { .where('user.id =:id', { id: userId }) .withDeleted() .getCount(); + return art; } diff --git a/ars/src/apis/board/board.service.ts b/ars/src/apis/board/board.service.ts index 8959ee1..12d7240 100644 --- a/ars/src/apis/board/board.service.ts +++ b/ars/src/apis/board/board.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Connection, Repository } from 'typeorm'; +import { Connection, getRepository, Repository } from 'typeorm'; import { Art } from '../art/entities/art.entity'; import { BoardImage } from '../boardImage/entities/boardImage.entity'; import { Comment } from '../comment/entities/comment.entity'; @@ -35,6 +35,7 @@ export class BoardService { // 게시물 모두 조회 async findAll(page) { return await this.boardRepository.find({ + relations: ['art'], take: 10, skip: 10 * (page - 1), }); diff --git a/ars/src/apis/payment/payment.resolver.ts b/ars/src/apis/payment/payment.resolver.ts index d7e6fe1..4c6b59b 100644 --- a/ars/src/apis/payment/payment.resolver.ts +++ b/ars/src/apis/payment/payment.resolver.ts @@ -14,6 +14,8 @@ export class PaymentResolver { private readonly userService: UserService, private readonly elasticsearchService: ElasticsearchService, + private readonly elasticsearchService: ElasticsearchService, + @Inject(CACHE_MANAGER) private readonly cacheManager: Cache, ) {} @@ -64,6 +66,9 @@ export class PaymentResolver { }, }); + return artId; + } + return 'ok'; } // 레디스에 입찰 정보(작품, 현재 입찰가, 현재 상위 입찰자) @@ -88,4 +93,9 @@ export class PaymentResolver { await this.paymentService.save(artId, currentUser.id, bid_price); return 'ok'; } + + @Mutation(() => String) + async enterBidRomm(@Args('artId') artId: string) { + return await this.paymentService.room(artId); + } } diff --git a/ars/src/apis/payment/payment.service.ts b/ars/src/apis/payment/payment.service.ts index 0c7e75d..e3f6259 100644 --- a/ars/src/apis/payment/payment.service.ts +++ b/ars/src/apis/payment/payment.service.ts @@ -122,7 +122,10 @@ export class PaymentService { // DB 저장 async save(artId, userId, bid_price) { - this.eventGateway.server.emit('message', bid_price); + this.eventGateway.server.emit('message', { + price: bid_price, + artId: artId, + }); const queryRunner = this.connection.createQueryRunner(); await queryRunner.connect(); await queryRunner.startTransaction(); @@ -161,4 +164,6 @@ export class PaymentService { where: { userId: userId }, }); } + + async room(artId) {} } diff --git a/ars/src/common/graphql/schema.gql b/ars/src/common/graphql/schema.gql index 470f69f..a08eb65 100644 --- a/ars/src/common/graphql/schema.gql +++ b/ars/src/common/graphql/schema.gql @@ -195,6 +195,7 @@ type Mutation { instantBid(artId: String!, price: Float!, artistEmail: String!): String! Bid(artId: String!, bid_price: Float!): [String!]! saveBid(artId: String!, bid_price: Float!): String! + enterBidRomm(artId: String!): String! createPointTransaction(impUid: String!, charge_amount: Float!): PointTransaction! cancelPointTransaction(impUid: String!): PointTransaction! }