import Column from "@entity-access/entity-access/dist/decorators/Column.js"; import Table from "@entity-access/entity-access/dist/decorators/Table.js"; import Sql from "@entity-access/entity-access/dist/sql/Sql.js"; import DateTime from "@entity-access/entity-access/dist/types/DateTime.js"; /** * We will use IP Whois to extract information about the ip and store the block. * We will clean up blocks after 30 days. */ @Table("GeoIPBlocks") export default class GeoIPBlock { @Column({ dataType: "BigInt", key: true, indexOrder: "ascending"}) blockStart: number; @Column({ dataType: "BigInt", key: true, indexOrder: "ascending" }) blockEnd: number; @Column({ dataType: "DateTime", default: () => Sql.date.now()}) dateCreated: DateTime; @Column({ dataType: "DateTime", default: () => Sql.date.addDays(Sql.date.now(), 30)}) dateExpires: DateTime; /** Although we will only try to store country code but in case if somebody put extra characters such as US virgin islands */ @Column({ dataType: "Char", length: 50}) country: string; @Column({ dataType: "Boolean", default: () => false }) verified: boolean; @Column({ dataType: "Char", nullable: true }) error: string; }