Skip to content

Refactor images, users, and logging#13

Merged
hussein-m-kandil merged 25 commits intomainfrom
dev
Sep 2, 2025
Merged

Refactor images, users, and logging#13
hussein-m-kandil merged 25 commits intomainfrom
dev

Conversation

@hussein-m-kandil
Copy link
Copy Markdown
Owner

Overview

This PR introduces several improvements to the API, authentication, image handling, and logging. It also refactors parts of the codebase for better structure and maintainability.

Changes

  • Infrastructure & Utilities

    • Extracted image schema and utilities into a mediator layer.
    • Refactored storage logic and environment variables.
    • Improved test setup with a custom app instance.
  • User & Auth

    • Added support for guest sign-in.
    • Introduced an Avatar model and updated user endpoints to handle avatar uploads.
    • Allowed fetching users by username without restrictions.
    • Improved users' PATCH request handling.
  • Images & Posts

    • Unified image handling by supporting avatar uploads within the /images route.
    • Added CRUD operations for post images inside post endpoints.
    • Ensured the post image is removed from storage while deleting its post.
    • Restricted access to the all-images route to admin users only.
  • Logging & Middleware

    • Improved request logging and logger configuration.
    • Enhanced logger usage across the app.
  • Miscellaneous

    • Refactored tags count endpoint.
    • Fixed typo in the seed script.
    • Updated imports from express to use named imports.
    • Cleaned up non-admin data before processing GET requests.

Notes

This update not only adds new features, such as guest sign-in and avatar handling, but also improves the overall stability and clarity of image and user management. The refactoring efforts make the codebase easier to maintain and extend.

@hussein-m-kandil hussein-m-kandil merged commit 99b5341 into main Sep 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant