chore: working on code smells

This commit is contained in:
2026-04-30 17:46:05 +02:00
parent 8358f9000e
commit a80ce7c845
18 changed files with 513 additions and 19 deletions

View File

@@ -10,6 +10,35 @@ defmodule BDS.Posts.Post do
@foreign_key_type :string
@statuses [:draft, :published, :archived]
@type status :: :draft | :published | :archived
@type t :: %__MODULE__{
id: String.t() | nil,
project_id: String.t() | nil,
project: term(),
title: String.t() | nil,
slug: String.t() | nil,
excerpt: String.t() | nil,
content: String.t() | nil,
status: status(),
author: String.t() | nil,
created_at: integer() | nil,
updated_at: integer() | nil,
published_at: integer() | nil,
file_path: String.t(),
checksum: String.t() | nil,
tags: [String.t()],
categories: [String.t()],
template_slug: String.t() | nil,
language: String.t() | nil,
do_not_translate: boolean(),
published_title: String.t() | nil,
published_content: String.t() | nil,
published_tags: String.t() | nil,
published_categories: String.t() | nil,
published_excerpt: String.t() | nil
}
schema "posts" do
belongs_to :project, BDS.Projects.Project, type: :string
@@ -36,6 +65,7 @@ defmodule BDS.Posts.Post do
field :published_excerpt, :string
end
@spec changeset(t() | Ecto.Changeset.t(), map()) :: Ecto.Changeset.t()
def changeset(post, attrs) do
post
|> cast(