CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE TABLE "USER" (
"id" uuid PRIMARY KEY NOT NULL DEFAULT (gen_random_uuid()),
"name" varchar(50) NOT NULL,
"email" varchar(320) UNIQUE NOT NULL,
"role" varchar(20) NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"updated_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE TABLE "SKILL" (
"id" uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
"name" varchar(50) UNIQUE NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
INSERT INTO "SKILL" (name) VALUES ('重訓'), ('瑜伽'), ('有氧運動'), ('復健訓練');
CREATE TABLE "COACH" (
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
"user_id" uuid NOT NULL REFERENCES "USER"(id),
"experience_years" integer,
"description" text,
"profile_image_url" varchar(2048),
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"updated_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
UNIQUE("user_id")
);
CREATE TABLE "COACH_LINK_SKILL" (
"coach_id" uuid NOT NULL REFERENCES "COACH"(id),
"skill_id" uuid NOT NULL REFERENCES "SKILL"(id),
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
PRIMARY KEY ("coach_id", "skill_id")
);
CREATE TABLE "CREDIT_PACKAGE" (
"id" serial PRIMARY KEY,
"name" varchar(50) NOT NULL,
"credit_amount" integer NOT NULL,
"price" numeric(10,2) NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE TABLE "CREDIT_PURCHASE" (
"id" uuid PRIMARY KEY NOT NULL DEFAULT (gen_random_uuid()),
"user_id" uuid NOT NULL REFERENCES "USER"(id),
"credit_package_id" integer NOT NULL REFERENCES "CREDIT_PACKAGE"(id),
"purchased_credits" integer NOT NULL,
"price_paid" numeric(10,2) NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"purchase_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE TABLE "COURSE" (
"id" serial PRIMARY KEY,
"user_id" uuid NOT NULL REFERENCES "USER"(id),
"skill_id" uuid NOT NULL REFERENCES "SKILL"(id),
"name" varchar(100) NOT NULL,
"description" text,
"start_at" timestamp NOT NULL,
"end_at" timestamp NOT NULL,
"max_participants" integer NOT NULL,
"meeting_url" varchar(2048) NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE TABLE "COURSE_BOOKING" (
"id" uuid PRIMARY KEY NOT NULL DEFAULT (gen_random_uuid()),
"user_id" uuid NOT NULL REFERENCES "USER"(id),
"course_id" integer NOT NULL REFERENCES "COURSE"(id),
"booking_at" timestamp NOT NULL,
"status" varchar(20) NOT NULL,
"join_at" timestamp,
"leave_at" timestamp,
"cancelled_at" timestamp,
"cancellation_reason" varchar(255),
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE TABLE "BLOG_POST" (
"id" uuid PRIMARY KEY NOT NULL DEFAULT (gen_random_uuid()),
"user_id" uuid NOT NULL REFERENCES "USER"(id),
"title" varchar(255) NOT NULL,
"content" text NOT NULL,
"featured_image_url" varchar(2048),
"category" varchar(20) NOT NULL,
"spend_minutes" smallint NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"updated_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
CREATE TABLE "COMMENT" (
"id" uuid PRIMARY KEY NOT NULL DEFAULT (gen_random_uuid()),
"blog_post_id" uuid NOT NULL REFERENCES "BLOG_POST"(id),
"user_id" uuid NOT NULL REFERENCES "USER"(id),
"content" text NOT NULL,
"created_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP),
"updated_at" timestamp NOT NULL DEFAULT (CURRENT_TIMESTAMP)
);
使用 Discord、ZOOM、GoogleMeet 來討論,組員沒麥克風也可以一個人分享畫面,其他組員用文字討論,解答此問題集
May 12, 2025使用 Discord、ZOOM 來討論,組員沒麥克風也可以一個人分享畫面,其他組員用文字討論,解答此問題集
May 12, 2025請複製 (右下角 fork)這個範例,將重複的部分(.col-lg-6)拆分為元件,並使用 props 讓呈現結果相同。
May 11, 2025昨天已經了解要如何使用 props 傳遞資料,今天來練習一個常用的技巧,也就是將陣列資料使用 .map 一一傳到元件做使用。用一個簡單的範例如下:
May 9, 2025or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up