mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 13:49:40 +00:00
feat: gift journeys
This commit is contained in:
30
src/gift/entities/gift-redemption.entity.ts
Normal file
30
src/gift/entities/gift-redemption.entity.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import {
|
||||
BaseEntity,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { Gift } from './gift.entity';
|
||||
|
||||
@Entity('gift_redemptions')
|
||||
export class GiftRedemption extends BaseEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column({ type: 'uuid', name: 'gift_id' })
|
||||
giftId!: string;
|
||||
|
||||
@ManyToOne(() => Gift, (gift) => gift.redemptions, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'gift_id' })
|
||||
gift!: Gift;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' })
|
||||
createdAt!: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at', type: 'timestamp with time zone', default: () => 'CURRENT_TIMESTAMP' })
|
||||
updatedAt!: Date;
|
||||
}
|
Reference in New Issue
Block a user