From 06faf74cf366b529651ce55c6d3e6bf559b23d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EB=8B=A4=EC=8A=AC?= <95472052+Daseul1@users.noreply.github.com> Date: Sat, 2 Apr 2022 15:53:22 +0900 Subject: [PATCH] =?UTF-8?q?[#116]feat:=20=EC=97=98=EB=9D=BC=EC=8A=A4?= =?UTF-8?q?=ED=8B=B1=20=EC=B5=9C=EC=A2=85=20=EC=88=98=EC=A0=953?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 6148 -> 6148 bytes ars/docker-compose.dev.yaml | 5 ++++- ars/elk/logstash/logstash.conf | 2 +- ars/src/apis/art/art.resolver.ts | 13 +++++++++---- ars/src/apis/art/art.service.ts | 8 -------- ars/src/apis/art/dto/createArtInput.ts | 14 +------------- .../apis/art/entities/artsSearch.entity.ts | 4 ++-- ars/src/app.module.ts | 1 + ars/src/common/graphql/schema.gql | 4 ++-- 9 files changed, 20 insertions(+), 31 deletions(-) diff --git a/.DS_Store b/.DS_Store index 45d21ae6a8f68cc74d24b87504e5179e86777414..970b22e2921ecb0dcf1281778d0bb3d3e20795d1 100644 GIT binary patch delta 57 zcmV-90LK4>FoZCWVFR~faFY=Nr;`f-76G@DA^~v<7khg)H8?CFEi;pz0UH5{lez&P P0gAKQ0WAiz1_=HS1OyR_ delta 58 zcmV-A0LA}=FoZCWVFS2gaFY=Nr;`f-76G`EA^~v=7<+p)GB7M4Gcz}nodFvGij%nk Q9|4QA*#RvEvj+(M4-)YazW@LL diff --git a/ars/docker-compose.dev.yaml b/ars/docker-compose.dev.yaml index cd67f2a..5d69b1b 100644 --- a/ars/docker-compose.dev.yaml +++ b/ars/docker-compose.dev.yaml @@ -2,14 +2,17 @@ version: '3.3' services: my_backend: + platform: linux/x86_64 + image: asia.gcr.io/artiful-a1/my_backend:1.9 build: context: . dockerfile: Dockerfile + env_file: + - ./.env.dev ports: - 3000:3000 volumes: - ./src:/myfolder/src - - ./.env:/myfolder/.env my_database: platform: linux/x86_64 diff --git a/ars/elk/logstash/logstash.conf b/ars/elk/logstash/logstash.conf index 7013835..12f440a 100644 --- a/ars/elk/logstash/logstash.conf +++ b/ars/elk/logstash/logstash.conf @@ -13,7 +13,7 @@ input { last_run_metadata_path => "./aaa.txt" tracking_column_type => "numeric" - statement => "select art.id, title, start_price, instant_bid, price, thumbnail, createdAt, deadline, tag1, tag2, tag3, tag4, updatedat, u.nickname, unix_timestamp(art.updatedat) as updatedat from art left join user as u ON art.userId = u.id where unix_timestamp(art.updatedat) > :sql_last_value order by updatedat asc" + statement => "select art.id, title, start_price, instant_bid, thumbnail, createdAt, deadline, tag1, tag2, tag3, tag4, updatedat, u.nickname, unix_timestamp(art.updatedat) as updatedat from art left join user as u ON art.userId = u.id where unix_timestamp(art.updatedat) > :sql_last_value order by updatedat asc" } } diff --git a/ars/src/apis/art/art.resolver.ts b/ars/src/apis/art/art.resolver.ts index 1d0ab90..5d71497 100644 --- a/ars/src/apis/art/art.resolver.ts +++ b/ars/src/apis/art/art.resolver.ts @@ -41,6 +41,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul09', + from: 0, + size: 500, query: { bool: { must: [{ match: { tag1: tags[0] } }], @@ -56,7 +58,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 +80,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul09', + from: 0, + size: 500, query: { bool: { must: [{ match: { tag1: tags[0] } }, { match: { tag2: tags[1] } }], @@ -94,7 +97,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 +120,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul09', + from: 0, + size: 500, query: { bool: { must: [ @@ -132,12 +136,12 @@ export class ArtResolver { if (!result.hits.hits.length) return null; const artTags = result.hits.hits.map((el: any) => { + console.log('=======', el); return { id: el._source.id, 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 +166,8 @@ export class ArtResolver { const result = await this.elasticsearchService.search({ index: 'artipul09', + from: 0, + size: 500, query: { bool: { must: [ @@ -182,7 +188,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 994db75..7963b05 100644 --- a/ars/src/apis/art/art.service.ts +++ b/ars/src/apis/art/art.service.ts @@ -34,9 +34,7 @@ export class ArtService { tag2: tags[1], tag3: tags[2], tag4: tags[3], - createdAt: MoreThan(createdAt), }, - order: { createdAt: 'ASC' }, }); break; case 3: @@ -45,9 +43,7 @@ export class ArtService { tag1: tags[0], tag2: tags[1], tag3: tags[2], - createdAt: MoreThan(createdAt), }, - order: { createdAt: 'ASC' }, }); break; case 2: @@ -55,18 +51,14 @@ export class ArtService { where: { tag1: tags[0], tag2: tags[1], - createdAt: MoreThan(createdAt), }, - order: { createdAt: 'ASC' }, }); break; case 1: result = await this.artRepository.find({ where: { tag1: tags[0], - createdAt: MoreThan(createdAt), }, - order: { createdAt: 'ASC' }, }); } await queryRunner.commitTransaction(); diff --git a/ars/src/apis/art/dto/createArtInput.ts b/ars/src/apis/art/dto/createArtInput.ts index 55ed12b..860beed 100644 --- a/ars/src/apis/art/dto/createArtInput.ts +++ b/ars/src/apis/art/dto/createArtInput.ts @@ -17,7 +17,7 @@ export class CreateArtInput { @Field(() => Int) price: number; - @Field(() => Date) + @Field(() => Date, { nullable: true }) deadline: Date; @Field(() => [String]) @@ -28,16 +28,4 @@ export class CreateArtInput { @Field(() => [String]) tags: string[]; - - // @Field(() => String) - // tag1: string; - - // @Field(() => String, { nullable: true }) - // tag2?: string; - - // @Field(() => String, { nullable: true }) - // tag3?: string; - - // @Field(() => String, { nullable: true }) - // tag4?: string; } diff --git a/ars/src/apis/art/entities/artsSearch.entity.ts b/ars/src/apis/art/entities/artsSearch.entity.ts index bff902b..dd97da2 100644 --- a/ars/src/apis/art/entities/artsSearch.entity.ts +++ b/ars/src/apis/art/entities/artsSearch.entity.ts @@ -29,8 +29,8 @@ export class ArtsSearch { thumbnail: string; @Column() - @Field(() => Date) - deadline: Date; + @Field(() => String, { nullable: true }) + deadline: string; @Column() @Field(() => String) diff --git a/ars/src/app.module.ts b/ars/src/app.module.ts index 3affd5c..21ad61a 100644 --- a/ars/src/app.module.ts +++ b/ars/src/app.module.ts @@ -47,6 +47,7 @@ import { PaymentModule } from './apis/payment/payment.module'; entities: [__dirname + '/apis/**/*.entity.*'], synchronize: true, logging: true, + timezone: 'Asia/seoul', }), CacheModule.register({ store: redisStore, diff --git a/ars/src/common/graphql/schema.gql b/ars/src/common/graphql/schema.gql index e89ded4..d828794 100644 --- a/ars/src/common/graphql/schema.gql +++ b/ars/src/common/graphql/schema.gql @@ -103,7 +103,7 @@ type ArtsSearch { instant_bid: Int! price: Int! thumbnail: String! - deadline: DateTime! + deadline: String tag1: String! tag2: String tag3: String @@ -203,7 +203,7 @@ input CreateArtInput { start_price: Int! instant_bid: Int! price: Int! - deadline: DateTime! + deadline: DateTime image_urls: [String!]! is_soldout: Boolean! tags: [String!]!