공통으로 사용할 Entity 컬럼을 따로 만들어서 extends를 통해서 사용한다.
CreatedDate와 UpdatedDate에는 Special columns를 사용한다.
-
@CreateDateColumn is a 자동으로 엔터티 생성 날짜를 만들어준다.
-
@UpdateDateColumn is a 자동으로 엔터티 업데이트 날짜를 만들어준다.
-
@DeleteDateColumn is a special column that is automatically set to the entity's delete time each time you call soft-delete of entity manager or repository. .
-
@VersionColumn is a special column that is automatically set to the version of the entity (incremental number)
each time you call save of entity manager or repository.
TypeOrmModule에 User Entity를 추가한다.
TypeOrmModule.forRoot({
type: "postgres",
host: process.env.DB_HOST,
port: +process.env.DB_PORT,
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
synchronize: process.env.NODE_ENV !== 'prod',
logging: true,
entities: [User],
'Uber Eats' 카테고리의 다른 글
Uber Eats # 16 User Authentication (0) | 2021.03.11 |
---|---|
Uber Eats # 15 User Resolver and Service, InputType과 ObjectType 비교 (0) | 2021.03.09 |
Uber Eats # 13 User CRUD (0) | 2021.03.09 |
Uber Eats # 12 Create Restaurant (0) | 2021.03.08 |
Uber Eats # 11 Repository (0) | 2021.03.07 |