From 840b3617ebc1a6076d5975db37ba8ed2a10ea0c1 Mon Sep 17 00:00:00 2001 From: GeunH Date: Mon, 20 Nov 2023 21:14:07 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat=20:=20user=20restaurant=20list=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EA=B5=AC=ED=98=84=20#33?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- be/src/app.module.ts | 4 ++- .../user/entities/user.followList.entity.ts | 27 ++++++++++++++++ .../user/entities/user.restaurantlist.dot.ts | 32 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 be/src/user/entities/user.followList.entity.ts create mode 100644 be/src/user/entities/user.restaurantlist.dot.ts diff --git a/be/src/app.module.ts b/be/src/app.module.ts index d059e90..6adcaad 100644 --- a/be/src/app.module.ts +++ b/be/src/app.module.ts @@ -3,8 +3,10 @@ import { UserModule } from "./user/user.module"; import { TypeOrmModule } from "@nestjs/typeorm"; import { typeORMConfig } from "./configs/typeorm.config"; import { AuthModule } from "./auth/auth.module"; +import { RestaurantModule } from './restaurant/restaurant.module'; +import { ReviewModule } from './review/review.module'; @Module({ - imports: [UserModule, TypeOrmModule.forRoot(typeORMConfig), AuthModule], + imports: [UserModule, TypeOrmModule.forRoot(typeORMConfig), AuthModule, RestaurantModule, ReviewModule], }) export class AppModule {} diff --git a/be/src/user/entities/user.followList.entity.ts b/be/src/user/entities/user.followList.entity.ts new file mode 100644 index 0000000..bc36a58 --- /dev/null +++ b/be/src/user/entities/user.followList.entity.ts @@ -0,0 +1,27 @@ +import { + Entity, + PrimaryColumn, + CreateDateColumn, + DeleteDateColumn, + ManyToOne, + JoinColumn +} from 'typeorm'; +import { User } from './user.entity'; + +@Entity('follow') +export class FollowEntity { + @ManyToOne(() => User) + @PrimaryColumn({ name: 'following_user_id' }) + followingUserId: number; + + @ManyToOne(() => User) + @PrimaryColumn({ name: 'followed_user_id' }) + followedUserId: number; + + @CreateDateColumn({ name: 'created_at' }) + createdAt: Date; + + @DeleteDateColumn({ name: 'deleted_at', nullable: true, type: 'timestamp' }) + deletedAt: Date | null; + +} diff --git a/be/src/user/entities/user.restaurantlist.dot.ts b/be/src/user/entities/user.restaurantlist.dot.ts new file mode 100644 index 0000000..a42778b --- /dev/null +++ b/be/src/user/entities/user.restaurantlist.dot.ts @@ -0,0 +1,32 @@ +import { + Entity, + Column, + CreateDateColumn, + ManyToOne, + JoinColumn, + PrimaryColumn, +} from 'typeorm'; +import { User } from './user.entity'; +import { Restaurant } from 'src/restaurant/entities/restaurant.entity'; +import { Review } from 'src/review/entities/review.entity'; + +@Entity('user_restaurant_lists') +export class UserRestaurantList { + @ManyToOne(() => User) + @PrimaryColumn({ name: 'user_id' }) + userId: User; + + @ManyToOne(() => Restaurant) + @PrimaryColumn({ name: 'restaurant_id' }) + restaurantId: Restaurant; + + @ManyToOne(() => Review) + @JoinColumn({ name: 'review_id' }) + reviewId: Review; + + @CreateDateColumn({ name: 'created_at', type: 'timestamp' }) + createdAt: Date; + + @Column({ name: 'deleted_at', type: 'timestamp', nullable: true }) + deletedAt: Date | null; +} From d43f31c56ed778b3251026b3cdfa3c88a8882940 Mon Sep 17 00:00:00 2001 From: GeunH Date: Mon, 20 Nov 2023 21:23:17 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat=20:=20restaurant=20Info=20dto=20?= =?UTF-8?q?=EB=B0=8F=20entity=20=EA=B5=AC=ED=98=84=20#33?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- be/src/restaurant/dto/restaurantInfo.dto.ts | 15 +++++++ .../restaurant/entities/restaurant.entity.ts | 39 +++++++++++++++++++ be/src/restaurant/restaurant.module.ts | 4 ++ .../user/entities/user.restaurantlist.dot.ts | 2 +- 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 be/src/restaurant/dto/restaurantInfo.dto.ts create mode 100644 be/src/restaurant/entities/restaurant.entity.ts create mode 100644 be/src/restaurant/restaurant.module.ts diff --git a/be/src/restaurant/dto/restaurantInfo.dto.ts b/be/src/restaurant/dto/restaurantInfo.dto.ts new file mode 100644 index 0000000..717c241 --- /dev/null +++ b/be/src/restaurant/dto/restaurantInfo.dto.ts @@ -0,0 +1,15 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { + IsNotEmpty, + IsInt, +} from "class-validator"; + +export class RestaurantInfoDto { + @ApiProperty({ + example: "음식점 id", + description: "The id of the restaurant", + }) + @IsInt() + @IsNotEmpty() + id: number; +} diff --git a/be/src/restaurant/entities/restaurant.entity.ts b/be/src/restaurant/entities/restaurant.entity.ts new file mode 100644 index 0000000..1c19321 --- /dev/null +++ b/be/src/restaurant/entities/restaurant.entity.ts @@ -0,0 +1,39 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm'; + +@Entity('restaurant') +export class RestaurantInfoEntity { + @PrimaryGeneratedColumn('increment') + id: number; + + @Column({ type: 'varchar', length: 100 }) + name: string; + + @Column({ + type: 'geometry', + spatialFeatureType: 'Point', + srid: 4326, + nullable: true + }) + location: string | null; + + @Column({ type: 'text', nullable: true }) + address: string | null; + + @Column({ type: 'varchar', length: 20, nullable: true }) + category: string | null; + + @Column({ type: 'int', default: 0 }) + reviewCnt: number; + + @Column({ type: 'varchar', length: 20, nullable: true }) + phoneNumber: string | null; + + @CreateDateColumn({ name: 'created_at' }) + createdAt: Date; + + @Column({ name: 'deleted_at', type: 'timestamp', nullable: true }) + deletedAt: Date | null; + + @UpdateDateColumn({ name: 'updated_at' }) + updatedAt: Date; +} diff --git a/be/src/restaurant/restaurant.module.ts b/be/src/restaurant/restaurant.module.ts new file mode 100644 index 0000000..f7e0840 --- /dev/null +++ b/be/src/restaurant/restaurant.module.ts @@ -0,0 +1,4 @@ +import { Module } from '@nestjs/common'; + +@Module({}) +export class RestaurantModule {} diff --git a/be/src/user/entities/user.restaurantlist.dot.ts b/be/src/user/entities/user.restaurantlist.dot.ts index a42778b..4bb78e4 100644 --- a/be/src/user/entities/user.restaurantlist.dot.ts +++ b/be/src/user/entities/user.restaurantlist.dot.ts @@ -11,7 +11,7 @@ import { Restaurant } from 'src/restaurant/entities/restaurant.entity'; import { Review } from 'src/review/entities/review.entity'; @Entity('user_restaurant_lists') -export class UserRestaurantList { +export class UserRestaurantListEntity { @ManyToOne(() => User) @PrimaryColumn({ name: 'user_id' }) userId: User; From 6237f99da2cc5644dde1a73268f47ea3ba450d74 Mon Sep 17 00:00:00 2001 From: GeunH Date: Mon, 20 Nov 2023 21:58:53 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat=20:=20review=20Info=20dto=20=EB=B0=8F?= =?UTF-8?q?=20entity=20=EA=B5=AC=ED=98=84=20#33?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../restaurant/entities/restaurant.entity.ts | 2 +- be/src/review/dto/reviewInfo.dto.ts | 56 +++++++++++++++++++ be/src/review/entities/review.entity.ts | 41 ++++++++++++++ be/src/review/review.module.ts | 4 ++ ...t.dot.ts => user.restaurantlist.entity.ts} | 14 ++--- 5 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 be/src/review/dto/reviewInfo.dto.ts create mode 100644 be/src/review/entities/review.entity.ts create mode 100644 be/src/review/review.module.ts rename be/src/user/entities/{user.restaurantlist.dot.ts => user.restaurantlist.entity.ts} (64%) diff --git a/be/src/restaurant/entities/restaurant.entity.ts b/be/src/restaurant/entities/restaurant.entity.ts index 1c19321..e75141a 100644 --- a/be/src/restaurant/entities/restaurant.entity.ts +++ b/be/src/restaurant/entities/restaurant.entity.ts @@ -14,7 +14,7 @@ export class RestaurantInfoEntity { srid: 4326, nullable: true }) - location: string | null; + location: string; @Column({ type: 'text', nullable: true }) address: string | null; diff --git a/be/src/review/dto/reviewInfo.dto.ts b/be/src/review/dto/reviewInfo.dto.ts new file mode 100644 index 0000000..f4d356d --- /dev/null +++ b/be/src/review/dto/reviewInfo.dto.ts @@ -0,0 +1,56 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { + IsBoolean, + IsString, + IsNotEmpty, + IsInt, + MaxLength, + IsOptional, + MinLength +} from "class-validator"; + +export class ReviewInfoDto { + @ApiProperty({ + example: "true", + description: "The transportation for visiting", + }) + @IsBoolean() + @IsNotEmpty() + visitMethod: boolean; + + @ApiProperty({ example: "0", description: "transportation Accessibility for visiting" }) + @IsInt() + @IsOptional() + @MaxLength(1) + transportationAccessibility: number | null; + + @ApiProperty({ example: "0", description: "condition of the restaurant's parking area" }) + @IsInt() + @IsOptional() + @MaxLength(1) + parkingArea: number | null; + + @ApiProperty({ example: "0", description: "The taste of the food" }) + @IsInt() + @IsNotEmpty() + @MaxLength(1) + taste: number; + + @ApiProperty({ example: "0", description: "The service of the restaurant" }) + @IsInt() + @IsNotEmpty() + @MaxLength(1) + service: number; + + @ApiProperty({ example: "0", description: "The condition of the restaurant's restroom" }) + @IsInt() + @IsNotEmpty() + @MaxLength(1) + restroomtCleanliness: number; + + @ApiProperty({ example: "좋았음", description: "The overallExperience about the restaurant" }) + @IsString() + @IsNotEmpty() + @MinLength(20) + overallExperience: string; +} diff --git a/be/src/review/entities/review.entity.ts b/be/src/review/entities/review.entity.ts new file mode 100644 index 0000000..26521d1 --- /dev/null +++ b/be/src/review/entities/review.entity.ts @@ -0,0 +1,41 @@ +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm'; +import { User } from 'src/user/entities/user.entity'; +import { RestaurantInfoEntity } from 'src/restaurant/entities/restaurant.entity'; + +@Entity('review') +export class ReviewInfoEntity { + @PrimaryGeneratedColumn('increment') + id: number; + + @ManyToOne(() => User) + @JoinColumn({ name: 'user_id' }) + user: User; + + @ManyToOne(() => RestaurantInfoEntity) + @JoinColumn({ name: 'restaurant_id' }) + restaurant: RestaurantInfoEntity; + + @Column({ type: 'boolean' }) + visitMethod: boolean; + + @Column({ type: 'smallint', nullable: true }) + transportationAccessibility: number | null; + + @Column({ type: 'smallint', nullable: true }) + parkingArea: number | null; + + @Column({ type: 'smallint' }) + taste: number; + + @Column({ type: 'smallint' }) + service: number; + + @Column({ type: 'smallint' }) + restroomCleanliness: number; + + @Column({ type: 'text' }) + overallExperience: string; + + @CreateDateColumn({ name: 'created_at' }) + createdAt: Date; +} diff --git a/be/src/review/review.module.ts b/be/src/review/review.module.ts new file mode 100644 index 0000000..b3f019a --- /dev/null +++ b/be/src/review/review.module.ts @@ -0,0 +1,4 @@ +import { Module } from '@nestjs/common'; + +@Module({}) +export class ReviewModule {} diff --git a/be/src/user/entities/user.restaurantlist.dot.ts b/be/src/user/entities/user.restaurantlist.entity.ts similarity index 64% rename from be/src/user/entities/user.restaurantlist.dot.ts rename to be/src/user/entities/user.restaurantlist.entity.ts index 4bb78e4..f19b859 100644 --- a/be/src/user/entities/user.restaurantlist.dot.ts +++ b/be/src/user/entities/user.restaurantlist.entity.ts @@ -7,22 +7,22 @@ import { PrimaryColumn, } from 'typeorm'; import { User } from './user.entity'; -import { Restaurant } from 'src/restaurant/entities/restaurant.entity'; -import { Review } from 'src/review/entities/review.entity'; +import { RestaurantInfoEntity } from 'src/restaurant/entities/restaurant.entity'; +import { ReviewInfoEntity } from 'src/review/entities/review.entity'; @Entity('user_restaurant_lists') export class UserRestaurantListEntity { @ManyToOne(() => User) @PrimaryColumn({ name: 'user_id' }) - userId: User; + userId: number; - @ManyToOne(() => Restaurant) + @ManyToOne(() => RestaurantInfoEntity) @PrimaryColumn({ name: 'restaurant_id' }) - restaurantId: Restaurant; + restaurantId: number; - @ManyToOne(() => Review) + @ManyToOne(() => ReviewInfoEntity) @JoinColumn({ name: 'review_id' }) - reviewId: Review; + reviewId: ReviewInfoEntity; @CreateDateColumn({ name: 'created_at', type: 'timestamp' }) createdAt: Date;