Skip to content

Commit

Permalink
feat: create spotlight working
Browse files Browse the repository at this point in the history
  • Loading branch information
AfonsoMartins26 committed Nov 23, 2024
1 parent 7628c22 commit 64e1a27
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions lib/safira/spotlights/spotlight.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
defmodule Safira.Spotlights.Spotlight do
use Ecto.Schema
import Ecto.Changeset
use Safira.Schema

schema "spotlights" do
field :end, :utc_datetime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
</:actions>
<div class="flex flex-col items-center mt-8">
<img src={~p"/images/spotlight.svg"} alt="Spotlight" class="w-64 h-64 mb-4" />
<%= IO.inspect(@spotlight) %>
<%= if @has_spotlight do %>
<%= if @spotlight do %>
<p><%= @spotlight.company.name %> is on spotlight!</p>
<p>
Time remaining: <%= Timex.diff(@spotlight.end, DateTime.utc_now(), :minutes) %> minutes
</p>
<% else %>
<p>There are no companies on spotlight!</p>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion priv/repo/migrations/20241121223205_create_spotlights.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ defmodule Safira.Repo.Migrations.CreateSpotlights do
use Ecto.Migration

def change do
create table(:spotlights) do
create table(:spotlights, primary_key: false) do
add :id, :binary_id, primary_key: true
add :company_id, references(:companies, type: :binary_id, on_delete: :delete_all),
null: false

Expand Down

0 comments on commit 64e1a27

Please sign in to comment.