Skip to content

Commit

Permalink
Merge pull request #75 from rememberry-io/feat/rem-123-integrate-crea…
Browse files Browse the repository at this point in the history
…te-and-get-stack-on-map

Feat/rem 123 integrate create and get stack on map
  • Loading branch information
Laurin-Notemann authored Mar 5, 2024
2 parents b4772bb + 15f8291 commit 2f6981f
Show file tree
Hide file tree
Showing 107 changed files with 2,005 additions and 11,942 deletions.
166 changes: 166 additions & 0 deletions backend/drizzle/0000_glamorous_korg.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
DO $$ BEGIN
CREATE TYPE "node_type" AS ENUM('stack', 'flashcard');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "invites" (
"id" uuid DEFAULT gen_random_uuid(),
"reveiver_id" uuid,
"sender_id" uuid,
"peer_id" uuid,
"text" varchar,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "learning_data" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"node_id" uuid,
"user_id" uuid,
"times_learned" integer,
"last_learned" date,
"learning_status" integer DEFAULT 0,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "maps" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid NOT NULL,
"peer_id" uuid,
"name" varchar NOT NULL,
"description" varchar DEFAULT '' NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "media" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"flashcard_id" uuid,
"frontside_media_link" varchar,
"frontside_media_positioning" varchar,
"backside_media_link" varchar,
"backside_media_positioning" varchar,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "nodes" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"map_id" uuid NOT NULL,
"frontside" varchar NOT NULL,
"backside" varchar NOT NULL,
"x_position" double precision NOT NULL,
"y_position" double precision NOT NULL,
"parent_node_id" uuid,
"node_type" "node_type" NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "peers" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" varchar NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "session" (
"id" varchar PRIMARY KEY NOT NULL,
"user_id" uuid NOT NULL,
"expires_at" timestamp with time zone NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"username" varchar NOT NULL,
"email" varchar NOT NULL,
"password" varchar NOT NULL,
CONSTRAINT "users_username_unique" UNIQUE("username"),
CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "users_peers" (
"user_id" uuid,
"peer_id" uuid,
"is_peer_admin" boolean DEFAULT false NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "invites" ADD CONSTRAINT "invites_reveiver_id_users_id_fk" FOREIGN KEY ("reveiver_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "invites" ADD CONSTRAINT "invites_sender_id_users_id_fk" FOREIGN KEY ("sender_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "invites" ADD CONSTRAINT "invites_peer_id_peers_id_fk" FOREIGN KEY ("peer_id") REFERENCES "peers"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "learning_data" ADD CONSTRAINT "learning_data_node_id_nodes_id_fk" FOREIGN KEY ("node_id") REFERENCES "nodes"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "learning_data" ADD CONSTRAINT "learning_data_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "maps" ADD CONSTRAINT "maps_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "maps" ADD CONSTRAINT "maps_peer_id_peers_id_fk" FOREIGN KEY ("peer_id") REFERENCES "peers"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "media" ADD CONSTRAINT "media_flashcard_id_nodes_id_fk" FOREIGN KEY ("flashcard_id") REFERENCES "nodes"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "nodes" ADD CONSTRAINT "nodes_map_id_maps_id_fk" FOREIGN KEY ("map_id") REFERENCES "maps"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "nodes" ADD CONSTRAINT "nodes_parent_node_id_nodes_id_fk" FOREIGN KEY ("parent_node_id") REFERENCES "nodes"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "users_peers" ADD CONSTRAINT "users_peers_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "users_peers" ADD CONSTRAINT "users_peers_peer_id_peers_id_fk" FOREIGN KEY ("peer_id") REFERENCES "peers"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
99 changes: 0 additions & 99 deletions backend/drizzle/0000_mysterious_cargill.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0001_handy_nova.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0002_striped_violations.sql

This file was deleted.

77 changes: 0 additions & 77 deletions backend/drizzle/0003_bouncy_blizzard.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0004_colossal_clea.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0005_rich_doctor_doom.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0006_medical_colossus.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0007_glorious_angel.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0008_dusty_golden_guardian.sql

This file was deleted.

7 changes: 0 additions & 7 deletions backend/drizzle/0009_silky_aqueduct.sql

This file was deleted.

1 change: 0 additions & 1 deletion backend/drizzle/0010_normal_wolfsbane.sql

This file was deleted.

Loading

0 comments on commit 2f6981f

Please sign in to comment.