chore: first commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { Collection, Entity, EntityRepositoryType, ManyToOne, OneToMany, Property } from "@mikro-orm/core";
|
||||
|
||||
import { RefreshToken } from "./refresh-token.entity";
|
||||
import { Role } from "./role.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { Business } from "../../businesses/entities/business.entity";
|
||||
import { Domain } from "../../domains/entities/domain.entity";
|
||||
import { UserRepository } from "../repositories/user.repository";
|
||||
|
||||
@Entity({ repository: () => UserRepository })
|
||||
export class User extends BaseEntity {
|
||||
@Property({ type: "varchar", length: 150, nullable: false })
|
||||
title!: string;
|
||||
|
||||
@Property({ type: "varchar", length: 50, nullable: true })
|
||||
userName!: string;
|
||||
|
||||
@Property({ type: "varchar", length: 150, nullable: false })
|
||||
password!: string;
|
||||
|
||||
@Property({ type: "varchar", length: 255, nullable: true })
|
||||
emailAddress?: string; // Full email address
|
||||
|
||||
@Property({ type: "boolean", default: false })
|
||||
emailEnabled: boolean = false; // Whether email is enabled for this user
|
||||
|
||||
@Property({ type: "bigint", nullable: true, default: 1073741824 }) // 1GB default
|
||||
emailQuota?: number; // Email quota in bytes
|
||||
|
||||
// Email account integration fields
|
||||
@Property({ type: "varchar", length: 255, nullable: true })
|
||||
emailAccountId?: string; // WildDuck user ID
|
||||
|
||||
@Property({ type: "varchar", length: 255, nullable: true })
|
||||
displayName?: string; // Display name for email
|
||||
|
||||
@Property({ default: true, nullable: false })
|
||||
isActive: boolean = true;
|
||||
|
||||
//=========================
|
||||
|
||||
@OneToMany(() => RefreshToken, (token) => token.user)
|
||||
refreshTokens = new Collection<RefreshToken>(this);
|
||||
|
||||
@ManyToOne(() => Role, { deleteRule: "restrict" })
|
||||
role!: Role;
|
||||
|
||||
@ManyToOne(() => Business, { deleteRule: "restrict" })
|
||||
business!: Business;
|
||||
|
||||
@ManyToOne(() => Domain, { nullable: true })
|
||||
domain?: Domain; // The domain this email user belongs to
|
||||
|
||||
[EntityRepositoryType]?: UserRepository;
|
||||
}
|
||||
Reference in New Issue
Block a user