Skip to content

Commit

Permalink
Add id to json and return upcoming event in /json
Browse files Browse the repository at this point in the history
  • Loading branch information
marpo60 committed Jan 28, 2025
1 parent 2ea3c89 commit 3eaf922
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/meetup_bot/event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule MeetupBot.Event do
use Ecto.Schema
import Ecto.Changeset

@derive {Jason.Encoder, only: [:name, :title, :datetime, :end_datetime, :event_url]}
@derive {Jason.Encoder, only: [:id, :name, :title, :datetime, :end_datetime, :event_url]}

schema "events" do
field(:name, :string)
Expand Down
4 changes: 1 addition & 3 deletions lib/meetup_bot/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ defmodule MeetupBot.Router do
alias MeetupBot.MeetupCalendar
alias MeetupBot.Slack
alias OpenTelemetry.Tracer
alias MeetupBot.Repo
alias MeetupBot.Event

plug(Plug.Logger)

Expand Down Expand Up @@ -103,7 +101,7 @@ defmodule MeetupBot.Router do
end

get "/json" do
meetups = Repo.all(Event)
meetups = MeetupCache.values()

conn
|> put_resp_content_type("application/json")
Expand Down

0 comments on commit 3eaf922

Please sign in to comment.