diff --git a/docker-compose.yaml b/docker-compose.yaml index 640c4c2..2fe8367 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -27,10 +27,10 @@ services: - 6379:6379 elasticsearch: - image: elasticsearch:7.17.0 - # build: - # context: . - # dockerfile: Dockerfile.elasticsearch + # image: elasticsearch:7.17.0 + build: + context: . + dockerfile: Dockerfile.elasticsearch restart: always environment: discovery.type: single-node diff --git a/elk/logstash/auto_template2.json b/elk/logstash/auto_template2.json index 747f2c9..6b27e7d 100644 --- a/elk/logstash/auto_template2.json +++ b/elk/logstash/auto_template2.json @@ -1,6 +1,6 @@ { "template": "auto-*", - "index_patterns": ["autocomplete-shop-*"], + "index_patterns": ["auto_shop_*"], "order": "1", "settings": { "analysis": { diff --git a/src/apis/dogs/entities/dog.entity.ts b/src/apis/dogs/entities/dog.entity.ts index 0771033..eabf7f9 100644 --- a/src/apis/dogs/entities/dog.entity.ts +++ b/src/apis/dogs/entities/dog.entity.ts @@ -68,10 +68,10 @@ export class Dog { @Field(() => String, { nullable: true }) image: string; - @CreateDateColumn({ nullable: true }) + @CreateDateColumn() createdAt: Date; - @DeleteDateColumn({ nullable: true }) + @DeleteDateColumn() deletedAt: Date; @ManyToOne(() => User, (user) => user.dogs) @@ -79,7 +79,14 @@ export class Dog { user: User; // Dog : Reservation = 1 : N - @OneToMany(() => Reservation, (reservation) => reservation.dog) - @Field(() => [Reservation]) + @OneToMany( + () => Reservation, + (reservation) => reservation.dog, // + { nullable: true }, + ) + @Field( + () => [Reservation], // + { nullable: true }, + ) reservation: Reservation[]; } diff --git a/src/apis/reservations/entities/reservation.entity.ts b/src/apis/reservations/entities/reservation.entity.ts index 4a6f6bd..d97c89e 100644 --- a/src/apis/reservations/entities/reservation.entity.ts +++ b/src/apis/reservations/entities/reservation.entity.ts @@ -8,7 +8,6 @@ import { CreateDateColumn, DeleteDateColumn, Entity, - JoinColumn, ManyToOne, OneToOne, PrimaryGeneratedColumn, diff --git a/src/apis/reviews/entities/review.entity.ts b/src/apis/reviews/entities/review.entity.ts index 71f580d..49f867f 100644 --- a/src/apis/reviews/entities/review.entity.ts +++ b/src/apis/reviews/entities/review.entity.ts @@ -32,7 +32,8 @@ export class Review { // 예약(own) : 리뷰 = 1 : 1 // FK컬럼이 생기는 곳 = 리뷰 @JoinColumn() - @OneToOne(() => Reservation) + @OneToOne(() => Reservation, (reservation) => reservation.review) + @Field(() => Reservation) reservation: Reservation; // // 가게 : 리뷰 = 1:N //OneToMany 받음 diff --git a/src/apis/shops/entities/shop.entity.ts b/src/apis/shops/entities/shop.entity.ts index cd1345c..06b6a95 100644 --- a/src/apis/shops/entities/shop.entity.ts +++ b/src/apis/shops/entities/shop.entity.ts @@ -3,7 +3,6 @@ import { Reservation } from 'src/apis/reservations/entities/reservation.entity'; import { Review } from 'src/apis/reviews/entities/review.entity'; import { ShopImage } from 'src/apis/shopImages/entities/shopImages.entity'; import { - Any, Column, DeleteDateColumn, Entity, @@ -60,21 +59,21 @@ export class Shop { @OneToMany(() => Reservation, (reservation) => reservation.shop, { nullable: true, }) - @Field(() => [Reservation]) + @Field(() => [Reservation], { nullable: true }) reservation: Reservation[]; // 가게(own):가게이미지 = 1:N @OneToMany(() => ShopImage, (shopImage) => shopImage.shop, { nullable: true, }) - @Field(() => [ShopImage]) + @Field(() => [ShopImage], { nullable: true }) image: ShopImage[]; // 가게(own):리뷰 = 1:N @OneToMany(() => Review, (review) => review.shop, { nullable: true, }) - @Field(() => [Review]) + @Field(() => [Review], { nullable: true }) review: Review[]; // logstash 데이터 폴링 기준 칼럼 diff --git a/src/apis/users/entities/user.entity.ts b/src/apis/users/entities/user.entity.ts index 34a276f..06547ac 100644 --- a/src/apis/users/entities/user.entity.ts +++ b/src/apis/users/entities/user.entity.ts @@ -51,14 +51,20 @@ export class User { updateAt: Date; // Dog - @OneToMany(() => Dog, (dogs) => dogs.user) - @Field(() => [Dog]) + @OneToMany( + () => Dog, + (dogs) => dogs.user, // + { nullable: true }, + ) + @Field(() => [Dog], { nullable: true }) dogs: Dog[]; // reservation - @OneToMany(() => Reservation, (reservation) => reservation.user, { - nullable: true, - }) - @Field(() => [Reservation]) + @OneToMany( + () => Reservation, + (reservation) => reservation.user, // + { nullable: true }, + ) + @Field(() => [Reservation], { nullable: true }) reservation: Reservation[]; } diff --git a/src/app.module.ts b/src/app.module.ts index 879afed..0bfd0c9 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -71,7 +71,7 @@ import { HttpExceptionFilter } from './commons/filter/http-exception.filter'; password: process.env.DATABASE_PASSWORD, database: process.env.DATABASE_DATABASE, entities: [__dirname + '/apis/**/*.entity.*'], - synchronize: false, + synchronize: true, logging: true, }), CacheModule.register({