Skip to content
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

Fix the Issue with the Snapshot API #38

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

EndeavorPal
Copy link
Contributor

  1. Update CORS Logic
  2. Add Commit after Insert Snapshot Record
  3. Deserialize Snapshot Data before Return in the Response
  4. Add Script to execute sql files that create required database tables

2. Add Commit after Insert Snapshot Record
3. Deserialize Snapshot Data before Return in the Response
4. Add Script to execute sql files that create required database tables
@@ -0,0 +1,49 @@
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

I appreciate this, but isn't it just easier to do

% psql < sql/*.sql

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that works too.

Here, we can include custom logic before running the SQL statement.


# Origins to be allowed by the backend
ORIGINS=https://beta.ansari.chat,http://beta.ansari.chat,https://ansari.chat,http://ansari.chat,https://hajiansari.ai,http://hajiansari.ai,https://ansari.endeavorpal.com
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for making this change it is long overdue.

@@ -46,7 +40,7 @@
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origins=['*'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This particular line change replaces the list of specific origins with a wildcard ('*'), allowing all domains to access resources from our application. Was this change intended, or was it made by mistake? @EndeavorPal @waleedkadous

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think its intended for mobile (where the origin is not defined). Its not detrimental because of the additional origins check on line 61.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this to handle mobile, also origin validation already handled in line 67

if origin in origins or mobile == "ANSARI":

@waleedkadous waleedkadous merged commit 79fea69 into ansari-project:api-v2 Apr 28, 2024
1 of 2 checks 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.

3 participants