@@ -26,5 +26,9 @@ import { NCard, NList, NListItem, NThing, NTag } from "naive-ui";
const client = useSupabaseClient();
-const { data: problems } = await client.from("problems").select(`*`).limit(20);
+const { data: problems } = await client.from("problems").select
("*").limit(20);
+
+function jump(item: any) {
+ navigateTo(`/problems/${item.id}`)
+}
diff --git a/application/nuxt.config.ts b/application/nuxt.config.ts
index e532a34..c938a20 100644
--- a/application/nuxt.config.ts
+++ b/application/nuxt.config.ts
@@ -1,24 +1,22 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
- modules: ["@unocss/nuxt", '@pinia/nuxt', '@nuxtjs/supabase'],
+ modules: ["@unocss/nuxt", "@pinia/nuxt", "@nuxtjs/supabase", "@nuxtjs/mdc"],
+ app: {
+ head: {
+ title: "Fuxi Programming",
+ titleTemplate: "%s | Fuxi",
+ },
+ },
build: {
transpile:
- process.env.NODE_ENV === 'production'
- ? [
- 'naive-ui',
- 'vueuc',
- '@css-render/vue3-ssr',
- '@juggle/resize-observer'
- ]
- : ['@juggle/resize-observer']
+ process.env.NODE_ENV === "production"
+ ? ["naive-ui", "vueuc", "@css-render/vue3-ssr", "@juggle/resize-observer"]
+ : ["@juggle/resize-observer"],
},
vite: {
optimizeDeps: {
- include:
- process.env.NODE_ENV === 'development'
- ? ['naive-ui', 'vueuc', 'date-fns-tz/formatInTimeZone']
- : []
- }
- }
-})
\ No newline at end of file
+ include: process.env.NODE_ENV === "development" ? ["naive-ui", "vueuc", "date-fns-tz/formatInTimeZone"] : [],
+ },
+ },
+});
diff --git a/application/package.json b/application/package.json
index 3c860b7..545cafd 100644
--- a/application/package.json
+++ b/application/package.json
@@ -23,6 +23,8 @@
},
"dependencies": {
"@ibm/plex": "^6.3.0",
- "@supabase/supabase-js": "^2.39.0"
+ "@nuxtjs/mdc": "^0.2.8",
+ "@supabase/supabase-js": "^2.39.0",
+ "prismjs": "^1.29.0"
}
}
diff --git a/application/pages/problems/[id].vue b/application/pages/problems/[id].vue
new file mode 100644
index 0000000..1a09c5b
--- /dev/null
+++ b/application/pages/problems/[id].vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+ {{ problem?.title }}
+
+
+ {{ problem?.type }}
+
+
+
+
+
+
+
+
+
+
+
+
+
Example Input
+
{{ example?.spec?.stdin }}
+
本题无输入
+
+
+
Example Output
+
{{ example?.answer?.stdout }}
+
本题无输出
+
+
+
+
+
+
+
+
+
diff --git a/supabase/migrations/20231210071647_profiles.sql b/supabase/migrations/20231210071647_profiles.sql
index c2ee6ec..223d2af 100644
--- a/supabase/migrations/20231210071647_profiles.sql
+++ b/supabase/migrations/20231210071647_profiles.sql
@@ -2,18 +2,13 @@ create table public.profiles (
id uuid not null references auth.users on delete cascade,
username varchar(64),
nickname varchar(256),
- school_id int8,
-
+ school int8,
primary key (id)
);
-
alter table public.profiles enable row level security;
-
-create policy "Public profiles are viewable by everyone." on profiles
- for select using (true);
-
-create policy "Users can insert their own profile." on profiles
- for 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
+create policy "Public profiles are viewable by everyone." on profiles for
+select using (true);
+create policy "Users can insert their own profile." on profiles for
+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
diff --git a/supabase/migrations/20231210071842_problems.sql b/supabase/migrations/20231210071842_problems.sql
index e956f0e..7007967 100644
--- a/supabase/migrations/20231210071842_problems.sql
+++ b/supabase/migrations/20231210071842_problems.sql
@@ -1,19 +1,30 @@
-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,
- 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;
-
+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;
-
-create policy "Public problems are viewable by everyone." on problems
- for select using (true);
\ No newline at end of file
+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)
+) tablespace pg_default;
+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
diff --git a/supabase/migrations/20231210135930_challenges.sql b/supabase/migrations/20231210135930_challenges.sql
new file mode 100644
index 0000000..63bc3bb
--- /dev/null
+++ b/supabase/migrations/20231210135930_challenges.sql
@@ -0,0 +1,14 @@
+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