Skip to content

Commit

Permalink
fix: typeOrm error 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Jieun1ee committed Nov 6, 2024
1 parent 8a2e186 commit 6476ad1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/entity/applicant.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Ticle } from './ticle.entity';
import { User } from './user.entity';

@Entity('applicant')
@Index('idx_unique_application', ['ticle_id', 'user_id'], { unique: true })
@Index('idx_unique_application', ['ticle', 'user'], { unique: true })
export class Applicant {
@PrimaryGeneratedColumn({ type: 'bigint' })
id: number;
Expand All @@ -25,6 +25,6 @@ export class Applicant {
@JoinColumn({ name: 'user_id' })
user: User;

@CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' })
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
createdAt: Date;
}
2 changes: 1 addition & 1 deletion apps/api/src/entity/summary.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Summary {
@Column('varchar')
summary: string;

@CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' })
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
createdAt: Date;

@OneToOne(() => Ticle, (ticle) => ticle.summary)
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/entity/tag.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Tag {
@Column('varchar')
name: string;

@CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' })
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
createdAt: Date;

@ManyToMany(() => Ticle, (ticle) => ticle.tags)
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/entity/ticle.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class Ticle {
@Column({ type: 'enum', enum: TicleStatus, default: TicleStatus.OPEN, name: 'ticle_status' })
ticleStatus: TicleStatus;

@CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' })
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
createdAt: Date;

@OneToMany(() => Applicant, (applicant) => applicant.ticle)
Expand Down
15 changes: 10 additions & 5 deletions apps/api/src/entity/user.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, OneToMany } from 'typeorm';
import {
Entity,
Column,
PrimaryGeneratedColumn,
CreateDateColumn,
OneToMany,
UpdateDateColumn,
} from 'typeorm';

import { Applicant } from './applicant.entity';
import { Ticle } from './ticle.entity';
Expand Down Expand Up @@ -32,13 +39,11 @@ export class User {
@Column({ type: 'varchar', name: 'social_id' })
socialId: string;

@CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', name: 'created_at' })
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
createdAt: Date;

@CreateDateColumn({
@UpdateDateColumn({
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP',
onUpdate: 'CURRENT_TIMESTAMP',
name: 'updated_at',
})
updatedAt: Date;
Expand Down

0 comments on commit 6476ad1

Please sign in to comment.