2023-01-13 05:40:33 +01:00
|
|
|
import {
|
|
|
|
PrimaryColumn,
|
|
|
|
Entity,
|
|
|
|
Index,
|
|
|
|
JoinColumn,
|
|
|
|
Column,
|
|
|
|
ManyToOne,
|
|
|
|
PrimaryGeneratedColumn,
|
|
|
|
} from "typeorm";
|
|
|
|
import { id } from "../id.js";
|
|
|
|
import { Note } from "./note.js";
|
|
|
|
import type { User } from "./user.js";
|
2022-07-02 08:12:11 +02:00
|
|
|
|
|
|
|
@Entity()
|
2023-05-29 18:31:02 +02:00
|
|
|
@Index(["userId", "ip"], { unique: true })
|
2022-07-02 08:12:11 +02:00
|
|
|
export class UserIp {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
public id: string;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("timestamp with time zone", {})
|
2022-07-02 08:12:11 +02:00
|
|
|
public createdAt: Date;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column(id())
|
2023-01-13 05:40:33 +01:00
|
|
|
public userId: User["id"];
|
2022-07-02 08:12:11 +02:00
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
2022-07-02 08:12:11 +02:00
|
|
|
length: 128,
|
|
|
|
})
|
|
|
|
public ip: string;
|
|
|
|
}
|