Skip to content

Commit

Permalink
feat: finished settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
conradbekondo committed Jan 9, 2025
2 parents 26eb980 + ca2be4d commit d46d9d8
Show file tree
Hide file tree
Showing 120 changed files with 17,962 additions and 463 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/branch-deploys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
- name: Migrate Database Schema
run: pnpm migrate.staging
- name: Build ⚙️ & Deploy ⬆️
run: netlify deploy --alias="staging" --build --context deploy-preview --message="${{ github.event.head_commit.message }}"
run: netlify deploy --alias="staging" --build --context branch-deploy --message="${{ github.event.head_commit.message }}"
12 changes: 12 additions & 0 deletions db/migrations/0005_hard_overlord.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CREATE TYPE "public"."theme_pref" AS ENUM('system', 'dark', 'light');--> statement-breakpoint
CREATE TABLE "user_prefs" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now(),
"user" bigint NOT NULL,
"country" varchar(2) NOT NULL,
"theme" "theme_pref" DEFAULT 'light',
"currency" varchar(3) NOT NULL
);
--> statement-breakpoint
ALTER TABLE "user_prefs" ADD CONSTRAINT "user_prefs_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
2 changes: 2 additions & 0 deletions db/migrations/0006_aromatic_captain_flint.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "account_transactions" ADD COLUMN "notes" text;--> statement-breakpoint
ALTER TABLE "wallet_transactions" ADD COLUMN "notes" text;
1 change: 1 addition & 0 deletions db/migrations/0007_grey_centennial.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "user_prefs" ADD COLUMN "language" varchar(2) NOT NULL;
1 change: 1 addition & 0 deletions db/migrations/0008_soft_the_call.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "user_prefs" ALTER COLUMN "theme" SET NOT NULL;
13 changes: 13 additions & 0 deletions db/migrations/0009_sticky_zaran.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TYPE "public"."account_connection_providers" AS ENUM('telegram');--> statement-breakpoint
CREATE TABLE "account_connections" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now(),
"user" bigint NOT NULL,
"provider" "account_connection_providers" NOT NULL,
"params" jsonb NOT NULL,
"is_valid" boolean DEFAULT true
);
--> statement-breakpoint
ALTER TABLE "account_transactions" RENAME COLUMN "payment_method_extras" TO "params";--> statement-breakpoint
ALTER TABLE "account_connections" ADD CONSTRAINT "account_connections_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
7 changes: 7 additions & 0 deletions db/migrations/0010_clever_ultimo.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TYPE "public"."account_connection_status" AS ENUM('active', 'inactive', 'reconnect_required');--> statement-breakpoint
ALTER TABLE "account_transactions" RENAME TO "payment_transactions";--> statement-breakpoint
ALTER TABLE "wallet_transactions" DROP CONSTRAINT "wallet_transactions_account_transaction_account_transactions_id_fk";
--> statement-breakpoint
ALTER TABLE "account_connections" ADD COLUMN "status" "account_connection_status" DEFAULT 'active' NOT NULL;--> statement-breakpoint
ALTER TABLE "wallet_transactions" ADD CONSTRAINT "wallet_transactions_account_transaction_payment_transactions_id_fk" FOREIGN KEY ("account_transaction") REFERENCES "public"."payment_transactions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "account_connections" DROP COLUMN "is_valid";
3 changes: 3 additions & 0 deletions db/migrations/0011_worried_colonel_america.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE "account_connections" DROP CONSTRAINT "account_connections_user_users_id_fk";
--> statement-breakpoint
ALTER TABLE "account_connections" ADD CONSTRAINT "account_connections_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
18 changes: 18 additions & 0 deletions db/migrations/0012_naive_silvermane.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CREATE TABLE "verification_codes" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"window" interval NOT NULL,
"code" varchar(6) NOT NULL,
"confirmed_at" timestamp,
"data" jsonb,
CONSTRAINT "verification_codes_code_unique" UNIQUE("code")
);
--> statement-breakpoint
CREATE VIEW "public"."vw_verification_codes" AS (select "code", "created_at",
("created_at" + "window")::TIMESTAMP
as "expires_at",
(CASE
WHEN "confirmed_at" IS NOT NULL THEN true
ELSE NOW() > ("created_at" + "window")
END)::BOOlEAN
as "is_expired", "data" from "verification_codes");
13 changes: 13 additions & 0 deletions db/migrations/0013_orange_maverick.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DROP VIEW "public"."vw_verification_codes";--> statement-breakpoint
ALTER TABLE "verification_codes" DROP CONSTRAINT "verification_codes_code_unique";--> statement-breakpoint
ALTER TABLE "verification_codes" ADD COLUMN "hash" varchar(32) NOT NULL;--> statement-breakpoint
ALTER TABLE "verification_codes" DROP COLUMN "code";--> statement-breakpoint
ALTER TABLE "verification_codes" ADD CONSTRAINT "verification_codes_hash_unique" UNIQUE("hash");--> statement-breakpoint
CREATE VIEW "public"."vw_verification_codes" AS (select "hash", "created_at",
("created_at" + "window")::TIMESTAMP
as "expires_at",
(CASE
WHEN "confirmed_at" IS NOT NULL THEN true
ELSE NOW() > ("created_at" + "window")
END)::BOOlEAN
as "is_expired", "data" from "verification_codes");
4 changes: 4 additions & 0 deletions db/migrations/0014_windy_masked_marvel.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE "account_connections" DROP CONSTRAINT "account_connections_user_users_id_fk";
--> statement-breakpoint
ALTER TABLE "user_prefs" ALTER COLUMN "theme" SET DEFAULT 'system';--> statement-breakpoint
ALTER TABLE "account_connections" ADD COLUMN "provider_id" varchar(255) NOT NULL;
1 change: 1 addition & 0 deletions db/migrations/0015_salty_aqueduct.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "account_connections" ADD CONSTRAINT "account_connections_user_users_id_fk" FOREIGN KEY ("user") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
1 change: 1 addition & 0 deletions db/migrations/0016_wakeful_sheva_callister.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "user_prefs" ALTER COLUMN "theme" SET DEFAULT 'light';
1 change: 1 addition & 0 deletions db/migrations/0017_careless_kingpin.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TYPE "public"."payment_methods" RENAME TO "payment_methods_types";
13 changes: 13 additions & 0 deletions db/migrations/0018_ordinary_amphibian.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TYPE "public"."payment_method_status" AS ENUM('active', 'inactive', 're-connection required');--> statement-breakpoint
ALTER TYPE "public"."payment_methods_types" RENAME TO "payment_method_provider";--> statement-breakpoint
CREATE TABLE "payment_methods" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"provider" "payment_method_provider" NOT NULL,
"params" jsonb NOT NULL,
"status" "payment_method_status" DEFAULT 'active' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"owner" bigint NOT NULL
);
--> statement-breakpoint
ALTER TABLE "payment_methods" ADD CONSTRAINT "payment_methods_owner_users_id_fk" FOREIGN KEY ("owner") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
1 change: 1 addition & 0 deletions db/migrations/0019_chubby_cassandra_nova.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE UNIQUE INDEX "payment_methods_provider_owner_index" ON "payment_methods" USING btree ("provider","owner");
12 changes: 12 additions & 0 deletions db/migrations/0020_steep_azazel.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ALTER TABLE "campaign_publications" DROP CONSTRAINT "campaign_publications_campaign_campaigns_id_fk";
--> statement-breakpoint
ALTER TABLE "campaigns" DROP CONSTRAINT "campaigns_created_by_users_id_fk";
--> statement-breakpoint
ALTER TABLE "payment_methods" DROP CONSTRAINT "payment_methods_owner_users_id_fk";
--> statement-breakpoint
ALTER TABLE "wallets" DROP CONSTRAINT "wallets_owned_by_users_id_fk";
--> statement-breakpoint
ALTER TABLE "campaign_publications" ADD CONSTRAINT "campaign_publications_campaign_campaigns_id_fk" FOREIGN KEY ("campaign") REFERENCES "public"."campaigns"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "campaigns" ADD CONSTRAINT "campaigns_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "payment_methods" ADD CONSTRAINT "payment_methods_owner_users_id_fk" FOREIGN KEY ("owner") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "wallets" ADD CONSTRAINT "wallets_owned_by_users_id_fk" FOREIGN KEY ("owned_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;
Loading

0 comments on commit d46d9d8

Please sign in to comment.