Skip to content

Commit

Permalink
Update Feed bucket to non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Sep 9, 2024
1 parent de452f4 commit 117dc92
Show file tree
Hide file tree
Showing 7 changed files with 384 additions and 12 deletions.
2 changes: 1 addition & 1 deletion server/lib/orcasite/radio/feed.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Orcasite.Radio.Feed do
attribute :intro_html, :string, default: "", public?: true
attribute :image_url, :string, default: "", public?: true
attribute :visible, :boolean, default: true, public?: true
attribute :bucket, :string, public?: true
attribute :bucket, :string, public?: true, allow_nil?: false
attribute :bucket_region, :string, public?: true
attribute :cloudfront_url, :string, public?: true
attribute :dataplicity_id, :string, public?: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
defmodule Orcasite.Repo.Migrations.UpdateFeedBucketNonNull do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""

use Ecto.Migration

def up do
alter table(:feeds) do
modify :bucket, :text, null: false
end
end

def down do
alter table(:feeds) do
modify :bucket, :text, null: true
end
end
end
317 changes: 317 additions & 0 deletions server/priv/resource_snapshots/repo/feeds/20240909214708.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"uuid_generate_v7()\")",
"generated?": false,
"primary_key?": true,
"references": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "name",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "node_name",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "slug",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "location_point",
"type": "geometry"
},
{
"allow_nil?": true,
"default": "\"\"",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "intro_html",
"type": "text"
},
{
"allow_nil?": true,
"default": "\"\"",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "image_url",
"type": "text"
},
{
"allow_nil?": true,
"default": "true",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "visible",
"type": "boolean"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "bucket",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "bucket_region",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "cloudfront_url",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "dataplicity_id",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "orcahello_id",
"type": "text"
},
{
"allow_nil?": false,
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "inserted_at",
"type": "utc_datetime_usec"
},
{
"allow_nil?": false,
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "updated_at",
"type": "utc_datetime_usec"
}
],
"base_filter": null,
"check_constraints": [],
"custom_indexes": [
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"name"
],
"fields": [
{
"type": "atom",
"value": "name"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"node_name"
],
"fields": [
{
"type": "atom",
"value": "node_name"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"visible"
],
"fields": [
{
"type": "atom",
"value": "visible"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"slug"
],
"fields": [
{
"type": "atom",
"value": "slug"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"dataplicity_id"
],
"fields": [
{
"type": "atom",
"value": "dataplicity_id"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
},
{
"all_tenants?": false,
"concurrently": false,
"error_fields": [
"orcahello_id"
],
"fields": [
{
"type": "atom",
"value": "orcahello_id"
}
],
"include": null,
"message": null,
"name": null,
"nulls_distinct": true,
"prefix": null,
"table": null,
"unique": false,
"using": null,
"where": null
}
],
"custom_statements": [],
"has_create_action": true,
"hash": "7FDF1C3B2AAFBFB7E5DFBE36CD16249F0B95A8F78F8927EE095669FC0F259BB4",
"identities": [
{
"all_tenants?": false,
"base_filter": null,
"index_name": "feeds_unique_slug_index",
"keys": [
{
"type": "atom",
"value": "slug"
}
],
"name": "unique_slug",
"nils_distinct?": true,
"where": null
}
],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.Orcasite.Repo",
"schema": null,
"table": "feeds"
}
4 changes: 2 additions & 2 deletions ui/src/components/Player/DetectionsPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import dynamic from "next/dynamic";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";

import { Feed } from "@/graphql/generated";
import { getHlsURI, S3_BUCKET } from "@/hooks/useTimestampFetcher";
import { getHlsURI } from "@/hooks/useTimestampFetcher";
import { mobileOnly } from "@/styles/responsive";

import { type PlayerStatus } from "./Player";
Expand Down Expand Up @@ -38,7 +38,7 @@ export function DetectionsPlayer({
const sliderMax = endOffset - startOffset;
const sliderValue = playerTime - startOffset;

const hlsURI = getHlsURI(feed.bucket || S3_BUCKET, feed.nodeName, timestamp);
const hlsURI = getHlsURI(feed.bucket, feed.nodeName, timestamp);

const playerOptions = useMemo(
() => ({
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/Player/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Marquee from "react-fast-marquee";

import type { Feed } from "@/graphql/generated";
import useFeedPresence from "@/hooks/useFeedPresence";
import { S3_BUCKET, useTimestampFetcher } from "@/hooks/useTimestampFetcher";
import { useTimestampFetcher } from "@/hooks/useTimestampFetcher";
import fin512 from "@/public/photos/fin-512x512.png";
import {
displayDesktopOnly,
Expand Down Expand Up @@ -47,7 +47,7 @@ export default function Player({
const playerRef = useRef<VideoJSPlayer | null>(null);

const { timestamp, hlsURI } = useTimestampFetcher(
currentFeed?.bucket || S3_BUCKET,
currentFeed?.bucket,
currentFeed?.nodeName,
);

Expand Down
Loading

0 comments on commit 117dc92

Please sign in to comment.