Skip to content

Commit

Permalink
feat: Remove unused onboarding code (QuivrHQ#2901)
Browse files Browse the repository at this point in the history
Remove unused code related to onboarding functionality. This includes
removing the `OnboardingUpdatableProperties` class and the
`OnboardingStates` class. These classes are no longer used in the
codebase and can be safely deleted.

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
StanGirard authored Jul 22, 2024
1 parent d9e7ba8 commit cf5c56d
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 266 deletions.
11 changes: 0 additions & 11 deletions backend/api/quivr_api/celery_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
from quivr_api.modules.notification.service.notification_service import (
NotificationService,
)
from quivr_api.modules.onboarding.service.onboarding_service import OnboardingService
from quivr_api.packages.files.crawl.crawler import CrawlWebsite, slugify
from quivr_api.packages.files.processors import filter_file
from quivr_api.packages.utils.telemetry import maybe_send_telemetry

logger = get_logger(__name__)

onboardingService = OnboardingService()
notification_service = NotificationService()
brain_service = BrainService()
auth_bearer = AuthBearer()
Expand Down Expand Up @@ -120,11 +118,6 @@ def process_crawl_and_notify(
)


@celery.task
def remove_onboarding_more_than_x_days_task():
onboardingService.remove_onboarding_more_than_x_days(7)


@celery.task(name="NotionConnectorLoad")
def process_integration_brain_created_initial_load(brain_id, user_id):
notion_connector = NotionConnector(brain_id=brain_id, user_id=user_id)
Expand Down Expand Up @@ -278,10 +271,6 @@ def check_if_is_premium_user():


celery.conf.beat_schedule = {
"remove_onboarding_more_than_x_days_task": {
"task": f"{__name__}.remove_onboarding_more_than_x_days_task",
"schedule": crontab(minute="0", hour="0"),
},
"ping_telemetry": {
"task": f"{__name__}.ping_telemetry",
"schedule": crontab(minute="*/30", hour="*"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
from fastapi import APIRouter, Depends
from quivr_api.middlewares.auth import ( # Assuming you have a get_current_user function
AuthBearer,
get_current_user,
)
from quivr_api.modules.onboarding.dto.inputs import OnboardingUpdatableProperties
from quivr_api.modules.onboarding.entity.onboarding import OnboardingStates
from quivr_api.modules.onboarding.service.onboarding_service import OnboardingService
from quivr_api.middlewares.auth import AuthBearer, get_current_user
from quivr_api.modules.user.entity.user_identity import UserIdentity

onboarding_router = APIRouter()

onboardingService = OnboardingService()


@onboarding_router.get(
"/onboarding",
dependencies=[Depends(AuthBearer())],
tags=["Onboarding"],
tags=["Deprecated"],
)
async def get_user_onboarding_handler(
current_user: UserIdentity = Depends(get_current_user),
) -> OnboardingStates | None:
) -> dict:
"""
Get user onboarding information for the current user
"""

return onboardingService.get_user_onboarding(current_user.id)


@onboarding_router.put(
"/onboarding",
dependencies=[Depends(AuthBearer())],
tags=["Onboarding"],
)
async def update_user_onboarding_handler(
onboarding: OnboardingUpdatableProperties,
current_user: UserIdentity = Depends(get_current_user),
) -> OnboardingStates:
"""
Update user onboarding information for the current user
"""

return onboardingService.update_user_onboarding(current_user.id, onboarding)
return {"status": "Deprecated and will be removed in v0.1"}
1 change: 0 additions & 1 deletion backend/api/quivr_api/modules/onboarding/dto/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from .inputs import OnboardingUpdatableProperties
14 changes: 0 additions & 14 deletions backend/api/quivr_api/modules/onboarding/dto/inputs.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from .onboarding import OnboardingStates
10 changes: 0 additions & 10 deletions backend/api/quivr_api/modules/onboarding/entity/onboarding.py

This file was deleted.

106 changes: 0 additions & 106 deletions backend/api/quivr_api/modules/onboarding/repository/onboardings.py

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from .onboarding_service import OnboardingService

This file was deleted.

Empty file.
53 changes: 53 additions & 0 deletions backend/supabase/migrations/20240722164034_onboarding-removed.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
drop policy "NOTIFICATIONS" on "public"."onboardings";

revoke delete on table "public"."onboardings" from "anon";

revoke insert on table "public"."onboardings" from "anon";

revoke references on table "public"."onboardings" from "anon";

revoke select on table "public"."onboardings" from "anon";

revoke trigger on table "public"."onboardings" from "anon";

revoke truncate on table "public"."onboardings" from "anon";

revoke update on table "public"."onboardings" from "anon";

revoke delete on table "public"."onboardings" from "authenticated";

revoke insert on table "public"."onboardings" from "authenticated";

revoke references on table "public"."onboardings" from "authenticated";

revoke select on table "public"."onboardings" from "authenticated";

revoke trigger on table "public"."onboardings" from "authenticated";

revoke truncate on table "public"."onboardings" from "authenticated";

revoke update on table "public"."onboardings" from "authenticated";

revoke delete on table "public"."onboardings" from "service_role";

revoke insert on table "public"."onboardings" from "service_role";

revoke references on table "public"."onboardings" from "service_role";

revoke select on table "public"."onboardings" from "service_role";

revoke trigger on table "public"."onboardings" from "service_role";

revoke truncate on table "public"."onboardings" from "service_role";

revoke update on table "public"."onboardings" from "service_role";

alter table "public"."onboardings" drop constraint "onboardings_user_id_fkey";

alter table "public"."onboardings" drop constraint "onboardings_pkey";

drop index if exists "public"."onboardings_pkey";

drop table "public"."onboardings" CASCADE;

drop function if exists public.create_user_onboarding cascade;

0 comments on commit cf5c56d

Please sign in to comment.