Files
kittyBE/src/entities/User.ts
sherl 41f3b0f0f2
All checks were successful
Update changelog / changelog (push) Successful in 27s
feat: major code refactor, add login and register endpoints with swagger
2025-12-29 18:26:50 +01:00

38 lines
831 B
TypeScript

import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
import { Link } from './Link'
@Entity("users")
export class User {
// Unique user id.
@PrimaryGeneratedColumn()
id: number | undefined; // Is this a good idea?
// User name, must be unique.
@Column({ unique: true })
name: string;
// Salted password hash.
@Column()
passwordHash: string;
// Used to tell, whether password hash should
// be recalculated (salted) on next login.
@Column()
dirtyPasswordHashBit: boolean;
// User role:
// - 0 - means unprivileged user,
// - 1 - means administrative user.
@Column()
role: number;
// Account creation date as a Unix timestamp.
@Column('bigint')
createdAt: number;
// List of shortened URLs which belong to the user.
@OneToMany(() => Link, (link) => link.author)
links: Link[];
}