Skip to content

Commit

Permalink
Update shop fields constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
sgobotta committed Sep 30, 2023
1 parent b668a97 commit 296d8c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ex_commerce/marketplaces/shop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ defmodule ExCommerce.Marketplaces.Shop do
schema "shops" do
field :name, :string
field :slug, :string
field :description, :string, size: 128
field :description, :string
field :telephone, :string
field :banner_message, :string, size: 128
field :banner_message, :string
field :address, :string

many_to_many :avatars, Uploads.Photo,
Expand Down Expand Up @@ -62,6 +62,8 @@ defmodule ExCommerce.Marketplaces.Shop do
|> validate_required(@fields ++ @foreign_fields)
|> format_slug()
|> unique_constraint(:slug)
|> validate_length(:description, max: 128)
|> validate_length(:banner_message, max: 128)
end

defp maybe_assoc_avatars(changeset, %{"avatars" => avatars}),
Expand Down

0 comments on commit 296d8c4

Please sign in to comment.