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.
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',
},
});