built basic ui structure in /hierarchy

This commit is contained in:
2026-02-14 18:03:13 -06:00
parent d645bda942
commit e4e0775472
24 changed files with 1174 additions and 106 deletions
+73 -11
View File
@@ -1,11 +1,73 @@
# Script for populating the database. You can run it as:
#
# mix run priv/repo/seeds.exs
#
# Inside the script, you can read and write to any of your
# repositories directly:
#
# RiverConnect.Repo.insert!(%RiverConnect.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
actions = [
fn ->
alias RiverConnect.Hierarchy
alias RiverConnect.Repo
# 1. Create DM Spring
case Repo.get_by(Hierarchy.Spring, name: "Direct Messages") do
nil ->
{:ok, spring} =
Hierarchy.create_spring(%{
name: "Direct Messages",
type: "dm",
description: "Private conversations between users"
})
IO.puts("Created 'Direct Messages' Spring")
spring
spring ->
IO.puts("'Direct Messages' Spring already exists")
spring
end
# 2. Create Jobs Spring
{:ok, jobs_spring} =
case Repo.get_by(Hierarchy.Spring, name: "Jobs") do
nil ->
{:ok, spring} =
Hierarchy.create_spring(%{
name: "Jobs",
type: "job",
description: "Job-specific rivers"
})
IO.puts("Created 'Jobs' Spring")
{:ok, spring}
spring ->
IO.puts("'Jobs' Spring already exists")
{:ok, spring}
end
# 3. Create a sample River in Jobs
case Repo.get_by(Hierarchy.River, name: "General Construction", spring_id: jobs_spring.id) do
nil ->
{:ok, river} =
Hierarchy.create_river(%{
name: "General Construction",
description: "General discussions about construction jobs",
spring_id: jobs_spring.id
})
IO.puts("Created 'General Construction' River")
# 4. Create sample Stream
{:ok, _stream} =
Hierarchy.create_stream(%{
name: "Announcements",
topic: "Important announcements",
river_id: river.id
})
IO.puts("Created 'Announcements' Stream")
_ ->
IO.puts("'General Construction' River already exists")
end
end
]
for action <- actions do
action.()
end