-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add tags to items #150
Conversation
Run `mix deps.udpate --all` ref: #245
Codecov Report
@@ Coverage Diff @@
## main #150 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 7 9 +2
Lines 136 166 +30
=========================================
+ Hits 136 166 +30
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Create Ecto migration with unique indexes for tags and items_tags ref: #245 app
Add schemas and use many_to_many function to create associations between tags and items
Link tag to a person
Add primary_key: false option in migration
Test the Tag schema see https://hexdocs.pm/phoenix/testing_contexts.html#testing-schemas
Create .iex.exs file with aliases. This allow us to access directly the aliases when running a `iex -S mix` session ref: https://twitter.com/mplatts/status/1570674202465935360
Add documentation on how to create the tags migrations and schemas
- Add more documentation about the migrations and schemas - use citext in migration
- Get the latest version of LiveView - assign_new is now part of Phoenix.Component module
Add simple test to test field value for ItemTag schema
Define name of the unique constraint. This will convert the raised error to changeset error
lib/app/item.ex
Outdated
@@ -48,7 +48,6 @@ defmodule App.Item do | |||
def create_item_with_tags(attrs) do | |||
%Item{} | |||
|> changeset_with_tags(attrs) | |||
|> IO.inspect() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth updating the Elixir
version to v1.14
so that we can use dbg
? 😉 #finally
🎉
Display list of tags under each items Run formatter on project
Add link to tak to filter the list by tag
Add tests when filter by tag name
Finish documentation for items-tags association
Let me know your thoughts on this @nelsonic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on localhost
:
git pull
git checkout 'tags-#245'
mix deps.udpate --all
Upgraded:
ecto 3.8.4 => 3.9.0
ecto_sql 3.8.3 => 3.9.0
phoenix_live_view 0.18.0 => 0.18.1
mix test
...
Finished in 1.1 seconds (0.2s async, 0.9s sync)
41 tests, 0 failures
Good sign. 👌
mix ecto.migrate
22:22:49.641 [info] == Running 20220915103524 App.Repo.Migrations.AddTags.change/0 forward
22:22:49.650 [info] execute "CREATE EXTENSION IF NOT EXISTS citext"
22:22:49.762 [info] create table tags
22:22:49.778 [info] create index tags_text_person_id_index
22:22:49.781 [info] == Migrated 20220915103524 in 0.1s
22:22:49.873 [info] == Running 20220915104854 App.Repo.Migrations.AddItemsTags.change/0 forward
22:22:49.873 [info] create table items_tags
22:22:49.880 [info] create index items_tags_item_id_tag_id_index
22:22:49.882 [info] == Migrated 20220915104854 in 0.0s
Migrations appear to work.
mix phx.server
Created a new item
with tags
. ✅
When I attempt to edit the item
I am not able to edit the tags
:
@SimonLab this is looking very good so far.
Quite happy to merge it so we can ship + test it and add more features later. 💭
mix deps.udpate --all
to make sure all is up to dateref: dwyl/app#245