diff --git a/db_dump.sql b/db_dump.sql deleted file mode 100644 index 87f7233..0000000 --- a/db_dump.sql +++ /dev/null @@ -1,1392 +0,0 @@ --- --- PostgreSQL database dump --- - --- Dumped from database version 12.6 (Ubuntu 12.6-1.pgdg18.04+1) --- Dumped by pg_dump version 12.6 - -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; - --- --- Name: auth; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA auth; - - -ALTER SCHEMA auth OWNER TO supabase_admin; - --- --- Name: extensions; Type: SCHEMA; Schema: -; Owner: postgres --- - -CREATE SCHEMA extensions; - - -ALTER SCHEMA extensions OWNER TO postgres; - --- --- Name: pgbouncer; Type: SCHEMA; Schema: -; Owner: pgbouncer --- - -CREATE SCHEMA pgbouncer; - - -ALTER SCHEMA pgbouncer OWNER TO pgbouncer; - --- --- Name: storage; Type: SCHEMA; Schema: -; Owner: supabase_admin --- - -CREATE SCHEMA storage; - - -ALTER SCHEMA storage OWNER TO supabase_admin; - --- --- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions; - - --- --- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions'; - - --- --- Name: pgjwt; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS pgjwt WITH SCHEMA extensions; - - --- --- Name: EXTENSION pgjwt; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION pgjwt IS 'JSON Web Token API for Postgresql'; - - --- --- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions; - - --- --- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: --- - -COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; - - --- --- Name: role(); Type: FUNCTION; Schema: auth; Owner: postgres --- - -CREATE FUNCTION auth.role() RETURNS text - LANGUAGE sql STABLE - AS $$ - select nullif(current_setting('request.jwt.claim.role', true), '')::text; -$$; - - -ALTER FUNCTION auth.role() OWNER TO postgres; - --- --- Name: uid(); Type: FUNCTION; Schema: auth; Owner: postgres --- - -CREATE FUNCTION auth.uid() RETURNS uuid - LANGUAGE sql STABLE - AS $$ - select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid; -$$; - - -ALTER FUNCTION auth.uid() OWNER TO postgres; - --- --- Name: notify_api_restart(); Type: FUNCTION; Schema: extensions; Owner: postgres --- - -CREATE FUNCTION extensions.notify_api_restart() RETURNS event_trigger - LANGUAGE plpgsql - AS $$ - BEGIN - NOTIFY ddl_command_end; - END; - $$; - - -ALTER FUNCTION extensions.notify_api_restart() OWNER TO postgres; - --- --- Name: FUNCTION notify_api_restart(); Type: COMMENT; Schema: extensions; Owner: postgres --- - -COMMENT ON FUNCTION extensions.notify_api_restart() IS 'Sends a notification to the API to restart. If your database schema has changed, this is required so that Supabase can rebuild the relationships.'; - - --- --- Name: get_auth(text); Type: FUNCTION; Schema: pgbouncer; Owner: postgres --- - -CREATE FUNCTION pgbouncer.get_auth(p_usename text) RETURNS TABLE(username text, password text) - LANGUAGE plpgsql SECURITY DEFINER - AS $$ -BEGIN - RAISE WARNING 'PgBouncer auth request: %', p_usename; - - RETURN QUERY - SELECT usename::TEXT, passwd::TEXT FROM pg_catalog.pg_shadow - WHERE usename = p_usename; -END; -$$; - - -ALTER FUNCTION pgbouncer.get_auth(p_usename text) OWNER TO postgres; - --- --- Name: extension(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.extension(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -_filename text; -BEGIN - select string_to_array(name, '/') into _parts; - select _parts[array_length(_parts,1)] into _filename; - -- @todo return the last part instead of 2 - return split_part(_filename, '.', 2); -END -$$; - - -ALTER FUNCTION storage.extension(name text) OWNER TO supabase_storage_admin; - --- --- Name: filename(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.filename(name text) RETURNS text - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[array_length(_parts,1)]; -END -$$; - - -ALTER FUNCTION storage.filename(name text) OWNER TO supabase_storage_admin; - --- --- Name: foldername(text); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.foldername(name text) RETURNS text[] - LANGUAGE plpgsql - AS $$ -DECLARE -_parts text[]; -BEGIN - select string_to_array(name, '/') into _parts; - return _parts[1:array_length(_parts,1)-1]; -END -$$; - - -ALTER FUNCTION storage.foldername(name text) OWNER TO supabase_storage_admin; - --- --- Name: get_size_by_bucket(); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.get_size_by_bucket() RETURNS TABLE(size bigint, bucket_id text) - LANGUAGE plpgsql - AS $$ -BEGIN - return query - select sum((metadata->>'size')::int) as size, obj.bucket_id - from "storage".objects as obj - group by obj.bucket_id; -END -$$; - - -ALTER FUNCTION storage.get_size_by_bucket() OWNER TO supabase_storage_admin; - --- --- Name: search(text, text, integer, integer, integer); Type: FUNCTION; Schema: storage; Owner: supabase_storage_admin --- - -CREATE FUNCTION storage.search(prefix text, bucketname text, limits integer DEFAULT 100, levels integer DEFAULT 1, offsets integer DEFAULT 0) RETURNS TABLE(name text, id uuid, updated_at timestamp with time zone, created_at timestamp with time zone, last_accessed_at timestamp with time zone, metadata jsonb) - LANGUAGE plpgsql - AS $$ -BEGIN - return query - with files_folders as ( - select path_tokens[levels] as folder - from storage.objects - where objects.name ilike prefix || '%' - and bucket_id = bucketname - GROUP by folder - limit limits - offset offsets - ) - select files_folders.folder as name, objects.id, objects.updated_at, objects.created_at, objects.last_accessed_at, objects.metadata from files_folders - left join storage.objects - on prefix || files_folders.folder = objects.name - where objects.id is null or objects.bucket_id=bucketname; -END -$$; - - -ALTER FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) OWNER TO supabase_storage_admin; - -SET default_tablespace = ''; - -SET default_table_access_method = heap; - --- --- Name: audit_log_entries; Type: TABLE; Schema: auth; Owner: postgres --- - -CREATE TABLE auth.audit_log_entries ( - instance_id uuid, - id uuid NOT NULL, - payload json, - created_at timestamp with time zone -); - - -ALTER TABLE auth.audit_log_entries OWNER TO postgres; - --- --- Name: TABLE audit_log_entries; Type: COMMENT; Schema: auth; Owner: postgres --- - -COMMENT ON TABLE auth.audit_log_entries IS 'Auth: Audit trail for user actions.'; - - --- --- Name: instances; Type: TABLE; Schema: auth; Owner: postgres --- - -CREATE TABLE auth.instances ( - id uuid NOT NULL, - uuid uuid, - raw_base_config text, - created_at timestamp with time zone, - updated_at timestamp with time zone -); - - -ALTER TABLE auth.instances OWNER TO postgres; - --- --- Name: TABLE instances; Type: COMMENT; Schema: auth; Owner: postgres --- - -COMMENT ON TABLE auth.instances IS 'Auth: Manages users across multiple sites.'; - - --- --- Name: refresh_tokens; Type: TABLE; Schema: auth; Owner: postgres --- - -CREATE TABLE auth.refresh_tokens ( - instance_id uuid, - id bigint NOT NULL, - token character varying(255), - user_id character varying(255), - revoked boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone -); - - -ALTER TABLE auth.refresh_tokens OWNER TO postgres; - --- --- Name: TABLE refresh_tokens; Type: COMMENT; Schema: auth; Owner: postgres --- - -COMMENT ON TABLE auth.refresh_tokens IS 'Auth: Store of tokens used to refresh JWT tokens once they expire.'; - - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE; Schema: auth; Owner: postgres --- - -CREATE SEQUENCE auth.refresh_tokens_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE auth.refresh_tokens_id_seq OWNER TO postgres; - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE OWNED BY; Schema: auth; Owner: postgres --- - -ALTER SEQUENCE auth.refresh_tokens_id_seq OWNED BY auth.refresh_tokens.id; - - --- --- Name: schema_migrations; Type: TABLE; Schema: auth; Owner: postgres --- - -CREATE TABLE auth.schema_migrations ( - version character varying(255) NOT NULL -); - - -ALTER TABLE auth.schema_migrations OWNER TO postgres; - --- --- Name: TABLE schema_migrations; Type: COMMENT; Schema: auth; Owner: postgres --- - -COMMENT ON TABLE auth.schema_migrations IS 'Auth: Manages updates to the auth system.'; - - --- --- Name: users; Type: TABLE; Schema: auth; Owner: postgres --- - -CREATE TABLE auth.users ( - instance_id uuid, - id uuid NOT NULL, - aud character varying(255), - role character varying(255), - email character varying(255), - encrypted_password character varying(255), - confirmed_at timestamp with time zone, - invited_at timestamp with time zone, - confirmation_token character varying(255), - confirmation_sent_at timestamp with time zone, - recovery_token character varying(255), - recovery_sent_at timestamp with time zone, - email_change_token character varying(255), - email_change character varying(255), - email_change_sent_at timestamp with time zone, - last_sign_in_at timestamp with time zone, - raw_app_meta_data jsonb, - raw_user_meta_data jsonb, - is_super_admin boolean, - created_at timestamp with time zone, - updated_at timestamp with time zone -); - - -ALTER TABLE auth.users OWNER TO postgres; - --- --- Name: TABLE users; Type: COMMENT; Schema: auth; Owner: postgres --- - -COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure schema.'; - - --- --- Name: comments; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.comments ( - id integer NOT NULL, - "postId" integer NOT NULL, - "user" text NOT NULL, - "postedAt" timestamp with time zone DEFAULT now() NOT NULL, - comment text NOT NULL -); - - -ALTER TABLE public.comments OWNER TO supabase_admin; - --- --- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.comments ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( - SEQUENCE NAME public.comments_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: followers; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.followers ( - id integer NOT NULL, - follower text NOT NULL, - following text NOT NULL -); - - -ALTER TABLE public.followers OWNER TO supabase_admin; - --- --- Name: followers_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.followers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( - SEQUENCE NAME public.followers_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: likes; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.likes ( - id integer NOT NULL, - "postId" integer NOT NULL, - "user" text NOT NULL -); - - -ALTER TABLE public.likes OWNER TO supabase_admin; - --- --- Name: likes_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.likes ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( - SEQUENCE NAME public.likes_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: posts; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.posts ( - "postId" integer NOT NULL, - "imageUrl" text NOT NULL, - "user" text NOT NULL, - caption text, - "postedAt" timestamp with time zone DEFAULT now() NOT NULL -); - - -ALTER TABLE public.posts OWNER TO supabase_admin; - --- --- Name: posts_postId_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin --- - -ALTER TABLE public.posts ALTER COLUMN "postId" ADD GENERATED BY DEFAULT AS IDENTITY ( - SEQUENCE NAME public."posts_postId_seq" - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1 -); - - --- --- Name: users; Type: TABLE; Schema: public; Owner: supabase_admin --- - -CREATE TABLE public.users ( - username text NOT NULL, - name text NOT NULL, - bio text, - "profilePic" text, - email text NOT NULL -); - - -ALTER TABLE public.users OWNER TO supabase_admin; - --- --- Name: TABLE users; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON TABLE public.users IS 'Users'; - - --- --- Name: COLUMN users.name; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.users.name IS 'Name'; - - --- --- Name: COLUMN users.bio; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.users.bio IS 'Bio'; - - --- --- Name: COLUMN users."profilePic"; Type: COMMENT; Schema: public; Owner: supabase_admin --- - -COMMENT ON COLUMN public.users."profilePic" IS 'Profile Picture'; - - --- --- Name: buckets; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.buckets ( - id text NOT NULL, - name text NOT NULL, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now() -); - - -ALTER TABLE storage.buckets OWNER TO supabase_storage_admin; - --- --- Name: migrations; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.migrations ( - id integer NOT NULL, - name character varying(100) NOT NULL, - hash character varying(40) NOT NULL, - executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP -); - - -ALTER TABLE storage.migrations OWNER TO supabase_storage_admin; - --- --- Name: objects; Type: TABLE; Schema: storage; Owner: supabase_storage_admin --- - -CREATE TABLE storage.objects ( - id uuid DEFAULT extensions.uuid_generate_v4() NOT NULL, - bucket_id text, - name text, - owner uuid, - created_at timestamp with time zone DEFAULT now(), - updated_at timestamp with time zone DEFAULT now(), - last_accessed_at timestamp with time zone DEFAULT now(), - metadata jsonb, - path_tokens text[] GENERATED ALWAYS AS (string_to_array(name, '/'::text)) STORED -); - - -ALTER TABLE storage.objects OWNER TO supabase_storage_admin; - --- --- Name: refresh_tokens id; Type: DEFAULT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.refresh_tokens ALTER COLUMN id SET DEFAULT nextval('auth.refresh_tokens_id_seq'::regclass); - - --- --- Data for Name: audit_log_entries; Type: TABLE DATA; Schema: auth; Owner: postgres --- - -COPY auth.audit_log_entries (instance_id, id, payload, created_at) FROM stdin; -\. - - --- --- Data for Name: instances; Type: TABLE DATA; Schema: auth; Owner: postgres --- - -COPY auth.instances (id, uuid, raw_base_config, created_at, updated_at) FROM stdin; -\. - - --- --- Data for Name: refresh_tokens; Type: TABLE DATA; Schema: auth; Owner: postgres --- - -COPY auth.refresh_tokens (instance_id, id, token, user_id, revoked, created_at, updated_at) FROM stdin; -\. - - --- --- Data for Name: schema_migrations; Type: TABLE DATA; Schema: auth; Owner: postgres --- - -COPY auth.schema_migrations (version) FROM stdin; -20171026211738 -20171026211808 -20171026211834 -20180103212743 -20180108183307 -20180119214651 -20180125194653 -\. - - --- --- Data for Name: users; Type: TABLE DATA; Schema: auth; Owner: postgres --- - -COPY auth.users (instance_id, id, aud, role, email, encrypted_password, confirmed_at, invited_at, confirmation_token, confirmation_sent_at, recovery_token, recovery_sent_at, email_change_token, email_change, email_change_sent_at, last_sign_in_at, raw_app_meta_data, raw_user_meta_data, is_super_admin, created_at, updated_at) FROM stdin; -\. - - --- --- Data for Name: comments; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -COPY public.comments (id, "postId", "user", "postedAt", comment) FROM stdin; -\. - - --- --- Data for Name: followers; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -COPY public.followers (id, follower, following) FROM stdin; -\. - - --- --- Data for Name: likes; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -COPY public.likes (id, "postId", "user") FROM stdin; -\. - - --- --- Data for Name: posts; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -COPY public.posts ("postId", "imageUrl", "user", caption, "postedAt") FROM stdin; -\. - - --- --- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: supabase_admin --- - -COPY public.users (username, name, bio, "profilePic", email) FROM stdin; -\. - - --- --- Data for Name: buckets; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - -COPY storage.buckets (id, name, owner, created_at, updated_at) FROM stdin; -\. - - --- --- Data for Name: migrations; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - -COPY storage.migrations (id, name, hash, executed_at) FROM stdin; -0 create-migrations-table e18db593bcde2aca2a408c4d1100f6abba2195df 2021-04-02 16:46:18.353491 -1 initialmigration 6ab16121fbaa08bbd11b712d05f358f9b555d777 2021-04-02 16:46:18.435633 -2 pathtoken-column 49756be03be4c17bb85fe70d4a861f27de7e49ad 2021-04-02 16:46:18.440492 -3 add-migrations-rls bb5d124c53d68635a883e399426c6a5a25fc893d 2021-04-02 16:46:18.519454 -4 add-size-functions 6d79007d04f5acd288c9c250c42d2d5fd286c54d 2021-04-02 16:46:18.525301 -5 change-column-name-in-get-size fd65688505d2ffa9fbdc58a944348dd8604d688c 2021-04-02 16:46:18.529583 -6 add-rls-to-buckets 63e2bab75a2040fee8e3fb3f15a0d26f3380e9b6 2021-04-02 16:46:18.534102 -\. - - --- --- Data for Name: objects; Type: TABLE DATA; Schema: storage; Owner: supabase_storage_admin --- - -COPY storage.objects (id, bucket_id, name, owner, created_at, updated_at, last_accessed_at, metadata) FROM stdin; -\. - - --- --- Name: refresh_tokens_id_seq; Type: SEQUENCE SET; Schema: auth; Owner: postgres --- - -SELECT pg_catalog.setval('auth.refresh_tokens_id_seq', 1, false); - - --- --- Name: comments_id_seq; Type: SEQUENCE SET; Schema: public; Owner: supabase_admin --- - -SELECT pg_catalog.setval('public.comments_id_seq', 22, true); - - --- --- Name: followers_id_seq; Type: SEQUENCE SET; Schema: public; Owner: supabase_admin --- - -SELECT pg_catalog.setval('public.followers_id_seq', 20, true); - - --- --- Name: likes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: supabase_admin --- - -SELECT pg_catalog.setval('public.likes_id_seq', 1, false); - - --- --- Name: posts_postId_seq; Type: SEQUENCE SET; Schema: public; Owner: supabase_admin --- - -SELECT pg_catalog.setval('public."posts_postId_seq"', 4, true); - - --- --- Name: audit_log_entries audit_log_entries_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.audit_log_entries - ADD CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id); - - --- --- Name: instances instances_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.instances - ADD CONSTRAINT instances_pkey PRIMARY KEY (id); - - --- --- Name: refresh_tokens refresh_tokens_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.refresh_tokens - ADD CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id); - - --- --- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.schema_migrations - ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version); - - --- --- Name: users users_email_key; Type: CONSTRAINT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_email_key UNIQUE (email); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: auth; Owner: postgres --- - -ALTER TABLE ONLY auth.users - ADD CONSTRAINT users_pkey PRIMARY KEY (id); - - --- --- Name: comments comments_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.comments - ADD CONSTRAINT comments_pkey PRIMARY KEY (id); - - --- --- Name: followers followers_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.followers - ADD CONSTRAINT followers_pkey PRIMARY KEY (id); - - --- --- Name: likes likes_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.likes - ADD CONSTRAINT likes_pkey PRIMARY KEY (id); - - --- --- Name: posts posts_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.posts - ADD CONSTRAINT posts_pkey PRIMARY KEY ("postId"); - - --- --- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.users - ADD CONSTRAINT users_pkey PRIMARY KEY (username); - - --- --- Name: buckets buckets_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets - ADD CONSTRAINT buckets_pkey PRIMARY KEY (id); - - --- --- Name: migrations migrations_name_key; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_name_key UNIQUE (name); - - --- --- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.migrations - ADD CONSTRAINT migrations_pkey PRIMARY KEY (id); - - --- --- Name: objects objects_pkey; Type: CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT objects_pkey PRIMARY KEY (id); - - --- --- Name: audit_logs_instance_id_idx; Type: INDEX; Schema: auth; Owner: postgres --- - -CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id); - - --- --- Name: refresh_tokens_instance_id_idx; Type: INDEX; Schema: auth; Owner: postgres --- - -CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id); - - --- --- Name: refresh_tokens_instance_id_user_id_idx; Type: INDEX; Schema: auth; Owner: postgres --- - -CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id); - - --- --- Name: refresh_tokens_token_idx; Type: INDEX; Schema: auth; Owner: postgres --- - -CREATE INDEX refresh_tokens_token_idx ON auth.refresh_tokens USING btree (token); - - --- --- Name: users_instance_id_email_idx; Type: INDEX; Schema: auth; Owner: postgres --- - -CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, email); - - --- --- Name: users_instance_id_idx; Type: INDEX; Schema: auth; Owner: postgres --- - -CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id); - - --- --- Name: bname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bname ON storage.buckets USING btree (name); - - --- --- Name: bucketid_objname; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE UNIQUE INDEX bucketid_objname ON storage.objects USING btree (bucket_id, name); - - --- --- Name: name_prefix_search; Type: INDEX; Schema: storage; Owner: supabase_storage_admin --- - -CREATE INDEX name_prefix_search ON storage.objects USING btree (name text_pattern_ops); - - --- --- Name: comments comments_postId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.comments - ADD CONSTRAINT "comments_postId_fkey" FOREIGN KEY ("postId") REFERENCES public.posts("postId"); - - --- --- Name: comments comments_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.comments - ADD CONSTRAINT comments_user_fkey FOREIGN KEY ("user") REFERENCES public.users(username); - - --- --- Name: followers followers_follower_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.followers - ADD CONSTRAINT followers_follower_fkey FOREIGN KEY (follower) REFERENCES public.users(username); - - --- --- Name: followers followers_following_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.followers - ADD CONSTRAINT followers_following_fkey FOREIGN KEY (following) REFERENCES public.users(username); - - --- --- Name: likes likes_postId_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.likes - ADD CONSTRAINT "likes_postId_fkey" FOREIGN KEY ("postId") REFERENCES public.posts("postId"); - - --- --- Name: likes likes_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.likes - ADD CONSTRAINT likes_user_fkey FOREIGN KEY ("user") REFERENCES public.users(username); - - --- --- Name: posts posts_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin --- - -ALTER TABLE ONLY public.posts - ADD CONSTRAINT posts_user_fkey FOREIGN KEY ("user") REFERENCES public.users(username); - - --- --- Name: buckets buckets_owner_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.buckets - ADD CONSTRAINT buckets_owner_fkey FOREIGN KEY (owner) REFERENCES auth.users(id); - - --- --- Name: objects objects_bucketId_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT "objects_bucketId_fkey" FOREIGN KEY (bucket_id) REFERENCES storage.buckets(id); - - --- --- Name: objects objects_owner_fkey; Type: FK CONSTRAINT; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE ONLY storage.objects - ADD CONSTRAINT objects_owner_fkey FOREIGN KEY (owner) REFERENCES auth.users(id); - - --- --- Name: buckets; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.buckets ENABLE ROW LEVEL SECURITY; - --- --- Name: migrations; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.migrations ENABLE ROW LEVEL SECURITY; - --- --- Name: objects; Type: ROW SECURITY; Schema: storage; Owner: supabase_storage_admin --- - -ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY; - --- --- Name: supabase_realtime; Type: PUBLICATION; Schema: -; Owner: postgres --- - -CREATE PUBLICATION supabase_realtime FOR ALL TABLES WITH (publish = 'insert, update, delete, truncate'); - - -ALTER PUBLICATION supabase_realtime OWNER TO postgres; - --- --- Name: SCHEMA auth; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT ALL ON SCHEMA auth TO supabase_auth_admin; - - --- --- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres --- - -GRANT USAGE ON SCHEMA public TO anon; -GRANT USAGE ON SCHEMA public TO authenticated; -GRANT USAGE ON SCHEMA public TO service_role; - - --- --- Name: SCHEMA storage; Type: ACL; Schema: -; Owner: supabase_admin --- - -GRANT USAGE ON SCHEMA storage TO postgres; -GRANT USAGE ON SCHEMA storage TO anon; -GRANT USAGE ON SCHEMA storage TO authenticated; -GRANT USAGE ON SCHEMA storage TO service_role; -GRANT ALL ON SCHEMA storage TO supabase_storage_admin; - - --- --- Name: FUNCTION get_auth(p_usename text); Type: ACL; Schema: pgbouncer; Owner: postgres --- - -REVOKE ALL ON FUNCTION pgbouncer.get_auth(p_usename text) FROM PUBLIC; -GRANT ALL ON FUNCTION pgbouncer.get_auth(p_usename text) TO pgbouncer; - - --- --- Name: FUNCTION extension(name text); Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON FUNCTION storage.extension(name text) TO anon; -GRANT ALL ON FUNCTION storage.extension(name text) TO authenticated; -GRANT ALL ON FUNCTION storage.extension(name text) TO service_role; - - --- --- Name: FUNCTION filename(name text); Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON FUNCTION storage.filename(name text) TO anon; -GRANT ALL ON FUNCTION storage.filename(name text) TO authenticated; -GRANT ALL ON FUNCTION storage.filename(name text) TO service_role; - - --- --- Name: FUNCTION foldername(name text); Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON FUNCTION storage.foldername(name text) TO anon; -GRANT ALL ON FUNCTION storage.foldername(name text) TO authenticated; -GRANT ALL ON FUNCTION storage.foldername(name text) TO service_role; - - --- --- Name: FUNCTION search(prefix text, bucketname text, limits integer, levels integer, offsets integer); Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) TO anon; -GRANT ALL ON FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) TO authenticated; -GRANT ALL ON FUNCTION storage.search(prefix text, bucketname text, limits integer, levels integer, offsets integer) TO service_role; - - --- --- Name: TABLE audit_log_entries; Type: ACL; Schema: auth; Owner: postgres --- - -GRANT ALL ON TABLE auth.audit_log_entries TO supabase_auth_admin; - - --- --- Name: TABLE instances; Type: ACL; Schema: auth; Owner: postgres --- - -GRANT ALL ON TABLE auth.instances TO supabase_auth_admin; - - --- --- Name: TABLE refresh_tokens; Type: ACL; Schema: auth; Owner: postgres --- - -GRANT ALL ON TABLE auth.refresh_tokens TO supabase_auth_admin; - - --- --- Name: SEQUENCE refresh_tokens_id_seq; Type: ACL; Schema: auth; Owner: postgres --- - -GRANT ALL ON SEQUENCE auth.refresh_tokens_id_seq TO supabase_auth_admin; - - --- --- Name: TABLE schema_migrations; Type: ACL; Schema: auth; Owner: postgres --- - -GRANT ALL ON TABLE auth.schema_migrations TO supabase_auth_admin; - - --- --- Name: TABLE users; Type: ACL; Schema: auth; Owner: postgres --- - -GRANT ALL ON TABLE auth.users TO supabase_auth_admin; - - --- --- Name: TABLE comments; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.comments TO postgres; -GRANT ALL ON TABLE public.comments TO anon; -GRANT ALL ON TABLE public.comments TO authenticated; -GRANT ALL ON TABLE public.comments TO service_role; - - --- --- Name: SEQUENCE comments_id_seq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public.comments_id_seq TO postgres; -GRANT ALL ON SEQUENCE public.comments_id_seq TO anon; -GRANT ALL ON SEQUENCE public.comments_id_seq TO authenticated; -GRANT ALL ON SEQUENCE public.comments_id_seq TO service_role; - - --- --- Name: TABLE followers; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.followers TO postgres; -GRANT ALL ON TABLE public.followers TO anon; -GRANT ALL ON TABLE public.followers TO authenticated; -GRANT ALL ON TABLE public.followers TO service_role; - - --- --- Name: SEQUENCE followers_id_seq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public.followers_id_seq TO postgres; -GRANT ALL ON SEQUENCE public.followers_id_seq TO anon; -GRANT ALL ON SEQUENCE public.followers_id_seq TO authenticated; -GRANT ALL ON SEQUENCE public.followers_id_seq TO service_role; - - --- --- Name: TABLE likes; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.likes TO postgres; -GRANT ALL ON TABLE public.likes TO anon; -GRANT ALL ON TABLE public.likes TO authenticated; -GRANT ALL ON TABLE public.likes TO service_role; - - --- --- Name: SEQUENCE likes_id_seq; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public.likes_id_seq TO postgres; -GRANT ALL ON SEQUENCE public.likes_id_seq TO anon; -GRANT ALL ON SEQUENCE public.likes_id_seq TO authenticated; -GRANT ALL ON SEQUENCE public.likes_id_seq TO service_role; - - --- --- Name: TABLE posts; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.posts TO postgres; -GRANT ALL ON TABLE public.posts TO anon; -GRANT ALL ON TABLE public.posts TO authenticated; -GRANT ALL ON TABLE public.posts TO service_role; - - --- --- Name: SEQUENCE "posts_postId_seq"; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON SEQUENCE public."posts_postId_seq" TO postgres; -GRANT ALL ON SEQUENCE public."posts_postId_seq" TO anon; -GRANT ALL ON SEQUENCE public."posts_postId_seq" TO authenticated; -GRANT ALL ON SEQUENCE public."posts_postId_seq" TO service_role; - - --- --- Name: TABLE users; Type: ACL; Schema: public; Owner: supabase_admin --- - -GRANT ALL ON TABLE public.users TO postgres; -GRANT ALL ON TABLE public.users TO anon; -GRANT ALL ON TABLE public.users TO authenticated; -GRANT ALL ON TABLE public.users TO service_role; - - --- --- Name: TABLE buckets; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.buckets TO anon; -GRANT ALL ON TABLE storage.buckets TO authenticated; -GRANT ALL ON TABLE storage.buckets TO service_role; - - --- --- Name: TABLE objects; Type: ACL; Schema: storage; Owner: supabase_storage_admin --- - -GRANT ALL ON TABLE storage.objects TO anon; -GRANT ALL ON TABLE storage.objects TO authenticated; -GRANT ALL ON TABLE storage.objects TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON SEQUENCES FROM supabase_admin; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM PUBLIC; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM PUBLIC; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON FUNCTIONS FROM supabase_admin; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin --- - -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public REVOKE ALL ON TABLES FROM supabase_admin; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO postgres; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE supabase_admin IN SCHEMA public GRANT ALL ON TABLES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON SEQUENCES TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage REVOKE ALL ON FUNCTIONS FROM PUBLIC; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON FUNCTIONS TO service_role; - - --- --- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: storage; Owner: postgres --- - -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO anon; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO authenticated; -ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA storage GRANT ALL ON TABLES TO service_role; - - --- --- Name: api_restart; Type: EVENT TRIGGER; Schema: -; Owner: postgres --- - -CREATE EVENT TRIGGER api_restart ON ddl_command_end - EXECUTE FUNCTION extensions.notify_api_restart(); - - -ALTER EVENT TRIGGER api_restart OWNER TO postgres; - --- --- PostgreSQL database dump complete --- - diff --git a/package.json b/package.json index a177cd3..f1f6786 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "instaclone", "version": "0.0.1", "private": true, + "author": "NiketanG", "scripts": { "android": "react-native run-android", "android:release": "cd android && ./gradlew assembleRelease && cd ../ && mv android/app/build/outputs/apk/release/app-release.apk build/app-release.apk && adb install build/app-release.apk ", diff --git a/src/app/Routes/ExploreStack.tsx b/src/app/Routes/ExploreStack.tsx index 5cb80cc..d252415 100644 --- a/src/app/Routes/ExploreStack.tsx +++ b/src/app/Routes/ExploreStack.tsx @@ -1,15 +1,24 @@ import React from "react"; -import { NavigationContainer } from "@react-navigation/native"; +import { NavigationContainer, RouteProp } from "@react-navigation/native"; import { createStackNavigator } from "@react-navigation/stack"; -import { ExploreStackNavigationParams } from "../types/navigation"; +import { + ExploreStackNavigationParams, + TabNavigationParams, +} from "../types/navigation"; import Explore from "../Screens/Explore"; import PostDetail from "../Screens/Post"; import ProfilePageStack from "./ProfileStack"; import Comments from "../Screens/Comments"; +import { BottomTabNavigationProp } from "@react-navigation/bottom-tabs"; const Stack = createStackNavigator(); -const ExplorePageStack = () => { +type Props = { + route: RouteProp; + navigation: BottomTabNavigationProp; +}; + +const ExplorePageStack: React.FC = ({ route }) => { return ( @@ -19,7 +28,9 @@ const ExplorePageStack = () => { diff --git a/src/app/Routes/HomeStack.tsx b/src/app/Routes/HomeStack.tsx index b67000f..7e3464b 100644 --- a/src/app/Routes/HomeStack.tsx +++ b/src/app/Routes/HomeStack.tsx @@ -17,16 +17,10 @@ type Props = { navigation: BottomTabNavigationProp; }; -const HomePageStack: React.FC = ({ route }) => ( +const HomePageStack: React.FC = () => ( - + diff --git a/src/app/Routes/Navigation.tsx b/src/app/Routes/Navigation.tsx index 20f41c1..5782d76 100644 --- a/src/app/Routes/Navigation.tsx +++ b/src/app/Routes/Navigation.tsx @@ -29,7 +29,6 @@ type Props = { route: RouteProp; navigation: MaterialTopTabNavigationProp; }; - export const TabNavigation: React.FC = ({ navigation }) => { const { colors, dark } = useTheme(); return ( @@ -59,9 +58,6 @@ export const TabNavigation: React.FC = ({ navigation }) => { ( ; @@ -19,7 +20,7 @@ type Props = { const Stack = createStackNavigator(); -const ProfilePageStack = (props: Props) => { +const ProfilePageStack: React.FC = ({ route }) => { return ( @@ -28,7 +29,7 @@ const ProfilePageStack = (props: Props) => { component={Profile} initialParams={{ isCurrentUser: true, - ...props.route.params, + ...route.params, }} /> { component={Followers} initialParams={{ isCurrentUser: true, - ...props.route.params, + ...route.params, }} /> { component={Following} initialParams={{ isCurrentUser: true, - ...props.route.params, + ...route.params, }} /> + ); diff --git a/src/app/Screens/Home/index.tsx b/src/app/Screens/Home/index.tsx index 731375b..a2a0932 100644 --- a/src/app/Screens/Home/index.tsx +++ b/src/app/Screens/Home/index.tsx @@ -33,8 +33,7 @@ const Home: React.FC = observer(({ route }) => { const { height } = useWindowDimensions(); - const openMessages = () => - route.params.rootNavigation?.navigate("Messages"); + const openMessages = () => {}; const [openedModalData, setOpenedModalData] = useState<{ modalType: "MENU" | "SHARE"; diff --git a/src/app/Screens/Profile/index.tsx b/src/app/Screens/Profile/index.tsx index d52d676..24d7286 100644 --- a/src/app/Screens/Profile/index.tsx +++ b/src/app/Screens/Profile/index.tsx @@ -25,15 +25,12 @@ import { } from "react-native-paper"; import Icon from "react-native-vector-icons/Ionicons"; import { UserAvatar } from "../../Components/UserAvatar"; -import { - ExploreStackNavigationParams, - ProfileStackParams, -} from "../../types/navigation"; +import { ProfileStackParams } from "../../types/navigation"; import { AppContext } from "../../utils/appContext"; import useUser from "../../utils/useUser"; type Props = { - route: RouteProp; + route: RouteProp; navigation: StackNavigationProp; }; @@ -49,6 +46,13 @@ const Profile: React.FC = observer(({ navigation, route }) => { const { username: savedUsername } = useContext(AppContext); + const openMessage = () => { + if (route.params.username) + navigation.navigate("Messages", { + username: route.params.username, + }); + }; + const { user, posts, @@ -288,9 +292,7 @@ const Profile: React.FC = observer(({ navigation, route }) => { borderColor: colors.text, marginTop: 16, }} - onPress={() => - navigation.navigate("EditProfile") - } + onPress={openMessage} > Message @@ -372,7 +374,6 @@ const Profile: React.FC = observer(({ navigation, route }) => { }, postId: post.postId, postList: posts, - rootNavigation: navigation, }); }} > diff --git a/src/app/types/navigation.ts b/src/app/types/navigation.ts index 88c9ff2..cd9e189 100644 --- a/src/app/types/navigation.ts +++ b/src/app/types/navigation.ts @@ -44,12 +44,7 @@ export type SwipeTabNavigationParams = { Messages: undefined; }; export type HomeStackNavigationParams = { - Home: { - rootNavigation: MaterialTopTabNavigationProp< - SwipeTabNavigationParams, - "Tabs" - >; - }; + Home: undefined; Comments: CommentsPageParams; Profile: ProfilePageProps & { goBack: () => void; @@ -57,7 +52,12 @@ export type HomeStackNavigationParams = { }; export type ProfileStackParams = { - ProfilePage: ProfilePageProps; + Messages: { + username: string; + }; + ProfilePage: ProfilePageProps & { + goBack?: () => void; + }; Followers: ProfilePageProps & { followers: Follower[]; }; @@ -96,8 +96,8 @@ export type PostListParams = { }; postId: number; postList: Array; - rootNavigation: StackNavigationProp; }; + export type PostStackNavigationParams = { PostList: PostListParams; Comments: CommentsPageParams; @@ -105,12 +105,7 @@ export type PostStackNavigationParams = { }; export type TabNavigationParams = { - Home: { - rootNavigation: MaterialTopTabNavigationProp< - SwipeTabNavigationParams, - "Tabs" - >; - }; + Home: undefined; Explore: undefined; // Activity: undefined; New: undefined;