All files / src/core-entities custom-snippet.entity.ts

100% Statements 10/10
100% Branches 0/0
100% Functions 0/0
100% Lines 8/8

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 4145x 45x 45x                   45x           45x             45x           45x             45x    
import { Entity, Column } from 'typeorm';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { BaseEntity } from './base.entity';
 
/**
 * CustomSnippet is a reusable text snippet with a trigger prefix.
 * Similar to VS Code snippets - type the prefix to expand into the body.
 *
 * Snippets are useful for frequently used code patterns, templates, or prompts.
 * The scope field limits where the snippet is available (e.g., 'prompt', 'code').
 */
@Entity('custom_snippets')
export class CustomSnippet extends BaseEntity {
  @ApiProperty({
    description: 'Trigger prefix for this snippet',
    example: 'auth-module',
  })
  @Column({ type: 'text', unique: true })
  prefix: string;
 
  @ApiProperty({
    description: 'Description of what this snippet does',
    example: 'Creates a basic authentication module template',
  })
  @Column({ type: 'text' })
  description: string;
 
  @ApiProperty({
    description: 'Content/body of the snippet (expanded when triggered)',
  })
  @Column({ type: 'text' })
  body: string;
 
  @ApiPropertyOptional({
    description: 'Scope where this snippet is available',
    example: 'prompt',
  })
  @Column({ type: 'text', nullable: true })
  scope?: string;
}