fix: more work on metadata diff
This commit is contained in:
@@ -3,6 +3,7 @@ defmodule BDS.Templates do
|
||||
|
||||
import Ecto.Query
|
||||
|
||||
alias BDS.DocumentFields
|
||||
alias BDS.Frontmatter
|
||||
alias BDS.Persistence
|
||||
alias BDS.Posts
|
||||
@@ -408,18 +409,18 @@ defmodule BDS.Templates do
|
||||
now = Persistence.now_ms()
|
||||
|
||||
attrs = %{
|
||||
id: Map.get(fields, "id") || Ecto.UUID.generate(),
|
||||
id: DocumentFields.get(fields, "id") || Ecto.UUID.generate(),
|
||||
project_id: project_id,
|
||||
slug: Map.fetch!(fields, "slug"),
|
||||
title: Map.get(fields, "title") || "",
|
||||
kind: parse_template_kind(Map.fetch!(fields, "kind")),
|
||||
slug: DocumentFields.fetch!(fields, "slug"),
|
||||
title: DocumentFields.get(fields, "title") || "",
|
||||
kind: parse_template_kind(DocumentFields.fetch!(fields, "kind")),
|
||||
enabled: Map.get(fields, "enabled", true),
|
||||
version: Map.get(fields, "version", 1),
|
||||
file_path: relative_path,
|
||||
status: :published,
|
||||
content: nil,
|
||||
created_at: Map.get(fields, "createdAt", now),
|
||||
updated_at: Map.get(fields, "updatedAt", now)
|
||||
created_at: DocumentFields.get(fields, "createdAt", now),
|
||||
updated_at: DocumentFields.get(fields, "updatedAt", now)
|
||||
}
|
||||
|
||||
template = Repo.get_by(Template, project_id: project_id, slug: attrs.slug) || %Template{}
|
||||
|
||||
Reference in New Issue
Block a user