feat: major code refactor, add login and register endpoints with swagger
All checks were successful
Update changelog / changelog (push) Successful in 27s

This commit is contained in:
2025-12-29 18:26:50 +01:00
parent 3f225a1ecb
commit 41f3b0f0f2
22 changed files with 1425 additions and 128 deletions

View File

@@ -1,30 +1,35 @@
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm"
import { Link } from "./Link"
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm'
import { Link } from './Link'
@Entity("users")
export class User {
// Unique user id.
@PrimaryGeneratedColumn()
id: number
id: number | undefined; // Is this a good idea?
// User name, must be unique.
@Column({ unique: true })
name: string
name: string;
// Salted password hash.
@Column()
passwordHash: string
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
role: number;
// Account creation date as a Unix timestamp.
@Column('bigint')
createdAt: number
createdAt: number;
// List of shortened URLs which belong to the user.
@OneToMany(() => Link, (link) => link.author)