commit a0260a400450109bcc6274d79689fb52fbd23e51
parent 085c1f0dc3b0f4aef2286c8fe31f5b77b2867b0e
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sat, 11 Mar 2023 21:21:08 +0100
docs: update readme and schema
Diffstat:
M | README.md | | | 75 | ++++++++++++--------------------------------------------------------------- |
A | schema/athletes.sql | | | 103 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | schema/heats.sql | | | 101 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | schema/judges.sql | | | 93 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | schema/ratings.sql | | | 126 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | schema/startlist.sql | | | 116 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | supabase-schema.png | | | 0 | |
7 files changed, 551 insertions(+), 63 deletions(-)
diff --git a/README.md b/README.md
@@ -1,70 +1,19 @@
-# Getting Started with Create React App
+# My Heats
-This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+Live heats, scoring and leaderboard for sport events.
-## Available Scripts
+## Running the App
-In the project directory, you can run:
+```
+# Export Supabase database credential for anonymous access
+export REACT_APP_SUPABASE_KEY=
-### `npm start`
+# Start app
+npm start
+```
-Runs the app in the development mode.\
-Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
+## Databas Schema
-The page will reload when you make changes.\
-You may also see any lint errors in the console.
+The Supabase schema is stored in the `schema` folder and can be created using plain psql.
-### `npm test`
-
-Launches the test runner in the interactive watch mode.\
-See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
-
-### `npm run build`
-
-Builds the app for production to the `build` folder.\
-It correctly bundles React in production mode and optimizes the build for the best performance.
-
-The build is minified and the filenames include the hashes.\
-Your app is ready to be deployed!
-
-See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
-
-### `npm run eject`
-
-**Note: this is a one-way operation. Once you `eject`, you can't go back!**
-
-If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
-
-Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
-
-You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
-
-## Learn More
-
-You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
-
-To learn React, check out the [React documentation](https://reactjs.org/).
-
-### Code Splitting
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
-
-### Analyzing the Bundle Size
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
-
-### Making a Progressive Web App
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
-
-### Advanced Configuration
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
-
-### Deployment
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
-
-### `npm run build` fails to minify
-
-This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
+![supabase-schema](supabase-schema.png)
diff --git a/schema/athletes.sql b/schema/athletes.sql
@@ -0,0 +1,103 @@
+--
+-- PostgreSQL database dump
+--
+
+-- Dumped from database version 15.1
+-- Dumped by pg_dump version 15.2
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+SET default_tablespace = '';
+
+SET default_table_access_method = heap;
+
+--
+-- Name: athletes; Type: TABLE; Schema: public; Owner: postgres
+--
+
+CREATE TABLE public.athletes (
+ id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now(),
+ nr bigint,
+ firstname character varying,
+ lastname character varying,
+ birthday date,
+ school character varying
+);
+
+
+ALTER TABLE public.athletes OWNER TO postgres;
+
+--
+-- Name: TABLE athletes; Type: COMMENT; Schema: public; Owner: postgres
+--
+
+COMMENT ON TABLE public.athletes IS 'Startlist with athletes';
+
+
+--
+-- Name: athletes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.athletes ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME public.athletes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
+
+
+--
+-- Name: athletes slopestyle_snowboard_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.athletes
+ ADD CONSTRAINT slopestyle_snowboard_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: athletes Enable read access for all users; Type: POLICY; Schema: public; Owner: postgres
+--
+
+CREATE POLICY "Enable read access for all users" ON public.athletes FOR SELECT USING (true);
+
+
+--
+-- Name: athletes; Type: ROW SECURITY; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.athletes ENABLE ROW LEVEL SECURITY;
+
+--
+-- Name: TABLE athletes; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON TABLE public.athletes TO anon;
+GRANT ALL ON TABLE public.athletes TO authenticated;
+GRANT ALL ON TABLE public.athletes TO service_role;
+
+
+--
+-- Name: SEQUENCE athletes_id_seq; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON SEQUENCE public.athletes_id_seq TO anon;
+GRANT ALL ON SEQUENCE public.athletes_id_seq TO authenticated;
+GRANT ALL ON SEQUENCE public.athletes_id_seq TO service_role;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/schema/heats.sql b/schema/heats.sql
@@ -0,0 +1,101 @@
+--
+-- PostgreSQL database dump
+--
+
+-- Dumped from database version 15.1
+-- Dumped by pg_dump version 15.2
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+SET default_tablespace = '';
+
+SET default_table_access_method = heap;
+
+--
+-- Name: heats; Type: TABLE; Schema: public; Owner: postgres
+--
+
+CREATE TABLE public.heats (
+ id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now(),
+ name character varying,
+ location character varying,
+ planned_start time without time zone
+);
+
+
+ALTER TABLE public.heats OWNER TO postgres;
+
+--
+-- Name: TABLE heats; Type: COMMENT; Schema: public; Owner: postgres
+--
+
+COMMENT ON TABLE public.heats IS 'List of heats or contest runs';
+
+
+--
+-- Name: heats_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.heats ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME public.heats_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
+
+
+--
+-- Name: heats heats_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.heats
+ ADD CONSTRAINT heats_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: heats Enable read access for all users; Type: POLICY; Schema: public; Owner: postgres
+--
+
+CREATE POLICY "Enable read access for all users" ON public.heats FOR SELECT USING (true);
+
+
+--
+-- Name: heats; Type: ROW SECURITY; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.heats ENABLE ROW LEVEL SECURITY;
+
+--
+-- Name: TABLE heats; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON TABLE public.heats TO anon;
+GRANT ALL ON TABLE public.heats TO authenticated;
+GRANT ALL ON TABLE public.heats TO service_role;
+
+
+--
+-- Name: SEQUENCE heats_id_seq; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON SEQUENCE public.heats_id_seq TO anon;
+GRANT ALL ON SEQUENCE public.heats_id_seq TO authenticated;
+GRANT ALL ON SEQUENCE public.heats_id_seq TO service_role;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/schema/judges.sql b/schema/judges.sql
@@ -0,0 +1,93 @@
+--
+-- PostgreSQL database dump
+--
+
+-- Dumped from database version 15.1
+-- Dumped by pg_dump version 15.2
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+SET default_tablespace = '';
+
+SET default_table_access_method = heap;
+
+--
+-- Name: judges; Type: TABLE; Schema: public; Owner: postgres
+--
+
+CREATE TABLE public.judges (
+ id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now(),
+ firstname character varying,
+ lastname character varying
+);
+
+
+ALTER TABLE public.judges OWNER TO postgres;
+
+--
+-- Name: TABLE judges; Type: COMMENT; Schema: public; Owner: postgres
+--
+
+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
+--
+
+ALTER TABLE ONLY public.judges
+ ADD CONSTRAINT judges_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: judges; Type: ROW SECURITY; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.judges ENABLE ROW LEVEL SECURITY;
+
+--
+-- Name: TABLE judges; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON TABLE public.judges TO anon;
+GRANT ALL ON TABLE public.judges TO authenticated;
+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
@@ -0,0 +1,126 @@
+--
+-- PostgreSQL database dump
+--
+
+-- Dumped from database version 15.1
+-- Dumped by pg_dump version 15.2
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+SET default_tablespace = '';
+
+SET default_table_access_method = heap;
+
+--
+-- Name: ratings; Type: TABLE; Schema: public; Owner: postgres
+--
+
+CREATE TABLE public.ratings (
+ id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now(),
+ athlete bigint,
+ judge bigint,
+ rating double precision,
+ heat bigint
+);
+
+
+ALTER TABLE public.ratings OWNER TO postgres;
+
+--
+-- Name: TABLE ratings; Type: COMMENT; Schema: public; Owner: postgres
+--
+
+COMMENT ON TABLE public.ratings IS 'List of ratings';
+
+
+--
+-- Name: rating_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.ratings ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME public.rating_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
+
+
+--
+-- Name: ratings rating_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.ratings
+ ADD CONSTRAINT rating_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ratings ratings_athlete_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.ratings
+ ADD CONSTRAINT ratings_athlete_fkey FOREIGN KEY (athlete) REFERENCES public.athletes(id);
+
+
+--
+-- Name: ratings ratings_heat_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.ratings
+ ADD CONSTRAINT ratings_heat_fkey FOREIGN KEY (heat) REFERENCES public.heats(id);
+
+
+--
+-- Name: ratings ratings_judge_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.ratings
+ ADD CONSTRAINT ratings_judge_fkey FOREIGN KEY (judge) REFERENCES public.judges(id);
+
+
+--
+-- Name: ratings Enable read access for all users; Type: POLICY; Schema: public; Owner: postgres
+--
+
+CREATE POLICY "Enable read access for all users" ON public.ratings FOR SELECT USING (true);
+
+
+--
+-- Name: ratings; Type: ROW SECURITY; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.ratings ENABLE ROW LEVEL SECURITY;
+
+--
+-- Name: TABLE ratings; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON TABLE public.ratings TO anon;
+GRANT ALL ON TABLE public.ratings TO authenticated;
+GRANT ALL ON TABLE public.ratings TO service_role;
+
+
+--
+-- Name: SEQUENCE rating_id_seq; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON SEQUENCE public.rating_id_seq TO anon;
+GRANT ALL ON SEQUENCE public.rating_id_seq TO authenticated;
+GRANT ALL ON SEQUENCE public.rating_id_seq TO service_role;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/schema/startlist.sql b/schema/startlist.sql
@@ -0,0 +1,116 @@
+--
+-- PostgreSQL database dump
+--
+
+-- Dumped from database version 15.1
+-- Dumped by pg_dump version 15.2
+
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+SET default_tablespace = '';
+
+SET default_table_access_method = heap;
+
+--
+-- Name: startlist; Type: TABLE; Schema: public; Owner: postgres
+--
+
+CREATE TABLE public.startlist (
+ id bigint NOT NULL,
+ created_at timestamp with time zone DEFAULT now(),
+ heat bigint,
+ athlete bigint
+);
+
+
+ALTER TABLE public.startlist OWNER TO postgres;
+
+--
+-- Name: TABLE startlist; Type: COMMENT; Schema: public; Owner: postgres
+--
+
+COMMENT ON TABLE public.startlist IS 'List of athletes for a given heat or run';
+
+
+--
+-- Name: startlist_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.startlist ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
+ SEQUENCE NAME public.startlist_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1
+);
+
+
+--
+-- Name: startlist startlist_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.startlist
+ ADD CONSTRAINT startlist_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: startlist startlist_athlete_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.startlist
+ ADD CONSTRAINT startlist_athlete_fkey FOREIGN KEY (athlete) REFERENCES public.athletes(id);
+
+
+--
+-- Name: startlist startlist_heat_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
+--
+
+ALTER TABLE ONLY public.startlist
+ ADD CONSTRAINT startlist_heat_fkey FOREIGN KEY (heat) REFERENCES public.heats(id);
+
+
+--
+-- Name: startlist Enable read access for all users; Type: POLICY; Schema: public; Owner: postgres
+--
+
+CREATE POLICY "Enable read access for all users" ON public.startlist FOR SELECT USING (true);
+
+
+--
+-- Name: startlist; Type: ROW SECURITY; Schema: public; Owner: postgres
+--
+
+ALTER TABLE public.startlist ENABLE ROW LEVEL SECURITY;
+
+--
+-- Name: TABLE startlist; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON TABLE public.startlist TO anon;
+GRANT ALL ON TABLE public.startlist TO authenticated;
+GRANT ALL ON TABLE public.startlist TO service_role;
+
+
+--
+-- Name: SEQUENCE startlist_id_seq; Type: ACL; Schema: public; Owner: postgres
+--
+
+GRANT ALL ON SEQUENCE public.startlist_id_seq TO anon;
+GRANT ALL ON SEQUENCE public.startlist_id_seq TO authenticated;
+GRANT ALL ON SEQUENCE public.startlist_id_seq TO service_role;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
diff --git a/supabase-schema.png b/supabase-schema.png
Binary files differ.