Repository navigation
✨ feature: coordinators edit a Träger's about, machine-translated like opportunities (be#1407) - #1408
Merged
arturasmckwcz merged 2 commits intoNov 20, 2026
Conversation
…e opportunities (be#1407) - PATCH /organization/:id accepts about (null/"" clear it, max ORGANIZATION_ABOUT_MAX_LENGTH) and originalLanguage; ?language= edits in another language are stored as human translations. - about is queued for machine translation; GET /organization/:id?language= serves the translation and returns originalLanguage. - Migration: organization.original_language_id, field_translation.organization_id (FK, unique index, CHECK), and the entity-type enums gain 'organization' (sdk 0.0.218). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Lock the organization before setOriginalLanguage, so it can't requeue a stale about. - Detect the original language again when about was empty, unless the same request sends originalLanguage. - Only a unique violation on organization itself is a taken title. - Name the field in the length error. - Move editLanguage, requestLanguage and languageIdOf to request-language.ts, out of the opportunity translation module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nadavosa
approved these changes
Nov 20, 2026
nadavosa
left a comment
Collaborator
There was a problem hiding this comment.
Looks good. Tested on a local merge with be#1410: migration runs clean on db-test, full suite 2675/2675.
| `ALTER TYPE "public"."comment_entity_type_enum_old" RENAME TO "comment_entity_type_enum"`, | ||
| ); | ||
| await queryRunner.query( | ||
| `CREATE INDEX "IDX_8c3af29493287693cdd82d99c1" ON "comment" ("entity_id", "entity_type", "language_id") `, |
Collaborator
There was a problem hiding this comment.
Nit: down recreates the index as (entity_id, entity_type, language_id); the original is (entity_type, entity_id, language_id).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1407. This covers review findings #1 and #5 on #1406, plus machine translation of
organization.about. Contract: need4deed-org/sdk#367 and need4deed-org/sdk#368 (need4deed-sdk0.0.218).PATCH /organization/:idabout.nullor""clears it. It is trimmed, and anything longer thanORGANIZATION_ABOUT_MAX_LENGTH(2000) gives 400.aboutis set, its language is detected (languageHint, else?language=, elsede) and stored inorganization.original_language_id.originalLanguagecorrects a detected language, as on opportunities (setOriginalLanguage).?language=<lang>that isn't the original stores the text as a human translation and leaves the source unchanged (writeHumanTranslations, asdivertTranslatedEditsdoes for opportunities). Clearingaboutis only allowed in the original language.enqueue). The existing worker picks it up with no change, since it works over every machine entry in the registry.GET /organization/:id?language=<lang>serves the translatedaboutonce it's done and still matches the source. Otherwise it serves the original.originalLanguage.Translation registry
organization→organizationId, fieldabout,machine: true. The/translationreview endpoints therefore also cover a Träger'sabout, andassertTranslationLengthenforces the same 2000-character limit.Migration
organization-about-translationGenerated, with one addition by hand:
organization.original_language_id(FK → language,ON DELETE SET NULL).field_translation.organization_id(FK,ON DELETE CASCADE) and the partial unique indexUQ_field_translation_organization.comment,notion_relation,optionandtimelineentity-type enums gainorganization, because sdk 0.0.218 adds it toEntityTableName.CHK_field_translation_one_targetis recreated to includeorganization_id. TypeORM doesn't diff a CHECK expression, so the generator leaves it out.downfirst deletes the Träger translation rows, then restores the old CHECK.Checked locally:
migration:generate --checkreports no changes afterwards, andmigration:revertfollowed bymigration:runworks on the test DB.Tests
organization.routes.test.ts: detects German and English; queues the other language; stores an edit in the other language as a human translation and serves it in GET; clears withnullor""and drops the rows; gives 400 when clearing in a non-original language; gives 400 above the limit; corrects the original language and requeues.registry.test.ts:organizationis now a machine entry.Self-review
setOriginalLanguage; the language is detected again whenaboutwas empty (unlessoriginalLanguageis sent with it); only anorganizationunique violation gives 409 for the title; the length error names the field;editLanguage,requestLanguageandlanguageIdOfmoved torequest-language.ts.aboutbefore this PR.downnarrows the entity-type enums, so it would fail if a comment, timeline, option or notion_relation row used'organization'. Nothing writes that value yet.🤖 Generated with Claude Code