mam-kupi-api/src/users/entities/user.entity.ts

33 lines
564 B
TypeScript

import { Link } from 'src/links/entities/links.entity';
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
export enum UserRole {
ADMIN = 'admin',
STANDARD = 'standard',
}
@Entity('Users')
export class User {
@PrimaryGeneratedColumn()
id!: number;
@Column()
name: string;
@Column()
password: string;
@Column({ unique: true })
email: string;
@Column({
type: 'enum',
enum: UserRole,
default: UserRole.STANDARD,
})
role: UserRole;
@OneToMany(() => Link, (link) => link.user)
links: Link[];
}