-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Refactor(uploads.ts) : Migrate AppUploadsConverter to TypeScript #39992
Description
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.