8000 Enhancement/redesign bookmark content schema by vaayne · Pull Request #21 · recally-io/recally · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Enhancement/redesign bookmark content schema #21

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

Merged
merged 11 commits into from
Feb 1, 2025

Conversation

vaayne
Copy link
Collaborator
@vaayne vaayne commented Jan 29, 2025

No description provided.

vaayne added 11 commits January 27, 2025 17:57
…parate table

- Added new migration files for splitting bookmark content into separate table
- Refactored bookmark queries to work with new schema structure
- Added new models for bookmark content, tags, and tag mappings
- Implemented new queries for listing, searching, and managing bookmarks with tags
- Added support for filtering bookmarks by domains, types, and tags
- Improved search functionality to include full-text search across multiple content fields
- Renamed `content_tags` and `bookmark_content_tags` to `bookmark_tags` for better clarity.
- Updated `bookmark_content` schema to include `user_id`, `url`, and `tags`.
- Moved share content related queries to a new `share_content.sql.go` file.
- Refactored `bookmarks.sql.go` to include new fields and corrected parameter mappings.
- Deleted `content.sql.go` as content schema and related queries merged into bookmarks.
- Updated `models.go` to match schema changes in database tables.
- Rename `ContentDTO` to `BookmarkContentDTO` for clarity.
- Introduce new models: `BookmarkDTO`, `BookmarkWithContentDTO`, `BookmarkMetadata`, `BookmarkContentMetadata`, and `BookmarkShareDTO`.
- Update `BookmarkService` methods to use new models and improve functionality.
- Refactor `CreateBookmark` to accept a `BookmarkContentDTO` and return a `BookmarkDTO`.
- Add `GetBookmarkWithContent`, `UpdateBookmark`, `DeleteBookmark`, and `DeleteBookmarksByUser` methods.
- Modify `ListBookmarks` to return `BookmarkDTO` instead of `BookmarkContentDTO`.
- Update `FetchContent` and `SummarierContent` to return `BookmarkContentDTO`.
- Refactor `BookmarkShareService` methods to use new `BookmarkShareDTO` model.
- Add `GetBookmarkShareContent`, `CreateBookmarkShare`, `UpdateSharedContent`, and `DeleteSharedContent` methods.
- Adjust `WebSummaryHandler` in `bots` package to use new `BookmarkService` methods.
- Update Swagger documentation to reflect changes in models and API endpoints.
…ookmarkDTO (main)

- Removed `BookmarkWithContentDTO` struct as it was redundant and superseded by `BookmarkDTO`.
- Updated all references from `BookmarkWithContentDTO` to `BookmarkDTO` in service and handler files.
- Adjusted the JSON schema in Swagger documentation to reflect the changes.
- Modified `BookmarkContentMetadata` by removing the `Image` field and its handling in the `FromReaderContent` method.
- Updated `BookmarkDTO` to include a `Content` field of type `BookmarkContentDTO` for nested content representation.
- Refactored the `LoadWithContent` method within `BookmarkDTO` to handle loading nested content.
- Modified methods in `BookmarkService` to use `BookmarkDTO` for consistency.
- Updated API documentation to match the changes in response payloads.
- Renamed the SQL query `ListBookmarkDomains` to `ListBookmarkDomainsByUser` for clarity and consistency.
- Updated the corresponding Go function in `bookmarks.sql.go` to reflect the new name.
- Modified the `Service` struct in `service.go` to use the renamed DAO method `ListBookmarkDomainsByUser`.
- Adjusted the method call in `ListDomains` function to use the updated DAO method.
- Updated the `DAO` interface in `dao.go` to include the renamed method signature.
- Introduces `BookmarkContent` to encapsulate content details like title, URL, summary, and metadata.
- Updates `Bookmark` object to reference `BookmarkContent` via `content_id`.
- Modifies `BookmarkMetadata` to include reading progress, last read date, highlights, and share information.
- Refactors components `ArticleReader`, `BookmarkList`, and `SharedArticleReader` to access content details through `bookmark.content`.
- Adjusts the API layer in `bookmarks.ts` to align with the new data structure
8000
.
- Removes unused `bookmarks.ts` file.
- Updated the database schema and Go code to reflect the new structure of the bookmark model.
- Updated the bookmark content service to use the new model and to support fetching content by bookmark ID.
- Updated the crawler worker to use the bookmark ID instead of the content ID when enqueuing summarization jobs.
- Removed the `reading_progress` field from the bookmark model as it is no longer used.
- Updated the database migration scripts to reflect the new schema.
- Updated the database queries to use the new schema and to support the new functionality.
- Updated the HTTP handlers to use the new model and service.
- Fixed the order of tables dropped in the down migration script.
- Added a new query to get bookmark content by bookmark ID.
- Updated the `CreateBookmarkTag` query to handle conflicts on the `name` and `user_id` columns.
- Updated the `ListBookmarks` and `SearchBookmarks` queries to return the bookmark content as well.
- Updated the `GetBookmarkWithContent` query to use the `bookmark_id` column in the `bookmark_tags_mapping` table.
- Updated the `CreateBookmark` query to remove the `reading_progress` column.
- Updated the `UpdateBookmark` query to remove the `reading_progress` column.
- Updated the `BookmarkDTO` model to remove the `reading_progress` field.
- Updated the `BookmarkContentDTO` model to remove the `reading_progress` field.
- Updated the `GetBookmarkContentByBookmarkID` function in the `DAO` interface.
- Updated the `FetchContent` function in the `bookmark_content_service` to use the bookmark ID instead of the content ID.
- Updated the `SummarierContent` function in the `bookmark_content_service` to use the bookmark ID instead of the content ID.
- Updated the `getBookmark` handler to use the new `GetBookmarkWithContent` function.
- Removed `SidebarTrigger` component from header elements in multiple components.
- Added `SidebarTrigger` to the `SidebarComponent` as a menu item to allow triggering the sidebar.
- Updated styling and layout to accommodate the changes.
- Removed unnecessary `Link` component from `BookmarkList` component.
- Updated styling for `SettingsPageComponenrt` to improve readability.
- Added tags field to bookmark content update SQL query
- Removed reading_progress field from Swagger docs
- Renamed FetchContentWithCache to FetchWebContentWithCache for clarity
- Improved tag linking logic in bookmark_tag_service.go:
  - Added helper functions for set difference and ensuring tags exist
  - Refactored linkContentTags to handle tag additions/removals more efficiently
  - Moved tag linking to background goroutine in summarization
- Simplified bookmark creation logic in bookmark_service.go
- Updated variable names for consistency across bookmark content handling
- Fixed Swagger documentation to match updated bookmark content model
- Removed `is_public` column from bookmarks table
- Updated bookmark sharing logic to use `bookmark_share` table
- Refactored bookmark model and DTOs to handle sharing metadata separately
- Updated API endpoints and Swagger documentation for bookmark sharing
- Fixed frontend to use new bookmark share structure
@vaayne vaayne merged commit 3bd387a into main Feb 1, 2025
0 of 2 checks passed
@vaayne vaayne deleted the enhancement/redesign_bookmark_content_schema branch February 1, 2025 14:14
vaayne added a commit that referenced this pull request Feb 5, 2025
* ✨ feat: Implement database schema for bookmarks and related content with migration scripts

* ✨ feat: Refactor bookmark schema and queries to split content into separate table

- Added new migration files for splitting bookmark content into separate table
- Refactored bookmark queries to work with new schema structure
- Added new models for bookmark content, tags, and tag mappings
- Implemented new queries for listing, searching, and managing bookmarks with tags
- Added support for filtering bookmarks by domains, types, and tags
- Improved search functionality to include full-text search across multiple content fields

* 📦 refact: reorganize and update bookmark and share content queries

- Renamed `content_tags` and `bookmark_content_tags` to `bookmark_tags` for better clarity.
- Updated `bookmark_content` schema to include `user_id`, `url`, and `tags`.
- Moved share content related queries to a new `share_content.sql.go` file.
- Refactored `bookmarks.sql.go` to include new fields and corrected parameter mappings.
- Deleted `content.sql.go` as content schema and related queries merged into bookmarks.
- Updated `models.go` to match schema changes in database tables.

* 🔀 refactor: Reorganize bookmark models and services

- Rename `ContentDTO` to `BookmarkContentDTO` for clarity.
- Introduce new models: `BookmarkDTO`, `BookmarkWithContentDTO`, `BookmarkMetadata`, `BookmarkContentMetadata`, and `BookmarkShareDTO`.
- Update `BookmarkService` methods to use new models and improve functionality.
- Refactor `CreateBookmark` to accept a `BookmarkContentDTO` and return a `BookmarkDTO`.
- Add `GetBookmarkWithContent`, `UpdateBookmark`, `DeleteBookmark`, and `DeleteBookmarksByUser` methods.
- Modify `ListBookmarks` to return `BookmarkDTO` instead of `BookmarkContentDTO`.
- Update `FetchContent` and `SummarierContent` to return `BookmarkContentDTO`.
- Refactor `BookmarkShareService` methods to use new `BookmarkShareDTO` model.
- Add `GetBookmarkShareContent`, `CreateBookmarkShare`, `UpdateSharedContent`, and `DeleteSharedContent` methods.
- Adjust `WebSummaryHandler` in `bots` package to use new `BookmarkService` methods.
- Update Swagger documentation to reflect changes in models and API endpoints.

* 🗑️ refactor: Remove BookmarkWithContentDTO and update references to BookmarkDTO (main)

- Removed `BookmarkWithContentDTO` struct as it was redundant and superseded by `BookmarkDTO`.
- Updated all references from `BookmarkWithContentDTO` to `BookmarkDTO` in service and handler files.
- Adjusted the JSON schema in Swagger documentation to reflect the changes.
- Modified `BookmarkContentMetadata` by removing the `Image` field and its handling in the `FromReaderContent` method.
- Updated `BookmarkDTO` to include a `Content` field of type `BookmarkContentDTO` for nested content representation.
- Refactored the `LoadWithContent` method within `BookmarkDTO` to handle loading nested content.
- Modified methods in `BookmarkService` to use `BookmarkDTO` for consistency.
- Updated API documentation to match the changes in response payloads.

* ♻️ refactor: Rename ListBookmarkDomains to ListBookmarkDomainsByUser

- Renamed the SQL query `ListBookmarkDomains` to `ListBookmarkDomainsByUser` for clarity and consistency.
- Updated the corresponding Go function in `bookmarks.sql.go` to reflect the new name.
- Modified the `Service` struct in `service.go` to use the renamed DAO method `ListBookmarkDomainsByUser`.
- Adjusted the method call in `ListDomains` function to use the updated DAO method.
- Updated the `DAO` interface in `dao.go` to include the renamed method signature.

* ✨ refactor: separate bookmark content from bookmark object

- Introduces `BookmarkContent` to encapsulate content details like title, URL, summary, and metadata.
- Updates `Bookmark` object to reference `BookmarkContent` via `content_id`.
- Modifies `BookmarkMetadata` to include reading progress, last read date, highlights, and share information.
- Refactors components `ArticleReader`, `BookmarkList`, and `SharedArticleReader` to access content details through `bookmark.content`.
- Adjusts the API layer in `bookmarks.ts` to align with the new data structure.
- Removes unused `bookmarks.ts` file.

* ♻️ refactor: Refactor bookmark model and service

- Updated the database schema and Go code to reflect the new structure of the bookmark model.
- Updated the bookmark content service to use the new model and to support fetching content by bookmark ID.
- Updated the crawler worker to use the bookmark ID instead of the content ID when enqueuing summarization jobs.
- Removed the `reading_progress` field from the bookmark model as it is no longer used.
- Updated the database migration scripts to reflect the new schema.
- Updated the database queries to use the new schema and to support the new functionality.
- Updated the HTTP handlers to use the new model and service.
- Fixed the order of tables dropped in the down migration script.
- Added a new query to get bookmark content by bookmark ID.
- Updated the `CreateBookmarkTag` query to handle conflicts on the `name` and `user_id` columns.
- Updated the `ListBookmarks` and `SearchBookmarks` queries to return the bookmark content as well.
- Updated the `GetBookmarkWithContent` query to use the `bookmark_id` column in the `bookmark_tags_mapping` table.
- Updated the `CreateBookmark` query to remove the `reading_progress` column.
- Updated the `UpdateBookmark` query to remove the `reading_progress` column.
- Updated the `BookmarkDTO` model to remove the `reading_progress` field.
- Updated the `BookmarkContentDTO` model to remove the `reading_progress` field.
- Updated the `GetBookmarkContentByBookmarkID` function in the `DAO` interface.
- Updated the `FetchContent` function in the `bookmark_content_service` to use the bookmark ID instead of the content ID.
- Updated the `SummarierContent` function in the `bookmark_content_service` to use the bookmark ID instead of the content ID.
- Updated the `getBookmark` handler to use the new `GetBookmarkWithContent` function.

* 🎨 refactor: remove sidebar trigger from header

- Removed `SidebarTrigger` component from header elements in multiple components.
- Added `SidebarTrigger` to the `SidebarComponent` as a menu item to allow triggering the sidebar.
- Updated styling and layout to accommodate the changes.
- Removed unnecessary `Link` component from `BookmarkList` component.
- Updated styling for `SettingsPageComponenrt` to improve readability.

* ✨ feat: Update bookmark content handling and tag linking (main)

- Added tags field to bookmark content update SQL query
- Removed reading_progress field from Swagger docs
- Renamed FetchContentWithCache to FetchWebContentWithCache for clarity
- Improved tag linking logic in bookmark_tag_service.go:
  - Added helper functions for set difference and ensuring tags exist
  - Refactored linkContentTags to handle tag additions/removals more efficiently
  - Moved tag linking to background goroutine in summarization
- Simplified bookmark creation logic in bookmark_service.go
- Updated variable names for consistency across bookmark content handling
- Fixed Swagger documentation to match updated bookmark content model

* 🐛 fix: Remove is_public column and refactor bookmark sharing logic

- Removed `is_public` column from bookmarks table
- Updated bookmark sharing logic to use `bookmark_share` table
- Refactored bookmark model and DTOs to handle sharing metadata separately
- Updated API endpoints and Swagger documentation for bookmark sharing
- Fixed frontend to use new bookmark share structure
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.

1 participant
0