All files / src/core-entities execution-log.entity.ts

92.85% Statements 13/14
100% Branches 0/0
66.66% Functions 2/3
90.9% Lines 10/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 4248x 48x 48x 48x             48x           48x           6x         48x           48x           48x    
import { Entity, Column, ManyToOne, JoinColumn } from 'typeorm';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { BaseEntity } from './base.entity';
import { AIAction } from './ai-action.entity';
 
/**
 * ExecutionLog captures output from action execution attempts.
 * Each log is linked to a specific AIAction and contains stdout/stderr or error messages.
 */
@Entity('execution_logs')
export class ExecutionLog extends BaseEntity {
  @ApiProperty({
    description: 'UUID of the AIAction this log belongs to',
    format: 'uuid',
  })
  @Column({ type: 'uuid' })
  action_id: string;
 
  @ApiProperty({
    description: 'The AIAction entity this log belongs to',
    type: () => AIAction,
  })
  @ManyToOne(() => AIAction, (aiAction) => aiAction.executionLogs, {
    nullable: false,
    onDelete: 'CASCADE',
  })
  @JoinColumn({ name: 'action_id' })
  aiAction: AIAction;
 
  @ApiPropertyOptional({
    description: 'Standard output from execution',
  })
  @Column({ type: 'text', nullable: true })
  output: string;
 
  @ApiPropertyOptional({
    description: 'Error message if execution failed',
  })
  @Column({ type: 'text', nullable: true })
  error_message: string;
}