(
auth: AuthContext | null,
fileName: string,
buffer: Buffer,
mimeType: string,
)
| 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); |
nothing calls this directly
no test coverage detected