Skip to content

FilesService

reference
2 min readUpdated

Kind: Class

Source: Frontend/src/app/services/common/files.service.ts (line 33)

Part of: Frontend

FilesService manages file-related UI actions and data requests in the frontend. It handles upload popup state, file metadata lookups, parent-file queries, tag and category retrieval, and download actions.

Methods

MethodSignatureReturns
extractFilesExtensionextractFilesExtension(fileName: string, fileType: string)string
getTypesListgetTypesList()any[]
fetchDownloadFilePathfetchDownloadFilePath(APIUrl: string)number
openUploadFilePopupopenUploadFilePopup(relatedToId: number, relatedToTypeId: number, companyBranchId: number, parentFileID: number, supplierId: number)void
closeUploadPopupcloseUploadPopup()void
openUploadLogoPopupopenUploadLogoPopup()void
GetFilesByParentFileIDGetFilesByParentFileID(CompanyBranchID: number, ParentFileID: number, listNum: number, startRecord: number, pageSize: number, filter: string)void
GetTagsListByTypeGetTagsListByType(CompanyBranchID: number, listNum: number, supplierId: number)void
GetCategoriesListGetCategoriesList()void
DownloadFilesDownloadFiles(IDs: number[])void
getFilesByIdServicegetFilesByIdService(id: number)void
LoadtAttachedLoadtAttached(id: number, type: number)void
unAttachFileunAttachFile(id: undefined, type: undefined, fileID: undefined)void
LoadAttachmentsLoadAttachments(id: number, type: number)void
LoadAllDocumentsLoadAllDocuments(type: number)void
getUsersPermissiongetUsersPermission(relatedToId: number, relatedToTypeId: number)void
getOneDriveFilesListgetOneDriveFilesList(parentId: string)void
ShareFileShareFile(entity: OneDriveShareFiles)void
ShareFilesShareFiles(entity: OneDriveShareFiles[])void
UploadFileUploadFile(entity: FileData, acctualFile: File)void
UploadFilesUploadFiles(entity: FileData[], acctualFiles: File[])void
UploadDataFileUploadDataFile(entity: FileData)void
UploadDataFilesUploadDataFiles(entity: FileData[])void
_UploadFiles_UploadFiles(entities: FileData[], acctualFiles: File[])void
newUploadFilenewUploadFile(entities: FileData, acctualFile: File)void
saveFilesServicesaveFilesService(entity: FileData)void
newSaveFilesnewSaveFiles(entities: FileData[])void
AttachFilesAttachFiles(RelatedToID: number, RelatedToType: number, FilesIDList: number[])void
AttachSharedFilesAttachSharedFiles(files: AttachedfileView[])void
UploadWordTemplateUploadWordTemplate(acctualFile: File)void
UploadFileByModuleUploadFileByModule(entity: FileData, acctualFile: File, moduleId: number)void
DownloadImageDownloadImage(id: string, fileTypeId: number)void
revokeObjectURLrevokeObjectURL(url: string)void
deleteFilesServicedeleteFilesService(IDs: number[])void
getRolesByLibraryIdgetRolesByLibraryId(LibraryId: number)void
getPermissionsByLibraryIdgetPermissionsByLibraryId(LibraryId: number)void
saveLibraryRolessaveLibraryRoles(LibraryRoles: FilesRoles[])void
getOldCloudgetOldCloud()void
moveToNewCloudmoveToNewCloud(data: any[])void
updateOldCloudupdateOldCloud(data: any[])void
updateFileCategoryupdateFileCategory(fileCategory: EditAttachedCategory)void

Properties

PropertyType
headersProxyany
TypesListany[]
_uploadMultiPopupOpendUploadFilePopup
uploadMultiPopupOpendany
_uploadPopupOpendboolean
uploadPopupOpendany
_uploadLogoPopupOpendboolean
uploadLogoPopupOpendany

Where it refuses work

  • FilesService stops the work with an early return when fileExtension.includes("jpeg") || fileExtension.includes("jpg") || fileExtension.includes….
  • FilesService stops the work with an early return when APIUrl.includes('production-api').

Diagram

mermaid
graph LR
  Component --> FilesService
  FilesService --> UploadPopup[Upload Popup]
  FilesService --> LogoUploadPopup[Logo Upload Popup]
  FilesService --> FileMetadata[File Types and Extensions]
  FilesService --> FileQueries[Files, Tags, Categories]
  FilesService --> Download[Download Files]

Usage

ts
import { Component } from '@angular/core';
import { FilesService } from '../services/common/files.service';

@Component({
  selector: 'app-file-manager',
  template: `
    <button (click)="openUpload()">Upload file</button>
    <button (click)="download()">Download</button>
  `
})
export class FileManagerComponent {
  constructor(private readonly filesService: FilesService) {}

  openUpload(): void {
    this.filesService.openUploadFilePopup();
  }

  download(): void {
    this.filesService.DownloadFiles();
  }

  loadFileMetadata(): void {
    const extension = this.filesService.extractFilesExtension();
    const types = this.filesService.getTypesList();

    console.log({ extension, types });
  }
}

AI Coding Instructions

  • Keep file popup actions inside FilesService by calling openUploadFilePopup, closeUploadPopup, or openUploadLogoPopup from components.
  • Use extractFilesExtension and getTypesList when preparing file upload or filtering UI state.
  • Call GetFilesByParentFileID, GetTagsListByType, and GetCategoriesList through this service rather than duplicating file lookup logic in components.
  • Keep download behavior routed through DownloadFiles and path-related handling through fetchDownloadFilePath.

Used by

37 references from 37 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (37)

  • MrqDetailsComponentFrontend/src/app/components/MRQ/mrq-details/mrq-details.component.ts:1
  • BillOfMaterialsDetailsComponentFrontend/src/app/components/bill-of-materials/bill-of-materials-details/bill-of-materials-details.component.ts:1
  • NewBranchComponentFrontend/src/app/components/configuration/company/main-branch/new.branch.component.ts:1
  • ProductCategoriesComponentFrontend/src/app/components/configuration/products/product-categories/product-categories.component.ts:1
  • ProductsDetailsComponentFrontend/src/app/components/configuration/products/products-details/products-details.component.ts:1
  • OverallAnalysisYearMapFrontend/src/app/components/dashboard/_principalReport/principal-report.component.ts:1
  • NewActivityComponentFrontend/src/app/components/dashboard/my-desk/activities/new-activity/new-activity.component.ts:1
  • TopicComponentFrontend/src/app/components/dashboard/my-desk/activities/topic/topic.component.ts:1

…and 29 more.

Was this page helpful?

Download as PDF