OSS-first docs

These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.

attachment.attach

Attach a file to an entity.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.files
  • Tags: files, attachment, attach
  • File: packages/libs/files/src/contracts/index.ts
  • field.key.label
    attachment.attach
    field.version.label
    1.0.0
    field.type.label
    operation (command)
    field.title.label
    attachment.attach
    field.description.label

    Attach a file to an entity.

  • Type: operation (command)
  • Version: 1.0.0
  • Stability: stable
  • Owners: platform.files
  • Tags: files, attachment, attach
  • File: packages/libs/files/src/contracts/index.ts
  • field.tags.label
    files,attachment,attach
    field.owners.label
    platform.files
    field.stability.label
    stable

    Attach a file to an entity.

    Goal

    Link a file to a business entity.

    Context

    Called when associating files with entities.

    Source Definition

    import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
    import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
    
    export const AttachFileContract = defineCommand({
    	meta: {
    		key: 'attachment.attach',
    		version: '1.0.0',
    		stability: 'stable',
    		owners: ['platform.files'],
    		tags: ['files', 'attachment', 'attach'],
    		description: 'Attach a file to an entity.',
    		goal: 'Link a file to a business entity.',
    		context: 'Called when associating files with entities.',
    	},
    	io: {
    		input: AttachFileInput,
    		output: AttachmentModel,
    		errors: {
    			FILE_NOT_FOUND: {
    				description: 'File does not exist',
    				http: 404,
    				gqlCode: 'FILE_NOT_FOUND',
    				when: 'File ID is invalid',
    			},
    			ATTACHMENT_EXISTS: {
    				description: 'Attachment already exists',
    				http: 409,
    				gqlCode: 'ATTACHMENT_EXISTS',
    				when: 'File is already attached to this entity',
    			},
    		},
    	},
    	policy: {
    		auth: 'user',
    	},
    });