2022-07-02 08:12:11 +02:00
|
|
|
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
|
|
|
|
import { id } from '../id.js';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { Note } from './Note.js';
|
|
|
|
import type { User } from './User.js';
|
2022-07-02 08:12:11 +02:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
@Index(['userId', 'ip'], { unique: true })
|
|
|
|
export class UserIp {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
public id: string;
|
|
|
|
|
|
|
|
@Column('timestamp with time zone', {
|
|
|
|
})
|
|
|
|
public createdAt: Date;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column(id())
|
|
|
|
public userId: User['id'];
|
|
|
|
|
|
|
|
@Column('varchar', {
|
|
|
|
length: 128,
|
|
|
|
})
|
|
|
|
public ip: string;
|
|
|
|
}
|