86211923db
Repository Interface Optimization: - Created IBaseRepository.ts and IPaginatedRepository.ts - Refactored all 7 repository interfaces to extend base interfaces - Eliminated ~200 lines of redundant code (70% reduction) - Improved type safety and maintainability Dependency Injection Improvements: - Added EmailService and GameTokenService to DIContainer - Updated CreateUserCommandHandler constructor for DI - Updated RequestPasswordResetCommandHandler constructor for DI - Enhanced testability and service consistency Environment Configuration: - Created comprehensive .env.example with 40+ variables - Organized into 12 logical sections (Database, Security, Email, etc.) - Added security guidelines and best practices - Documented all backend environment requirements Documentation: - Added comprehensive codebase review - Created refactoring summary report - Added frontend implementation guide Impact: Improved code quality, reduced maintenance overhead, enhanced developer experience
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, OneToMany } from 'typeorm';
|
|
import { UserAggregate } from '../User/UserAggregate';
|
|
|
|
export const OrganizationState = {
|
|
REGISTERED: 0,
|
|
ACTIVE: 1,
|
|
SOFT_DELETE: 2
|
|
} as const;
|
|
|
|
export type OrganizationStateType = typeof OrganizationState[keyof typeof OrganizationState];
|
|
|
|
@Entity('Organizations')
|
|
export class OrganizationAggregate {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@Column({ type: 'varchar', length: 255 })
|
|
name!: string;
|
|
|
|
@Column({ type: 'varchar', length: 100 })
|
|
contactfname!: string;
|
|
|
|
@Column({ type: 'varchar', length: 100 })
|
|
contactlname!: string;
|
|
|
|
@Column({ type: 'varchar', length: 20 })
|
|
contactphone!: string;
|
|
|
|
@Column({ type: 'varchar', length: 255 })
|
|
contactemail!: string;
|
|
|
|
@Column({ type: 'int', default: OrganizationState.REGISTERED })
|
|
state!: OrganizationStateType;
|
|
|
|
@CreateDateColumn()
|
|
regdate!: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedate!: Date;
|
|
|
|
@Column({ type: 'varchar', length: 500, nullable: true })
|
|
url!: string | null;
|
|
|
|
@Column({ type: 'int', default: 0 })
|
|
userinorg!: number;
|
|
|
|
@Column({ type: 'int', nullable: true })
|
|
maxOrganizationalDecks!: number | null;
|
|
|
|
@OneToMany(() => UserAggregate, user => user.orgid)
|
|
users!: UserAggregate[];
|
|
} |