Skip to content

Refactor(uploads.ts) : Migrate AppUploadsConverter to TypeScript #39992

@Kaustubh2k5

Description

@Kaustubh2k5

Issue Description

The current file under apps/meteor/app/apps/server/converters/uploads.js lacks static typing and can face possible runtime errors.

Current Implementation

current implementation is a .js file under uploads.js It relies on implicit object structures and manual mutations (using delete on object properties). While the logic is stable, the code is "unaware" of the official interfaces defined in the Rocket.Chat ecosystem. This makes refactoring risky because the compiler can't warn us if we break a connection between the Core and an App.

Proposed Changes

migrate to a .ts file with strict typing, this ensures type safety and eliminates the guesswork of the data type structure. Import and apply the official IUpload (Core) and IAppsUpload (Apps-Engine) interfaces. To ensure we don't break existing App behavior, the logic will remain identical to the original. By typing the converter functions, we make the process of where we fetch Room and User objects for a file transparent and predictable.

ensure that the changes made will not affect any underlying test, ensure all tests run and safely pass.

Expected Change in Behaviour

The system would be more type secure compiler raises errors when type is incorrectly handled during build time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurePull requests that introduces new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions