Skip to content

feat: Add batch user status update endpoint and related models#133

Merged
TMCreme merged 4 commits intomainfrom
Ransford/backend-upgrade
Apr 1, 2026
Merged

feat: Add batch user status update endpoint and related models#133
TMCreme merged 4 commits intomainfrom
Ransford/backend-upgrade

Conversation

@RansfordGenesis
Copy link
Copy Markdown
Contributor

  • Implemented a new endpoint for batch updating user statuses, accessible only to admins.
  • Added BatchStatusUpdateRequest and BatchStatusUpdateResponse models for request and response handling.
  • Enhanced user status management in the OrgChartRepository to filter by accepted users.
  • Updated user service to handle status changes with email notifications.
  • Introduced new coding challenges and weekly meetings models, repositories, and services.
  • Created endpoints for managing coding challenges and weekly meetings, including CRUD operations.
  • Added health check endpoint to verify database connectivity.
  • Updated email sending functionality to support both SMTP and SMTP_SSL.
  • Added migration scripts for new database tables and fields related to meetings and challenges.
  • Implemented scripts to update user roles and statuses in bulk.

Copilot AI review requested due to automatic review settings March 31, 2026 23:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds admin-only batch user status updates plus new “weekly meetings” and “coding challenges” CRUD APIs, alongside email-delivery improvements and supporting DB models/migrations.

Changes:

  • Added meeting/challenge models, repositories, services, API models, and CRUD routes.
  • Added admin batch status update endpoint and tightened org-chart visibility to accepted users.
  • Improved email sending configuration (STARTTLS vs SMTP_SSL), added a DB health endpoint, and introduced migration/scripts for new tables and bulk updates.

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
utils/mail_service.py Adds STARTTLS vs SMTP_SSL support and richer SMTP error handling.
update_users_status.py Adds bulk script to move users from TO_CONTACT → ACCEPTED.
update_users_role.py Adds bulk script to set all users’ role_id to 2.
services/weekly_meeting_service.py Service wrapper for weekly meeting repository CRUD.
services/user_service.py Makes status update resilient when email_templates migration hasn’t run.
services/skill_service.py Adds admin-only “skills pool” create/delete operations.
services/coding_challenge_service.py Service wrapper for coding challenge repository CRUD.
services/auth_service.py Adds migration fallback + richer error mapping in forgot-password flow.
docker-compose.dev.yml Switches media env vars from AWS to Cloudinary in dev compose.
db/repository/weekly_meetings.py Implements weekly meeting CRUD and “active meeting” query.
db/repository/skills.py Adds create/get_by_id/delete helpers for pool management.
db/repository/org_chart.py Filters org-chart queries to accepted users only.
db/repository/coding_challenges.py Implements coding challenge CRUD and “latest challenge” query.
db/models/weekly_meetings.py Introduces WeeklyMeeting ORM model.
db/models/coding_challenges.py Introduces CodingChallenge ORM model + ChallengeType enum.
db/init.py Registers new models for import side effects/metadata.
app.py Adds health check endpoint, startup seeding, and new routers + CORS origins.
api/routes/weekly_meetings.py Adds weekly meeting CRUD endpoints.
api/routes/users.py Opens “get subordinates” to accepted users (not admin-only).
api/routes/skills.py Adds admin endpoints to manage shared skills pool.
api/routes/profile_page.py Adds admin batch user status update endpoint + request/response models.
api/routes/coding_challenges.py Adds coding challenge CRUD endpoints.
api/routes/announcements.py Refactors dependencies typing and makes update partial (exclude_unset).
api/api_models/weekly_meetings.py Adds Pydantic models/validation for weekly meetings.
api/api_models/coding_challenges.py Adds Pydantic models/validation for coding challenges.
api/api_models/announcements.py Extends AnnouncementUpdate with image_url.
README.md Updates setup docs, env vars, startup seeding description, and scripts usage.
Alembic/versions/e89564e882b1_add_missing_tables.py Adds migration for email_templates/weekly_meetings/coding_challenges tables.
Alembic/versions/c1d2e3f4a5b6_meetings_recurrence_challenges_deadline.py Adds migration for scheduled_time/recurrence/deadline columns.
.env.sample Refreshes environment variable examples and removes hardcoded secrets.
Comments suppressed due to low confidence (3)

utils/mail_service.py:1

  • send_email is declared async but uses blocking smtplib calls, which will block the event loop under load. Offload the SMTP work to a thread (e.g., anyio.to_thread.run_sync) or use FastAPI BackgroundTasks / a task queue so request handling remains non-blocking.
    utils/mail_service.py:1
  • send_email is declared async but uses blocking smtplib calls, which will block the event loop under load. Offload the SMTP work to a thread (e.g., anyio.to_thread.run_sync) or use FastAPI BackgroundTasks / a task queue so request handling remains non-blocking.
    utils/mail_service.py:1
  • Returning raw SMTP exception strings to clients (Email server error: ..., An error occurred: ...) can leak internal server/SMTP details. Prefer returning a generic user-facing error message and log the exception via the app logger (instead of print) with appropriate redaction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TMCreme TMCreme merged commit 679bbbf into main Apr 1, 2026
1 check passed
@TMCreme TMCreme deleted the Ransford/backend-upgrade branch April 1, 2026 17:43
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.

3 participants