Closed ttizze closed 3 months ago
The recent changes enhance the functionality of the translation features within the application. Key modifications include renaming functions for clarity, optimizing data retrieval by ensuring uniqueness and chronological ordering, and updating the database schema to support new constraints and attributes. These improvements aim to streamline the translation process and reinforce data integrity, ultimately leading to a better user experience.
Files | Change Summary |
---|---|
web/app/features/translate/functions/mutations.server.ts |
Renamed getSourceTexts to getLatestSourceTexts , updated query to include distinct and order by createdAt . |
web/app/features/translate/lib/translate.server.ts |
Updated import of getSourceTexts to getLatestSourceTexts in the translateChunk function. |
web/app/features/translate/translate-user-queue.ts |
Changed QUEUE_VERSION from 2 to 7 , indicating updates to the translation user queue. |
web/app/routes/$userName+/page+/$slug+/edit/_edit.tsx |
Replaced createOrUpdateSourceTexts with createOrSkipSourceTexts , changing how source texts are handled during updates. |
web/app/routes/$userName+/page+/$slug+/edit/functions/mutations.server.ts |
Renamed createOrUpdateSourceTexts to createOrSkipSourceTexts , focusing solely on creating new entries and skipping duplicates. |
web/app/routes/$userName+/page+/$slug+/functions/queries.server.ts |
Enhanced fetchPageWithTranslations to include distinct and orderBy parameters in the query for sourceTexts . |
web/app/routes/$userName+/page+/$slug+/index.tsx |
Minor formatting adjustments for improved readability. |
web/app/routes/$userName+/page+/$slug+/utils/addNumbersToContent.ts |
Removed console logging, leading to cleaner code. |
web/prisma/migrations/20240813115413_/migration.sql |
Removed indexes, added created_at column to source_texts table for timestamping. |
web/prisma/migrations/20240813121946_/migration.sql |
Added unique constraint on source_texts for the combination of page_id , number , and text . |
web/prisma/schema.prisma |
Updated SourceText model with createdAt field, modified unique constraints, and simplified index constraints. |
sequenceDiagram
participant User
participant API
participant Database
User->>API: Request translation
API->>Database: Query getLatestSourceTexts
Database-->>API: Return unique source texts
API->>User: Send latest source texts
🐰 In a world of text and time,
We skip the old to find the prime!
With queues anew and texts so bright,
Our translations dance, a joyful sight!
So hop along, let's celebrate,
These changes lead us to create! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores