Skip to content

Commit

Permalink
Add display name for stacks (#557)
Browse files Browse the repository at this point in the history
will help us use  better prosaic names for stacks where needed
  • Loading branch information
michaeljguarino authored Sep 22, 2022
1 parent e66ca64 commit a8782a7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
13 changes: 7 additions & 6 deletions apps/core/lib/core/schema/stack.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ defmodule Core.Schema.Stack do
alias Core.Schema.{Account, User, StackCollection, Repository}

schema "stacks" do
field :name, :string
field :description, :string
field :featured, :boolean, default: :false
field :bundles, :map, virtual: true
field :expires_at, :utc_datetime_usec
field :name, :string
field :description, :string
field :featured, :boolean, default: :false
field :display_name, :string
field :bundles, :map, virtual: true
field :expires_at, :utc_datetime_usec

belongs_to :account, Account
belongs_to :creator, User
Expand All @@ -33,7 +34,7 @@ defmodule Core.Schema.Stack do
from(s in query, order_by: ^order)
end

@valid ~w(name description featured expires_at)a
@valid ~w(name description featured expires_at display_name)a

def changeset(model, attrs \\ %{}) do
model
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Core.Repo.Migrations.AddStackDisplayName do
use Ecto.Migration

def change do
alter table(:stacks) do
add :display_name, :string
end
end
end
28 changes: 15 additions & 13 deletions apps/graphql/lib/graphql/schema/recipe.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ defmodule GraphQl.Schema.Recipe do
end

input_object :stack_attributes do
field :name, non_null(:string)
field :description, :string
field :featured, :boolean
field :collections, list_of(:stack_collection_attributes)
field :community, :community_attributes
field :name, non_null(:string)
field :description, :string
field :featured, :boolean
field :display_name, :string
field :collections, list_of(:stack_collection_attributes)
field :community, :community_attributes
end

input_object :stack_collection_attributes do
Expand Down Expand Up @@ -199,14 +200,15 @@ defmodule GraphQl.Schema.Recipe do
end

object :stack do
field :id, non_null(:id)
field :name, non_null(:string)
field :description, :string
field :featured, :boolean
field :community, :community
field :collections, list_of(:stack_collection), resolve: dataloader(Recipe)
field :creator, :user, resolve: dataloader(User)
field :bundles, list_of(:recipe)
field :id, non_null(:id)
field :name, non_null(:string)
field :description, :string
field :featured, :boolean
field :community, :community
field :display_name, :string
field :collections, list_of(:stack_collection), resolve: dataloader(Recipe)
field :creator, :user, resolve: dataloader(User)
field :bundles, list_of(:recipe)

timestamps()
end
Expand Down

0 comments on commit a8782a7

Please sign in to comment.