Closed evereq closed 1 month ago
We have implemented a feature where the profile pictures for employees and organization logos are stored in the image_asset table, and their respective IDs are saved in the corresponding tables (Employee
, Organization
). Previously, we were using Cloudinary for image storage, but now we have transitioned to using our file storage provider.
Currently, the User
table contains two columns related to images:
imageUrl
: Stores the direct URL of the image.imageId
: Stores the ID referencing the image_asset
table.When updating an employee or organization profile, the latest uploaded picture should be displayed. However, there is confusion on which field to prioritize (imageUrl or imageId) when both are set.
Field Utilization:
imageUrl
is set: Display the image from the URL.imageId
is set: Retrieve and display the image from the image_asset
table using the ID.If both imageUrl and imageId are set:
1.Prioritize imageId and use the image from the image_asset table. This ensures that any uploaded image through our system is given precedence.
2. Use imageUrl only if imageId is not set.
Additionally, if we add a record to the table with images (where imageId
is set), then other tables (if they have imageUrl
) need to have such imageUrl
equal to the just uploaded image URL. This means that during uploading, we not only update the image_asset table but also update imageUrl
in the Employee
or Organization
tables. This ensures that if we have imageId
, imageUrl
is also set correctly and we can use either field as needed, keeping both in sync.
Consistency Across the System:
Trying to upload profile and company picture. I'm getting an error: https://api.gauzy.co/api/image-assets/upload/profile_pictures' from origin 'https://app.gauzy.co/' has been blocked by CORS policy