-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Company & Product with JWT Authentication and PostgreSQL In… #6
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
base: company
Are you sure you want to change the base?
Conversation
…tegration with alembic
| SECRET_KEY = "af3287c8391bb9f4f7a72feb3b85f72e1d5bd07cbf4fa4ad9497c78412923312" | ||
| ALGORITHM = "HS256" | ||
| ACCESS_TOKEN_EXPIRE_MINUTES = 30 | ||
| ACCESS_TOKEN_EXPIRE_MINUTES = 7 * 24 * 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont need to define time like this just write minutes or seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
app/services/company_service.py
Outdated
| new_company = Company( | ||
| name=company_data.name, | ||
| location=company_data.location, | ||
| type=company_data.type, | ||
| user_id=user_id | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of doing this make sure this is already coming from request as an object just call the repository here in service and do database insertions there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i fix this today
app/services/company_service.py
Outdated
| type=company_data.type, | ||
| user_id=user_id | ||
| ) | ||
| self.db.add(new_company) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do this in repository and dont use self with it
app/services/user_service.py
Outdated
| new_user = User(username=user.username, password=hashed_pw) | ||
| self.db.add(new_user) | ||
| self.db.commit() | ||
| self.db.refresh(new_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont need to use db.refresh untill it is necessary
…tegration with alembic