π Title
Fix profile image upload β `OptionalProfileImageInterceptor` is a no-op stub; `@fastify/multipart` is not installed
π Description
`POST /auth/register` advertises profile image upload support, but the implementation is broken at every layer:
Layer 1 β Missing package: `@fastify/multipart` is not installed. Only `@fastify/cors`, `@fastify/formbody`, and `@fastify/middie` are present. `multer` (Express-only) is listed as a dependency but is incompatible with the Fastify adapter.
Layer 2 β Stub interceptor: `OptionalProfileImageInterceptor` in `auth.controller.ts` is a complete no-op β it calls `next.handle()` and does nothing else. `@UploadedFile()` will always receive `undefined`.
Layer 3 β No plugin registration: even if the package were installed, `@fastify/multipart` must be registered on the Fastify adapter instance in `main.ts` before requests can be parsed as multipart.
As a result, profile images are silently ignored for all users β no error, no upload, the `profileImageUrl` field in the database is always null.
β
Tasks to complete
π Documentation/context for AI
(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs
Relevant files:
- `src/main.ts`
- `src/modules/auth/auth.controller.ts` (OptionalProfileImageInterceptor)
- `src/modules/auth/auth.service.ts`
- `src/database/repositories/users.repository.ts`
- `src/config/env.ts`
ποΈ Additional notes
- Use `@fastify/multipart` directly via `request.file()` inside the controller; do not use NestJS `FileInterceptor` which requires the Express adapter
- Validate MIME type before uploading; reject non-image files with a clear 400 error code `FILE_INVALID_TYPE`
- File size validation should happen at the Fastify plugin level (via `limits.fileSize`), not just in the controller
- If a user registers without a profile image, `profileImageUrl` should be `null` in the DB β this is the current (silently broken) behavior that should now work explicitly
π Title
Fix profile image upload β `OptionalProfileImageInterceptor` is a no-op stub; `@fastify/multipart` is not installed
π Description
`POST /auth/register` advertises profile image upload support, but the implementation is broken at every layer:
Layer 1 β Missing package: `@fastify/multipart` is not installed. Only `@fastify/cors`, `@fastify/formbody`, and `@fastify/middie` are present. `multer` (Express-only) is listed as a dependency but is incompatible with the Fastify adapter.
Layer 2 β Stub interceptor: `OptionalProfileImageInterceptor` in `auth.controller.ts` is a complete no-op β it calls `next.handle()` and does nothing else. `@UploadedFile()` will always receive `undefined`.
Layer 3 β No plugin registration: even if the package were installed, `@fastify/multipart` must be registered on the Fastify adapter instance in `main.ts` before requests can be parsed as multipart.
As a result, profile images are silently ignored for all users β no error, no upload, the `profileImageUrl` field in the database is always null.
β Tasks to complete
π Documentation/context for AI
(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs
Relevant files:
ποΈ Additional notes