commit 779345ef79ce0502b7b1940e95c539fd1d6b8d5b
parent 5019c80de2640fa4f60d492780279c53b6f8602c
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 12 Mar 2023 22:57:45 +0100
feat: reference judges by user uuid
Diffstat:
3 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
@@ -64,4 +64,23 @@ $$;
create trigger on_auth_user_created
after insert on auth.users
for each row execute procedure public.handle_new_judge();
-```
-\ No newline at end of file
+```
+
+## Authentication with Magic Links
+
+Authentication of judges is performed using [Supabase Magic Links](https://supabase.com/docs/guides/auth/auth-magic-link).
+
+Sign up process for new judges:
+* The judge is required to have a valid email address
+* Judges can be invied to the rating backend by invite only (Click ["Invite"](https://app.supabase.com/project/_/auth/users) in Supabase backend)
+* The UUID is referenced automatically in the `judges` table, row can be amended with name of the judge
+
+Sign in process:
+* For sign in, the judge enters her email adress and receives a login link which is valid for 1h
+
+## TODO
+
+* Magic link TTL
+* Rating UI
+* New start list, create from existing runs
+* Import/export of startlists and rankings
+\ No newline at end of file
diff --git a/schema/judges.sql b/schema/judges.sql
@@ -25,7 +25,7 @@ SET default_table_access_method = heap;
--
CREATE TABLE public.judges (
- id bigint NOT NULL,
+ id uuid not null references auth.users on delete cascade,
created_at timestamp with time zone DEFAULT now(),
firstname character varying,
lastname character varying
@@ -42,20 +42,6 @@ COMMENT ON TABLE public.judges IS 'List of judges';
--
--- Name: judges_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
---
-
-ALTER TABLE public.judges ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
- SEQUENCE NAME public.judges_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1
-);
-
-
---
-- Name: judges judges_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
@@ -79,15 +65,6 @@ GRANT ALL ON TABLE public.judges TO service_role;
--
--- Name: SEQUENCE judges_id_seq; Type: ACL; Schema: public; Owner: postgres
---
-
-GRANT ALL ON SEQUENCE public.judges_id_seq TO anon;
-GRANT ALL ON SEQUENCE public.judges_id_seq TO authenticated;
-GRANT ALL ON SEQUENCE public.judges_id_seq TO service_role;
-
-
---
-- PostgreSQL database dump complete
--
diff --git a/schema/ratings.sql b/schema/ratings.sql
@@ -28,7 +28,7 @@ CREATE TABLE public.ratings (
id bigint NOT NULL,
created_at timestamp with time zone DEFAULT now(),
athlete bigint,
- judge bigint,
+ judge uuid,
rating double precision,
heat bigint
);