Skip to content

Simplify CategoryUploadHandler#1

Open
River-Qinghao wants to merge 1 commit intomainfrom
codex/create-categoryuploadhandler-based-on-journaluploadhandler
Open

Simplify CategoryUploadHandler#1
River-Qinghao wants to merge 1 commit intomainfrom
codex/create-categoryuploadhandler-based-on-journaluploadhandler

Conversation

@River-Qinghao
Copy link
Contributor

Motivation

  • Align CategoryUploadHandler implementation with the simpler JournalUploadHandler style to reduce complexity and follow project conventions.
  • Remove extra helper methods and state spread across the class to make the handler easier to read and maintain.

Description

  • Import sqlite3 and simplify CategoryUploadHandler in Handlers.py to inline table creation and inserts inside pushDataToDb instead of separate helper methods like _create_tables, _get_or_create_category, and _get_or_create_area.
  • Keep relational schema with tables journals, categories, areas, journal_categories, journal_areas, and category_areas, and populate them using INSERT OR IGNORE and SELECT within pushDataToDb.
  • Preserve behavior to only accept .json files, commit the transaction with conn.commit(), close the connection with conn.close(), and return True on success.

Testing

  • No automated tests were executed for this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant