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

lost and found refactor #13

Closed
wants to merge 1 commit into from
Closed

lost and found refactor #13

wants to merge 1 commit into from

Conversation

ikugo-dev
Copy link

This change resolves #11 by merging the queries/lost.py and queries/found.py into queries/lost_and_found.py and changing the implementation in the Routes/Lost_and_Found/ files.
I didn't merge the Routes/ files because it wasn't specified, but it doesn't look too hard to implement.

FOUND = found_images_table


def insert_in_table(TableType, form_data: Dict[str, Any], user_id: int ):
Copy link
Collaborator

Choose a reason for hiding this comment

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

here declare TableType like.

def insert_in_table(table_type: TableType,........)

Make relevant changes at other places too.

@@ -22,7 +22,7 @@ async def add_item( request: Request,
form_data_dict = json.loads(form_data)
user_id = get_user_id(request)
with conn.cursor() as cur:
cur.execute( insert_in_lost_table( form_data_dict, user_id ) )
cur.execute( insert_in_table(0, form_data_dict, user_id ) )
Copy link
Collaborator

Choose a reason for hiding this comment

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

You were supposed to pass a TableType.LOST or TableType.FOUND, but you have passed integers, and it gives errors. Fix this error in all the files.

class TableImagesType(Enum):
LOST = lost_images_table
FOUND = found_images_table

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's nice that you used enums. For uniformity, could you move these enums to models.py and make appropriate imports?

@DikshantK2004
Copy link
Collaborator

Closing this PR now. Kindly make a new PR on the backend branch.

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.

Refactor Lost and Found Queries
2 participants