hippofish/packages/backend/src/models/entities/user-ip.ts

32 lines
531 B
TypeScript
Raw Normal View History

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";
@Entity()
2023-05-29 18:31:02 +02:00
@Index(["userId", "ip"], { unique: true })
export class UserIp {
@PrimaryGeneratedColumn()
public id: string;
2023-05-29 18:31:02 +02:00
@Column("timestamp with time zone", {})
public createdAt: Date;
@Index()
@Column(id())
2023-01-13 05:40:33 +01:00
public userId: User["id"];
2023-05-29 18:31:02 +02:00
@Column("varchar", {
length: 128,
})
public ip: string;
}