Skip to content

Commit

Permalink
Merge branch 'main' into skander/spectrograms
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Aug 22, 2024
2 parents c878080 + f322acb commit e3c1be1
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 266 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/init@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -60,7 +60,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/autobuild@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -73,6 +73,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/analyze@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@29d86d22a34ea372b1bbf3b2dced2e25ca6b3384 # v3.26.1
uses: github/codeql-action/upload-sarif@429e1977040da7a23b6822b13c129cd1ba93dbb2 # v3.26.2
with:
sarif_file: results.sarif
44 changes: 23 additions & 21 deletions server/lib/orcasite/notifications/resources/subscriber.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ defmodule Orcasite.Notifications.Subscriber do
has_many :subscriptions, Subscription
end

code_interface do
define :by_email, args: [:email]
end

authentication do
domain Orcasite.Notifications

Expand Down Expand Up @@ -76,12 +72,6 @@ defmodule Orcasite.Notifications.Subscriber do
end
end

resource do
description """
A subscriber object. Can relate to an individual, an organization, a newsletter, or an admin.
"""
end

actions do
defaults [:create, :read, :update, :destroy]

Expand Down Expand Up @@ -122,7 +112,9 @@ defmodule Orcasite.Notifications.Subscriber do

change fn changeset, _context ->
meta =
case Orcasite.Accounts.User.by_email(Ash.Changeset.get_argument(changeset, :email)) do
case Orcasite.Accounts.User.by_email(Ash.Changeset.get_argument(changeset, :email),
authorize?: false
) do
{:ok, %{id: user_id}} -> %{user_id: user_id}
_ -> %{}
end
Expand Down Expand Up @@ -150,6 +142,26 @@ defmodule Orcasite.Notifications.Subscriber do
end
end

code_interface do
define :by_email, args: [:email]
end

resource do
description """
A subscriber object. Can relate to an individual, an organization, a newsletter, or an admin.
"""
end

admin do
table_columns [:id, :name, :meta, :inserted_at]
read_actions [:read, :by_email]
format_fields meta: {Jason, :encode!, []}

form do
field :event_type, type: :default
end
end

validations do
validate fn changeset, _context ->
# Check if email subscriber already exists
Expand All @@ -167,16 +179,6 @@ defmodule Orcasite.Notifications.Subscriber do
end
end

admin do
table_columns [:id, :name, :meta, :inserted_at]
read_actions [:read, :by_email]
format_fields meta: {Jason, :encode!, []}

form do
field :event_type, type: :default
end
end

json_api do
type "subscriber"

Expand Down
6 changes: 4 additions & 2 deletions server/lib/orcasite/radio/feed.ex
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ defmodule Orcasite.Radio.Feed do
:bucket,
:bucket_region,
:cloudfront_url,
:dataplicity_id
:dataplicity_id,
:orcahello_id
]

argument :lat_lng_string, :string do
Expand All @@ -154,7 +155,8 @@ defmodule Orcasite.Radio.Feed do
:bucket,
:bucket_region,
:cloudfront_url,
:dataplicity_id
:dataplicity_id,
:orcahello_id
]

argument :lat_lng_string, :string do
Expand Down
Loading

0 comments on commit e3c1be1

Please sign in to comment.