Skip to content

Commit

Permalink
modify/#66: modify entity
Browse files Browse the repository at this point in the history
  • Loading branch information
hobiJeong committed Dec 3, 2023
1 parent 3865fec commit 9683159
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/entities/NoticeBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NoticeBoardReaction } from './NoticeBoardReaction';
import { NoticeBoardReplyComment } from './NoticeBoardReplyComment';
import { User } from './User';
import { NoticeBoardHistory } from './NoticeBoardHistory';
import { BooleanTransformer } from './transfomers/boolean.transfomer';

@Entity('notice_board', { schema: 'dongurami_local_db' })
export class NoticeBoard {
Expand Down Expand Up @@ -41,8 +42,9 @@ export class NoticeBoard {
comment: '댓글 허용 여부 (0: 비활성화, 1: 허용)',
unsigned: true,
default: () => "'1'",
transformer: new BooleanTransformer(),
})
allowComment: number;
allowComment: boolean;

@Column('timestamp', {
name: 'created_at',
Expand Down
18 changes: 17 additions & 1 deletion src/entities/NoticeBoardHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NoticeBoardCommentHistory } from './NoticeBoardCommentHistory';
import { NoticeBoardReplyCommentHistory } from './NoticeBoardReplyCommentHistory';
import { User } from './User';
import { NoticeBoard } from './NoticeBoard';
import { BooleanTransformer } from './transfomers/boolean.transfomer';

@Entity('notice_board_history', { schema: 'dongurami_local_db' })
export class NoticeBoardHistory {
Expand All @@ -32,8 +33,9 @@ export class NoticeBoardHistory {
comment: '댓글 허용 여부 (0: 비활성화, 1: 허용)',
unsigned: true,
default: () => "'1'",
transformer: new BooleanTransformer(),
})
allowComment: number;
allowComment: boolean;

@Column('timestamp', {
name: 'created_at',
Expand All @@ -48,6 +50,20 @@ export class NoticeBoardHistory {
)
noticeBoardCommentHistories: NoticeBoardCommentHistory[];

@Column('int', {
name: 'notice_board_id',
comment: '공지 게시글 고유 ID',
unsigned: true,
})
noticeBoardId: number;

@Column('int', {
name: 'user_id',
comment: '게시글 작성 유저 고유 ID',
unsigned: true,
})
userId: number;

@ManyToOne(() => User, (user) => user.noticeBoardHistories, {
onDelete: 'NO ACTION',
onUpdate: 'NO ACTION',
Expand Down

0 comments on commit 9683159

Please sign in to comment.