MCPcopy Create free account
hub / github.com/ShipSecAI/studio / uploadFile

Method uploadFile

backend/src/storage/files.service.ts:27–54  ·  view source on GitHub ↗
(
    auth: AuthContext | null,
    fileName: string,
    buffer: Buffer,
    mimeType: string,
  )

Source from the content-addressed store, hash-verified

25 }
26
27 async uploadFile(
28 auth: AuthContext | null,
29 fileName: string,
30 buffer: Buffer,
31 mimeType: string,
32 ): Promise<UploadedFile> {
33 const organizationId = this.requireOrganizationId(auth);
34 // Upload to MinIO
35 const { storageKey, size } = await this.storageService.uploadFile(fileName, buffer, mimeType);
36
37 // Save metadata to database
38 const file = await this.filesRepository.create({
39 fileName,
40 mimeType,
41 size,
42 storageKey,
43 organizationId,
44 });
45
46 return {
47 id: file.id,
48 fileName: file.fileName,
49 mimeType: file.mimeType,
50 size: file.size,
51 storageKey: file.storageKey,
52 uploadedAt: file.uploadedAt,
53 };
54 }
55
56 async getFileById(auth: AuthContext | null, id: string): Promise<UploadedFile> {
57 const organizationId = this.requireOrganizationId(auth);

Callers

nothing calls this directly

Calls 3

requireOrganizationIdMethod · 0.95
uploadFileMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected