order in db

This commit is contained in:
2022-02-15 19:55:48 -05:00
parent 0b0e1cc639
commit 7110a2db21
7 changed files with 23 additions and 14 deletions

View File

@@ -20,7 +20,7 @@ defmodule Cannery.Containers do
"""
@spec list_containers(User.t()) :: [Container.t()]
def list_containers(%User{id: user_id}),
do: Repo.all(from c in Container, where: c.user_id == ^user_id)
do: Repo.all(from c in Container, where: c.user_id == ^user_id, order_by: c.name)
@doc """
Gets a single container.