backend v4 half

This commit is contained in:
2025-07-18 09:20:40 +02:00
parent aba7a506ad
commit 725516ad6c
4183 changed files with 217684 additions and 75056 deletions
@@ -3,37 +3,61 @@ import {
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
OneToMany
OneToMany,
UpdateDateColumn,
DeleteDateColumn
} from 'typeorm';
import { User } from './user.entity';
import { Cards } from './cards.entity';
@Entity('Company')
export class Company {
@PrimaryGeneratedColumn()
CompanyId!: number;
@PrimaryGeneratedColumn()
CompanyId!: number;
@Column({ type: 'varchar', length: 255, nullable: false })
Name!: string;
@Column({ type: 'varchar', length: 26, nullable: false })
GUID!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
ContactFirstName!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
Name!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
ContactLastName!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
ContactFirstName!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
ContactEmail!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
ContactLastName!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
FirstAPI!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
ContactEmail!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
TokenAPI!: string;
@Column({ type: 'varchar', length: 255, nullable: false })
LoginURL!: string;
@CreateDateColumn()
RegDate!: Date;
@CreateDateColumn()
RegDate!: Date;
@UpdateDateColumn()
UpdatedDate!: Date;
@DeleteDateColumn()
deletedAt?: Date;
// Relation to User entity (optional)
@OneToMany(() => User, user => user.company)
users!: User[];
@OneToMany(() => Cards, cards => cards.company)
cards!: Cards[];
// Soft delete helper methods
isDeleted(): boolean {
return this.deletedAt !== null && this.deletedAt !== undefined;
}
softDelete(): void {
this.deletedAt = new Date();
}
restore(): void {
this.deletedAt = undefined;
}
}