Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
chore: some housekeeping (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
ff6347 committed Dec 7, 2021
1 parent f86e824 commit f53f1ce
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 34 deletions.
64 changes: 60 additions & 4 deletions dev-tools/node-client/extended-user-profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,68 @@ const supabase = createClient(
process.env.SUPABASE_ANON_KEY
);

// This query string made the frontend fail
// since postgrest had an disambiguation error
// {
// "message": "More than one relationship was found for sensors and user_id",
// "hint": "By following the 'details' key, disambiguate the request by changing the url to /origin?select=relationship(*) or /origin?select=target!relationship(*)",
// "details": [
// {
// "relationship": "sensors_user_id_fkey[user_id][id]",
// "cardinality": "m2o",
// "origin": "public.sensors",
// "target": "public.user_profiles"
// },
// {
// "relationship": "sensors_user_id_fkey[user_id][id]",
// "cardinality": "m2o",
// "origin": "public.sensors",
// "target": "public.extended_user_profiles"
// }
// ]
// }
export const accountQueryString = `
id,
name,
display_name,
created_at,
url,
description,
sensors (
id,
name,
created_at,
connection_type,
external_id,
description,
location,
latitude,
longitude,
altitude,
category_id,
icon_id,
user_id,
records (
recorded_at,
measurements
),
user:user_profiles!user_id (
name,
display_name
),
category:category_id (
id,
name
)
)
`;

async function main() {
const { data, error } = await supabase
.from("extended_user_profiles")
.select("*"); // ?
// console.log(error);
// console.log(data);
.from("user_profiles")
.select(accountQueryString); // ?
console.log(error);
console.log(data);
}

main().catch(console.error);
10 changes: 0 additions & 10 deletions renovate.json

This file was deleted.

47 changes: 47 additions & 0 deletions supabase-docker-compose/compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
print_usage() {
printf "\n------------------------------\n"
printf "Usage: %s -u (up) docker compose up\n" "${0}"
printf " %s -d (down) docker compose down\n" "${0}"
printf " %s -b (background) docker compose up --detach\n" "${0}"
printf " %s -f (force) docker compose up --build --force-recreate\n" "${0}"
printf " %s -k (kill) docker compose down && rm -rf dockerfiles/postgres/pg-data/* \n" "${0}"
printf " %s -h (help) print this help\n" "${0}"

}

while getopts 'ubdkfh' flag; do
case "${flag}" in
u)
docker compose up
exit 0
;;
b)
docker compose up --detach
exit 0
;;

d)
docker compose down
exit 0
;;
f)
docker compose up --build --force-recreate
exit 0
;;
k)
docker compose down && rm -rf dockerfiles/postgres/pg-data/*
exit 0
;;
h)
print_usage
exit 0
;;
*)
print_usage
exit 1
;;
esac
done
5 changes: 0 additions & 5 deletions supabase-docker-compose/down-rm.sh

This file was deleted.

5 changes: 0 additions & 5 deletions supabase-docker-compose/down.sh

This file was deleted.

5 changes: 0 additions & 5 deletions supabase-docker-compose/up-b-frc.sh

This file was deleted.

5 changes: 0 additions & 5 deletions supabase-docker-compose/up.sh

This file was deleted.

0 comments on commit f53f1ce

Please sign in to comment.