Skip to content

Commit

Permalink
feat : restaurant Info dto 및 entity 구현 #35
Browse files Browse the repository at this point in the history
  • Loading branch information
GeunH committed Nov 20, 2023
1 parent 597b11f commit c3dc15c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
15 changes: 15 additions & 0 deletions be/src/restaurant/dto/restaurantInfo.dto.ts
Original file line number Diff line number Diff line change
@@ -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;
}
39 changes: 39 additions & 0 deletions be/src/restaurant/entities/restaurant.entity.ts
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 4 additions & 0 deletions be/src/restaurant/restaurant.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Module } from '@nestjs/common';

@Module({})
export class RestaurantModule {}
2 changes: 1 addition & 1 deletion be/src/user/entities/user.restaurantlist.dot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c3dc15c

Please sign in to comment.