feat: more complete metadata diff, scp publishing and rendering context

This commit is contained in:
2026-04-24 06:30:41 +02:00
parent e101a3db79
commit 624b698bb3
48 changed files with 2193 additions and 505 deletions

View File

@@ -67,7 +67,15 @@ defmodule BDS.Posts.Post do
],
empty_values: [nil]
)
|> validate_required([:id, :project_id, :slug, :status, :created_at, :updated_at, :do_not_translate])
|> validate_required([
:id,
:project_id,
:slug,
:status,
:created_at,
:updated_at,
:do_not_translate
])
|> assoc_constraint(:project)
|> unique_constraint(:slug, name: :posts_project_slug_idx)
end

View File

@@ -9,7 +9,10 @@ defmodule BDS.Posts.Translation do
@statuses [:draft, :published]
schema "post_translations" do
belongs_to :post, BDS.Posts.Post, foreign_key: :translation_for, references: :id, type: :string
belongs_to :post, BDS.Posts.Post,
foreign_key: :translation_for,
references: :id,
type: :string
field :project_id, :string
field :language, :string
@@ -26,22 +29,35 @@ defmodule BDS.Posts.Translation do
def changeset(translation, attrs) do
translation
|> cast(attrs, [
|> cast(
attrs,
[
:id,
:project_id,
:translation_for,
:language,
:title,
:excerpt,
:content,
:status,
:created_at,
:updated_at,
:published_at,
:file_path,
:checksum
],
empty_values: [nil]
)
|> validate_required([
:id,
:project_id,
:translation_for,
:language,
:title,
:excerpt,
:content,
:status,
:created_at,
:updated_at,
:published_at,
:file_path,
:checksum
], empty_values: [nil])
|> validate_required([:id, :project_id, :translation_for, :language, :title, :status, :created_at, :updated_at])
:updated_at
])
|> foreign_key_constraint(:translation_for)
|> unique_constraint(:language, name: :post_translations_translation_language_idx)
end