<commit_before>import {
  Entity,
  Column,
  ManyToOne,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
  CreateDateColumn,
} from 'typeorm';
import { User } from './User';

@Entity()
export class UserSession {
  @PrimaryGeneratedColumn('uuid')
  public id!: string;

  @ManyToOne(() => User, (user) => user.sessions, { onDelete: 'CASCADE' })
  public user!: User;

  @Column()
  public token!: string;

  @Column()
  public valid!: boolean;

  @Column({ nullable: true })
  public userAgent?: string | null;

  @Column({ nullable: true })
  public ip?: string | null;

  @Column('jsonb', { nullable: true })
  public extra?: object;

  @CreateDateColumn()
  public createdAt!: string;

  @UpdateDateColumn()<commit_msg>fix(typeorm): add explicit types to userSession and IP decorator (#994)<commit_after>import {
  Entity,
  Column,
  ManyToOne,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
  CreateDateColumn,
} from 'typeorm';
import { User } from './User';

@Entity()
export class UserSession {
  @PrimaryGeneratedColumn('uuid')
  public id!: string;

  @ManyToOne(() => User, (user) => user.sessions, { onDelete: 'CASCADE' })
  public user!: User;

  @Column()
  public token!: string;

  @Column()
  public valid!: boolean;

  @Column({ type: 'text', nullable: true })
  public userAgent?: string | null;

  @Column({ type: 'text', nullable: true })
  public ip?: string | null;

  @Column('jsonb', { nullable: true })
  public extra?: object;

  @CreateDateColumn()
  public createdAt!: string;

  @UpdateDateColumn()
{'fraction_non_alphanumeric': 0.15091863517060367, 'fraction_numerical': 0.001968503937007874, 'mean_word_length': 4.369718309859155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4224305', 'n_tokens_mistral': 513, 'n_tokens_neox': 490, 'n_words': 138}