This commit is contained in:
keyhan
2026-04-05 15:22:01 +03:30
commit 33be1649c4
82 changed files with 23956 additions and 0 deletions
@@ -0,0 +1,86 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
OneToMany,
JoinColumn,
} from 'typeorm';
import { AppRuntime, DatabaseType } from '../../common/enums';
import { User } from '../../users/entities/user.entity';
import { Deployment } from '../../deployments/entities/deployment.entity';
@Entity('applications')
export class Application {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
name: string;
@Column({ nullable: true })
description: string;
@Column({ type: 'enum', enum: AppRuntime })
runtime: AppRuntime;
@Column({ type: 'enum', enum: DatabaseType, default: DatabaseType.NONE })
databaseType: DatabaseType;
@Column({ nullable: true })
gitUrl: string;
@Column({ nullable: true })
codePath: string; // Path to uploaded zip
@Column({ type: 'jsonb', nullable: true })
envVars: Record<string, string>;
// Resource configuration
@Column({ default: '100m' })
cpuRequest: string;
@Column({ default: '500m' })
cpuLimit: string;
@Column({ default: '128Mi' })
memoryRequest: string;
@Column({ default: '512Mi' })
memoryLimit: string;
@Column({ default: 1 })
replicas: number;
@Column({ default: 3000 })
port: number;
// Relations
@ManyToOne(() => User, (user: User) => user.applications, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'userId' })
user: User;
@Column()
userId: string;
@Column({ nullable: true })
clusterId: string;
@OneToMany(() => Deployment, (deployment: Deployment) => deployment.application)
deployments: Deployment[];
// Metadata
@Column({ nullable: true })
latestImageTag: string;
@Column({ nullable: true })
subdomain: string; // <subdomain>.apps.cloudhost.local
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
}