|
1 | | -import { DATABASE_CONSTANTS } from 'podverse-helpers'; |
2 | | -import { Entity, Column, ManyToOne, JoinColumn, PrimaryGeneratedColumn } from 'typeorm'; |
| 1 | +import { DATABASE_CONSTANTS, AccountFCMDevicePlatformEnum } from 'podverse-helpers'; |
| 2 | +import { Entity, Column, ManyToOne, JoinColumn, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm'; |
3 | 3 | import { Account } from '@orm/entities/account/account'; |
4 | 4 |
|
5 | 5 | @Entity() |
6 | 6 | export class AccountFCMDevice { |
7 | 7 | @PrimaryGeneratedColumn() |
8 | 8 | id!: number; |
9 | 9 |
|
10 | | - @Column({ type: 'varchar', unique: true, length: DATABASE_CONSTANTS.varchar_fcm_token }) |
| 10 | + @Column({ type: 'varchar', length: DATABASE_CONSTANTS.varchar_fcm_token, unique: true }) |
11 | 11 | fcm_token!: string; |
12 | 12 |
|
| 13 | + @Column({ type: 'varchar', length: DATABASE_CONSTANTS.varchar_guid, unique: true }) |
| 14 | + installation_id!: string; |
| 15 | + |
13 | 16 | @Column() |
14 | 17 | account_id!: number; |
15 | 18 |
|
| 19 | + @Column({ type: 'enum', enum: AccountFCMDevicePlatformEnum }) |
| 20 | + platform!: AccountFCMDevicePlatformEnum; |
| 21 | + |
| 22 | + @Column({ type: 'varchar', length: DATABASE_CONSTANTS.varchar_locale }) |
| 23 | + locale!: string; |
| 24 | + |
| 25 | + @CreateDateColumn({ name: 'created_at', type: 'timestamp' }) |
| 26 | + created_at!: Date; |
| 27 | + |
| 28 | + @UpdateDateColumn({ name: 'updated_at', type: 'timestamp' }) |
| 29 | + updated_at!: Date; |
| 30 | + |
16 | 31 | @ManyToOne(() => Account, account => account.id, { onDelete: 'CASCADE' }) |
17 | 32 | @JoinColumn({ name: 'account_id' }) |
18 | 33 | account!: Account; |
|
0 commit comments