chore: new feture for quato

This commit is contained in:
mahyargdz
2025-07-07 16:21:30 +03:30
parent 6565d2ae8b
commit b66114c900
21 changed files with 815 additions and 98 deletions
+14 -2
View File
@@ -1,10 +1,11 @@
import { Collection, Entity, EntityRepositoryType, ManyToOne, OneToMany, Property } from "@mikro-orm/core";
import { Collection, Entity, EntityRepositoryType, ManyToOne, OneToMany, OneToOne, 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 { EmailSignature } from "../../email-signatures/entities/email-signature.entity";
import { UserRepository } from "../repositories/user.repository";
@Entity({ repository: () => UserRepository })
@@ -27,18 +28,29 @@ export class User extends BaseEntity {
@Property({ type: "bigint", nullable: true, default: 1073741824 }) // 1GB default
emailQuota?: number; // Email quota in bytes
@Property({ type: "bigint", nullable: true, default: 0 })
emailQuotaUsed?: number; // Email quota used in bytes
// Email account integration fields
@Property({ type: "varchar", length: 255, nullable: true })
emailAccountId?: string; // WildDuck user ID
wildduckUserId?: string; // WildDuck user ID
@Property({ type: "varchar", length: 255, nullable: true })
displayName?: string; // Display name for email
@Property({ type: "timestamptz", nullable: true })
lastQuotaSync?: Date; // Last time quota was synced with WildDuck
@Property({ default: true, nullable: false })
isActive: boolean = true;
//=========================
@OneToOne(() => EmailSignature, (signature) => signature.user, { nullable: true, deleteRule: "cascade" })
emailSignature?: EmailSignature;
//=========================
@OneToMany(() => RefreshToken, (token) => token.user)
refreshTokens = new Collection<RefreshToken>(this);