Skip to content

Update is_guest field logic in 01_create_tables.sql #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

umaribnsadat
Copy link

This pull request updates the logic for setting the is_guest field in the 01_create_tables.sql file

@abdullah-alnahas
Copy link
Collaborator

Thanks Umar for your contribution!
Really good job!
I want to ask you to please create a new file in the sql directory named 08_update_guest_users.sql and put your update code in it.

@abdullah-alnahas
Copy link
Collaborator

One more thing: the code in main_api.py and ansari_db.py needs to be updated so future guest logins don't get stored incorrectly with is_guest = false. Please take a look at:

to make the necessary updates.

@abdullah-alnahas
Copy link
Collaborator

Thanks Umar. Good job. Could you please update the logic for checking if a user is_guest? I've left comments in the code, but I'm re-stating it here:

-- Update the `users` table to set `is_guest` to TRUE where:
-- 1. Email matches the guest pattern (starts with 'guest_' and ends with '@endeavorpal.com')
-- 2. First name is 'Welcome'
-- 3. Last name is 'Guest'
UPDATE users 
SET 
    is_guest = TRUE,
    updated_at = CURRENT_TIMESTAMP
WHERE 
    email LIKE 'guest_%@endeavorpal.com'
    AND first_name = 'Welcome'
    AND last_name = 'Guest';

This SQL logic should also be applied to the Python code in main_api.py.

@waleedkadous
Copy link
Collaborator

Abandoned.

@waleedkadous waleedkadous reopened this Nov 7, 2024
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