diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/Fuxi.iml b/.idea/Fuxi.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/Fuxi.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..60dc64b --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..244877a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..9ee9727 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/application/app.vue b/application/app.vue index dc69dd3..734c653 100644 --- a/application/app.vue +++ b/application/app.vue @@ -1,13 +1,15 @@ diff --git a/application/bun.lockb b/application/bun.lockb index 705a14e..f6040fb 100755 Binary files a/application/bun.lockb and b/application/bun.lockb differ diff --git a/application/components/problems/list.vue b/application/components/problem/list.vue similarity index 100% rename from application/components/problems/list.vue rename to application/components/problem/list.vue diff --git a/application/components/problem/solution/program.vue b/application/components/problem/solution/program.vue new file mode 100644 index 0000000..b802c0a --- /dev/null +++ b/application/components/problem/solution/program.vue @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/application/package.json b/application/package.json index 545cafd..32024a1 100644 --- a/application/package.json +++ b/application/package.json @@ -22,6 +22,7 @@ "vue-router": "^4.2.5" }, "dependencies": { + "@guolao/vue-monaco-editor": "^1.4.1", "@ibm/plex": "^6.3.0", "@nuxtjs/mdc": "^0.2.8", "@supabase/supabase-js": "^2.39.0", diff --git a/application/pages/about.vue b/application/pages/about.vue new file mode 100644 index 0000000..3aabd92 --- /dev/null +++ b/application/pages/about.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/application/pages/challenges/[id].vue b/application/pages/challenges/[id].vue new file mode 100644 index 0000000..684759b --- /dev/null +++ b/application/pages/challenges/[id].vue @@ -0,0 +1,116 @@ + + + + + diff --git a/application/pages/index.vue b/application/pages/index.vue index c216752..0728629 100644 --- a/application/pages/index.vue +++ b/application/pages/index.vue @@ -1,5 +1,5 @@ diff --git a/application/pages/problems/[id].vue b/application/pages/problems/[id].vue index 1a09c5b..623adac 100644 --- a/application/pages/problems/[id].vue +++ b/application/pages/problems/[id].vue @@ -31,22 +31,90 @@ + + diff --git a/supabase/migrations/20231210071647_profiles.sql b/supabase/migrations/20231210071647_profiles.sql index 223d2af..10173af 100644 --- a/supabase/migrations/20231210071647_profiles.sql +++ b/supabase/migrations/20231210071647_profiles.sql @@ -1,14 +1,20 @@ -create table public.profiles ( - id uuid not null references auth.users on delete cascade, - username varchar(64), - nickname varchar(256), - school int8, - primary key (id) +create table public.profiles +( + id uuid not null references auth.users on delete cascade, + username varchar(64), + nickname varchar(256), + school int8, + primary key (id) ); -alter table public.profiles enable row level security; + +alter table public.profiles + enable row level security; + create policy "Public profiles are viewable by everyone." on profiles for -select using (true); + select using (true); + create policy "Users can insert their own profile." on profiles for -insert with check (auth.uid() = id); + insert with check (auth.uid() = id); + create policy "Users can update own profile." on profiles for -update using (auth.uid() = id); \ No newline at end of file + update using (auth.uid() = id); \ No newline at end of file diff --git a/supabase/migrations/20231210071842_problems.sql b/supabase/migrations/20231210071842_problems.sql index 7007967..f05316e 100644 --- a/supabase/migrations/20231210071842_problems.sql +++ b/supabase/migrations/20231210071842_problems.sql @@ -1,30 +1,39 @@ -create table public.problems ( - id bigint generated by default as identity, - title text not null, - description text not null, - type character varying not null, - tags character varying [] null, - author uuid null, - metadata jsonb null, - is_draft boolean null default true, - is_hidden boolean null default false, - created_at timestamp with time zone null default now(), - constraint problems_pkey primary key (id), - constraint problems_author_fkey foreign key (author) references auth.users (id) +create table public.problems +( + id bigint generated by default as identity, + title text not null, + description text not null, + type character varying not null, + tags character varying[] null, + author uuid null, + metadata jsonb null, + is_draft boolean null default true, + is_hidden boolean null default false, + created_at timestamp with time zone null default now(), + constraint problems_pkey primary key (id), + constraint problems_author_fkey foreign key (author) references auth.users (id) ) tablespace pg_default; -alter table public.problems enable row level security; + +alter table public.problems + enable row level security; + create policy "Public problems are viewable by everyone." on problems for -select using (true); -create table public.problem_cases ( - id bigint generated by default as identity, - spec jsonb not null, - limitations jsonb not null, - answer jsonb not null, - problem int8 not null, - is_hidden bool not null default true, - constraint problem_cases_pkey primary key (id), - constraint problem_cases_author_fkey foreign key (problem) references public.problems (id) + select using (true); + +create table public.problem_cases +( + id bigint generated by default as identity, + spec jsonb not null, + limitations jsonb not null, + answer jsonb not null, + problem int8 not null, + is_hidden bool not null default true, + constraint problem_cases_pkey primary key (id), + constraint problem_cases_author_fkey foreign key (problem) references public.problems (id) ) tablespace pg_default; -alter table public.problem_cases enable row level security; + +alter table public.problem_cases + enable row level security; + create policy "Public problem cases are viewable by everyone." on problem_cases for -select using (is_hidden = false); \ No newline at end of file + select using (is_hidden = false); \ No newline at end of file diff --git a/supabase/migrations/20231210135930_challenges.sql b/supabase/migrations/20231210135930_challenges.sql index 63bc3bb..ab57fb1 100644 --- a/supabase/migrations/20231210135930_challenges.sql +++ b/supabase/migrations/20231210135930_challenges.sql @@ -1,14 +1,36 @@ -create table public.challenges ( - id bigint generated by default as identity, - answers jsonb not null, - details jsonb not null, - author uuid not null, - problem int8 not null, - status varchar(256) not null, - created_at timestamp with time zone null default now(), - constraint challenges_pkey primary key (id), - constraint challenges_author_fkey foreign key (author) references auth.users (id), - constraint challenges_problem_fkey foreign key (problem) references public.problems (id) +create table public.challenges +( + id bigint generated by default as identity, + answers jsonb not null, + details jsonb not null, + author uuid not null, + problem int8 not null, + status varchar(256) not null, + created_at timestamp with time zone null default now(), + constraint challenges_pkey primary key (id), + constraint challenges_author_fkey foreign key (author) references auth.users (id), + constraint challenges_problem_fkey foreign key (problem) references public.problems (id) ) tablespace pg_default; + alter table public.challenges enable row level security; -create policy "The challagers can see their challenges" on "public"."challenges" for select to public using (auth.uid() = author) with check (true) \ No newline at end of file + +create +policy "Enable insert for everyone" on "public"."challenges" +as permissive for insert +to public +with check (true); + +create +policy "Enable read access for users' own items" on "public"."challenges" +as permissive for +select + to public + using (author = auth.uid()); + +create +policy "Enable update access for users' own items" on "public"."challenges" +as permissive for +update + to public + using (author = auth.uid()) +with check (author = auth.uid()) \ No newline at end of file