lotsa shit

This commit is contained in:
Omer Sabic 2024-05-29 21:35:18 +02:00
parent 5247feb40a
commit ac54af5610
65 changed files with 3989 additions and 3208 deletions

View File

@ -2,3 +2,6 @@ DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres
REDIS_URL=redis://127.0.0.1:6379/
PORT=8080
HOST=127.0.0.1
PUBLIC_API_URL=http://localhost:3000
FRONTEND_URL=http://localhost:3002
SITES_HOST=http://localhost:3001

View File

@ -5,8 +5,10 @@ dotenv.config()
export default {
"out": "./src/db/migrations",
"schema": "./src/db/schemas.js",
"driver": "pg",
"url": process.env.DATABASE_URL,
"dbCredentials": {
"connectionString": process.env.DATABASE_URL
}
},
"dialect": "postgresql",
"driver": "pg"
}

1212
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,9 +18,10 @@
"@types/cli-color": "^2.0.6",
"@types/node": "^20.10.4",
"@types/pg": "^8.10.9",
"@types/stripe-v3": "^3.1.33",
"cli-color": "^2.0.3",
"dotenv": "^16.3.1",
"drizzle-kit": "^0.20.6",
"drizzle-kit": "^0.20.0",
"prettier": "^3.1.1",
"tsc-alias": "^1.8.8",
"tsx": "^3.12.7",
@ -32,14 +33,16 @@
"@fastify/cors": "^8.4.2",
"@fastify/multipart": "^8.2.0",
"@fastify/oauth2": "^7.8.0",
"drizzle-orm": "^0.29.1",
"drizzle-orm": "^0.29.5",
"fastify": "^4.25.0",
"fastify-plugin": "^4.5.1",
"googleapis": "^134.0.0",
"mailtrap": "^3.3.0",
"openai": "^4.38.5",
"pg": "^8.11.3",
"redis": "^4.6.11",
"simple-get": "^4.0.1",
"stripe": "^15.7.0",
"tsc": "^2.0.4",
"zod": "^3.22.4"
},

View File

@ -11,7 +11,8 @@ export let db;
export const initDb = async () => {
const client = new Client({
connectionString: env.DATABASE_URL,
idleTimeoutMillis: 20000
idleTimeoutMillis: 10000,
ssl: false,
});
await client.connect();

View File

@ -1,43 +0,0 @@
CREATE TABLE IF NOT EXISTS "articles" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"site_id" uuid,
"content" text,
"source_video_id" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "sessions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid,
"google_code" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "sites" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid,
"name" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"google_id" text,
"name" text,
"email" text
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "articles" ADD CONSTRAINT "articles_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "sites"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_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 "sites" ADD CONSTRAINT "sites_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 $$;

View File

@ -0,0 +1,81 @@
DO $$ BEGIN
CREATE TYPE "subscription_tier" AS ENUM('enterprise', 'pro', 'basic', 'free');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "sites" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid,
"name" text,
"primary_color_hex" varchar(6) DEFAULT 'c4ced4'::character varying NOT NULL,
"secondary_color_hex" varchar(6) DEFAULT '27251f'::character varying NOT NULL,
"text_color_hex" varchar(6) DEFAULT 'ffffff'::character varying NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text,
"email" text,
"channel_id" text,
"google_id" text,
"uploads_playlist_id" text,
"subscription_tier" "subscription_tier" DEFAULT 'free' NOT NULL,
"tokens" integer DEFAULT 0 NOT NULL,
"stripe_id" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "articles" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"site_id" uuid,
"content" text,
"source_video_id" text,
"title" text,
"seo_slug" text,
"created_at" timestamp DEFAULT now(),
"is_public" boolean DEFAULT true,
"views" integer DEFAULT 0
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "sessions" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"user_id" uuid,
"google_access_token" text,
"google_refresh_token" text,
"expires_at" timestamp
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "signups" (
"email" text NOT NULL,
"site_id" uuid NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"source" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "waitlist" (
"email" text
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "sites" ADD CONSTRAINT "sites_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 "articles" ADD CONSTRAINT "articles_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "sites"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_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 "signups" ADD CONSTRAINT "signups_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "sites"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@ -1,6 +1,4 @@
ALTER TABLE "sites" ALTER COLUMN "primary_color_hex" SET DEFAULT 'c4ced4';--> statement-breakpoint
ALTER TABLE "sites" ALTER COLUMN "primary_color_hex" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "sites" ALTER COLUMN "secondary_color_hex" SET DEFAULT '27251f';--> statement-breakpoint
ALTER TABLE "sites" ALTER COLUMN "secondary_color_hex" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "sites" ALTER COLUMN "text_color_hex" SET DEFAULT 'ffffff';--> statement-breakpoint
ALTER TABLE "sites" ALTER COLUMN "text_color_hex" SET NOT NULL;
ALTER TABLE "articles" ADD CONSTRAINT "articles_site_id_seo_slug_unique" UNIQUE NULLS NOT DISTINCT("site_id","seo_slug");

View File

@ -1,6 +0,0 @@
ALTER TABLE "sessions" ADD COLUMN "google_access_token" text;--> statement-breakpoint
ALTER TABLE "sessions" ADD COLUMN "google_refresh_token" text;--> statement-breakpoint
ALTER TABLE "sessions" ADD COLUMN "expires_at" date;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "google_refresh_token" text;--> statement-breakpoint
ALTER TABLE "sessions" DROP COLUMN IF EXISTS "google_code";--> statement-breakpoint
ALTER TABLE "users" DROP COLUMN IF EXISTS "google_id";

View File

@ -0,0 +1 @@
ALTER TABLE "articles" DROP CONSTRAINT "articles_site_id_seo_slug_unique";

View File

@ -1 +0,0 @@
ALTER TABLE "users" ADD COLUMN "channel_id" text;

View File

@ -1 +0,0 @@
ALTER TABLE "users" DROP COLUMN IF EXISTS "google_refresh_token";

View File

@ -0,0 +1,2 @@
ALTER TABLE "sites" ADD COLUMN "domain" text;--> statement-breakpoint
ALTER TABLE "sites" ADD CONSTRAINT "sites_domain_unique" UNIQUE("domain");

View File

@ -1 +0,0 @@
ALTER TABLE "users" ADD COLUMN "google_id" text;

View File

@ -0,0 +1,4 @@
ALTER TABLE "sites" ADD COLUMN "send_freebie" boolean;--> statement-breakpoint
ALTER TABLE "sites" ADD COLUMN "freebie_url" text;--> statement-breakpoint
ALTER TABLE "sites" ADD COLUMN "freebie_text" text;--> statement-breakpoint
ALTER TABLE "sites" ADD COLUMN "freebie_image_url" text;

View File

@ -0,0 +1 @@
ALTER TABLE "sites" ADD COLUMN "freebie_name" text;

View File

@ -1 +0,0 @@
ALTER TABLE "users" ADD COLUMN "uploads_playlist_id" text;

View File

@ -0,0 +1,2 @@
ALTER TABLE "sites" ADD COLUMN "title" text;--> statement-breakpoint
ALTER TABLE "sites" ADD COLUMN "subtitle" text;

View File

@ -1 +0,0 @@
ALTER TABLE "sessions" ALTER COLUMN "expires_at" SET DATA TYPE timestamp;

View File

@ -1,2 +0,0 @@
ALTER TABLE "articles" ADD COLUMN "title" text;--> statement-breakpoint
ALTER TABLE "articles" ADD COLUMN "seo_slug" text;

View File

@ -0,0 +1 @@
ALTER TABLE "sites" ADD COLUMN "subdomain_slug" text NOT NULL;

View File

@ -1 +0,0 @@
ALTER TABLE "articles" ADD COLUMN "created_at" timestamp;

View File

@ -0,0 +1 @@
ALTER TABLE "sites" ALTER COLUMN "subdomain_slug" DROP NOT NULL;

View File

@ -0,0 +1 @@
ALTER TABLE "sites" ADD COLUMN "social_medias" jsonb;

View File

@ -1 +0,0 @@
ALTER TABLE "articles" ALTER COLUMN "created_at" SET DEFAULT now();

View File

@ -1,11 +0,0 @@
CREATE TABLE IF NOT EXISTS "signups" (
"email" text NOT NULL,
"site_id" uuid NOT NULL,
"created_at" timestamp DEFAULT now()
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "signups" ADD CONSTRAINT "signups_site_id_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "sites"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@ -1 +0,0 @@
ALTER TABLE "articles" ADD COLUMN "is_public" boolean;

View File

@ -1 +0,0 @@
ALTER TABLE "articles" ALTER COLUMN "is_public" SET DEFAULT true;

View File

@ -1,8 +0,0 @@
DO $$ BEGIN
CREATE TYPE "subscription_tier" AS ENUM('free', 'basic', 'pro', 'enterprise');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "subscription_tier" "subscriptiontier" DEFAULT 'free' NOT NULL;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "tokens" integer DEFAULT 0 NOT NULL;

View File

@ -1,3 +0,0 @@
ALTER TABLE "sites" ADD COLUMN "primary_color_hex" varchar(6);--> statement-breakpoint
ALTER TABLE "sites" ADD COLUMN "secondary_color_hex" varchar(6);--> statement-breakpoint
ALTER TABLE "sites" ADD COLUMN "text_color_hex" varchar(6);

View File

@ -1,4 +0,0 @@
ALTER TABLE "signups" ALTER COLUMN "created_at" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "articles" ADD COLUMN "views" integer DEFAULT 0;--> statement-breakpoint
ALTER TABLE "signups" ADD COLUMN "source" text;--> statement-breakpoint
ALTER TABLE "articles" ADD CONSTRAINT "articles_site_id_seo_slug_unique" UNIQUE NULLS NOT DISTINCT("site_id","seo_slug");

View File

@ -1,9 +1,140 @@
{
"id": "b6cb5336-be20-4e96-861f-fff166b013c7",
"prevId": "00000000-0000-0000-0000-000000000000",
"id": "00000000-0000-0000-0000-000000000000",
"prevId": "",
"version": "5",
"dialect": "pg",
"tables": {
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'::character varying"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'::character varying"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'::character varying"
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"articles": {
"name": "articles",
"schema": "",
@ -32,6 +163,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
}
},
"indexes": {},
@ -70,11 +234,23 @@
"primaryKey": false,
"notNull": false
},
"google_code": {
"name": "google_code",
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -96,25 +272,31 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"signups": {
"name": "signups",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
"notNull": true
},
"name": {
"name": "name",
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
@ -122,12 +304,12 @@
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"user_id"
"site_id"
],
"columnsTo": [
"id"
@ -139,29 +321,10 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
@ -175,7 +338,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"enterprise": "enterprise",
"pro": "pro",
"basic": "basic",
"free": "free"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "de9d771e-4272-49d2-bcc7-6eb5291bcd51",
"prevId": "b6cb5336-be20-4e96-861f-fff166b013c7",
"id": "c1509dda-926d-4cd4-b876-3ec5dfca0729",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
"tables": {
@ -32,6 +32,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -51,7 +84,16 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"articles_site_id_seo_slug_unique": {
"name": "articles_site_id_seo_slug_unique",
"nullsNotDistinct": true,
"columns": [
"site_id",
"seo_slug"
]
}
}
},
"sessions": {
"name": "sessions",
@ -84,7 +126,7 @@
},
"expires_at": {
"name": "expires_at",
"type": "date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
@ -108,6 +150,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -130,6 +221,27 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
}
},
"indexes": {},
@ -162,8 +274,14 @@
"notNull": true,
"default": "gen_random_uuid()"
},
"google_refresh_token": {
"name": "google_refresh_token",
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
@ -174,6 +292,48 @@
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
@ -187,7 +347,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "ef238b19-05f5-4be9-90f8-56f4a08bb576",
"prevId": "de9d771e-4272-49d2-bcc7-6eb5291bcd51",
"id": "7cdb7236-fe99-4924-b4c3-420b248d403f",
"prevId": "c1509dda-926d-4cd4-b876-3ec5dfca0729",
"version": "5",
"dialect": "pg",
"tables": {
@ -32,6 +32,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -84,7 +117,7 @@
},
"expires_at": {
"name": "expires_at",
"type": "date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
@ -108,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -130,6 +212,27 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
}
},
"indexes": {},
@ -162,8 +265,14 @@
"notNull": true,
"default": "gen_random_uuid()"
},
"google_refresh_token": {
"name": "google_refresh_token",
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
@ -185,6 +294,42 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -193,7 +338,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "d7ae7ea1-7218-4141-a9a9-35395e42e9bd",
"prevId": "ef238b19-05f5-4be9-90f8-56f4a08bb576",
"id": "15eee88d-0bb0-4571-861d-dab8851effac",
"prevId": "7cdb7236-fe99-4924-b4c3-420b248d403f",
"version": "5",
"dialect": "pg",
"tables": {
@ -32,6 +32,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -84,7 +117,7 @@
},
"expires_at": {
"name": "expires_at",
"type": "date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
@ -108,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -130,6 +212,33 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -149,7 +258,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -162,6 +279,18 @@
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -179,6 +308,42 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -187,7 +352,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "130129fa-d718-4be8-8ffe-f285dce85195",
"prevId": "d7ae7ea1-7218-4141-a9a9-35395e42e9bd",
"id": "0a279256-aa6d-4915-ac29-67b4a99c6a93",
"prevId": "15eee88d-0bb0-4571-861d-dab8851effac",
"version": "5",
"dialect": "pg",
"tables": {
@ -32,6 +32,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -84,7 +117,7 @@
},
"expires_at": {
"name": "expires_at",
"type": "date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
@ -108,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -130,6 +212,57 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_freebie": {
"name": "send_freebie",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"freebie_url": {
"name": "freebie_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_text": {
"name": "freebie_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_image_url": {
"name": "freebie_image_url",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -149,7 +282,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -168,6 +309,12 @@
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -185,6 +332,42 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -193,7 +376,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "4c4cea1e-1ffe-4736-b045-7dadd7e22244",
"prevId": "130129fa-d718-4be8-8ffe-f285dce85195",
"id": "61fc5b8c-872d-4cb8-8d43-4f4fdbaeac3c",
"prevId": "0a279256-aa6d-4915-ac29-67b4a99c6a93",
"version": "5",
"dialect": "pg",
"tables": {
@ -32,6 +32,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -84,7 +117,7 @@
},
"expires_at": {
"name": "expires_at",
"type": "date",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
@ -108,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -130,6 +212,63 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_freebie": {
"name": "send_freebie",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"freebie_name": {
"name": "freebie_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_url": {
"name": "freebie_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_text": {
"name": "freebie_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_image_url": {
"name": "freebie_image_url",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -149,7 +288,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -168,6 +315,12 @@
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -191,6 +344,36 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -199,7 +382,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "3ec0762e-c27b-4b7f-b4a6-4db07400a5ae",
"prevId": "4c4cea1e-1ffe-4736-b045-7dadd7e22244",
"id": "3a12cc10-eb29-4469-9b41-3a834ca77f35",
"prevId": "61fc5b8c-872d-4cb8-8d43-4f4fdbaeac3c",
"version": "5",
"dialect": "pg",
"tables": {
@ -32,6 +32,39 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -108,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -130,6 +212,75 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subtitle": {
"name": "subtitle",
"type": "text",
"primaryKey": false,
"notNull": false
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_freebie": {
"name": "send_freebie",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"freebie_name": {
"name": "freebie_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_url": {
"name": "freebie_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_text": {
"name": "freebie_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_image_url": {
"name": "freebie_image_url",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -149,7 +300,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -168,6 +327,12 @@
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -191,6 +356,36 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -199,7 +394,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "10737e50-695f-41a3-94b4-e34439850a06",
"prevId": "3ec0762e-c27b-4b7f-b4a6-4db07400a5ae",
"id": "5dcf0ad1-cb9d-4c85-ad08-bee043c64e97",
"prevId": "3a12cc10-eb29-4469-9b41-3a834ca77f35",
"version": "5",
"dialect": "pg",
"tables": {
@ -44,6 +44,27 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -120,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -142,6 +212,81 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subtitle": {
"name": "subtitle",
"type": "text",
"primaryKey": false,
"notNull": false
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_freebie": {
"name": "send_freebie",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"freebie_name": {
"name": "freebie_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_url": {
"name": "freebie_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_text": {
"name": "freebie_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_image_url": {
"name": "freebie_image_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subdomain_slug": {
"name": "subdomain_slug",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
@ -161,7 +306,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -180,6 +333,12 @@
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -203,6 +362,36 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -211,7 +400,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "8177d5c3-dd38-41fc-83ae-a544aa8dc9a4",
"prevId": "10737e50-695f-41a3-94b4-e34439850a06",
"id": "3eac9b0e-ebf2-40df-953a-b80af0377fc4",
"prevId": "5dcf0ad1-cb9d-4c85-ad08-bee043c64e97",
"version": "5",
"dialect": "pg",
"tables": {
@ -45,11 +45,26 @@
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
"notNull": false,
"default": "now()"
}
},
"indexes": {},
@ -126,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -148,6 +212,81 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subtitle": {
"name": "subtitle",
"type": "text",
"primaryKey": false,
"notNull": false
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_freebie": {
"name": "send_freebie",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"freebie_name": {
"name": "freebie_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_url": {
"name": "freebie_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_text": {
"name": "freebie_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_image_url": {
"name": "freebie_image_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subdomain_slug": {
"name": "subdomain_slug",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -167,7 +306,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -186,6 +333,12 @@
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -209,6 +362,36 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -217,7 +400,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,6 +1,6 @@
{
"id": "35af811f-9d91-4524-b269-c7e3f8eb0ce8",
"prevId": "8177d5c3-dd38-41fc-83ae-a544aa8dc9a4",
"id": "ccdf67ee-d01b-4505-90d0-e53063d080ad",
"prevId": "3eac9b0e-ebf2-40df-953a-b80af0377fc4",
"version": "5",
"dialect": "pg",
"tables": {
@ -45,6 +45,20 @@
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
@ -127,6 +141,55 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
@ -149,6 +212,87 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subtitle": {
"name": "subtitle",
"type": "text",
"primaryKey": false,
"notNull": false
},
"domain": {
"name": "domain",
"type": "text",
"primaryKey": false,
"notNull": false
},
"send_freebie": {
"name": "send_freebie",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"freebie_name": {
"name": "freebie_name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_url": {
"name": "freebie_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_text": {
"name": "freebie_text",
"type": "text",
"primaryKey": false,
"notNull": false
},
"freebie_image_url": {
"name": "freebie_image_url",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subdomain_slug": {
"name": "subdomain_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"social_medias": {
"name": "social_medias",
"type": "jsonb",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -168,7 +312,15 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"sites_domain_unique": {
"name": "sites_domain_unique",
"nullsNotDistinct": false,
"columns": [
"domain"
]
}
}
},
"users": {
"name": "users",
@ -187,6 +339,12 @@
"primaryKey": false,
"notNull": false
},
"stripe_id": {
"name": "stripe_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
@ -210,6 +368,36 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"waitlist": {
"name": "waitlist",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@ -218,7 +406,17 @@
"uniqueConstraints": {}
}
},
"enums": {},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},

View File

@ -1,271 +0,0 @@
{
"id": "55d4edf3-4ec8-4c89-ae81-2c9199efea11",
"prevId": "35af811f-9d91-4524-b269-c7e3f8eb0ce8",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -1,277 +0,0 @@
{
"id": "bd993656-45ee-4b6d-9875-e47a5674f46e",
"prevId": "55d4edf3-4ec8-4c89-ae81-2c9199efea11",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -1,278 +0,0 @@
{
"id": "06039986-7308-452a-9a12-12c317b3f75b",
"prevId": "bd993656-45ee-4b6d-9875-e47a5674f46e",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -1,302 +0,0 @@
{
"id": "e60bff42-5767-4455-9a0d-3f9812ef99fe",
"prevId": "06039986-7308-452a-9a12-12c317b3f75b",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -1,320 +0,0 @@
{
"id": "81f29339-a37a-4371-ba92-08d75cf75378",
"prevId": "e60bff42-5767-4455-9a0d-3f9812ef99fe",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": false
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": false
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -1,323 +0,0 @@
{
"id": "015070b2-ab36-4bf6-a009-f7bb126c4aab",
"prevId": "81f29339-a37a-4371-ba92-08d75cf75378",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -1,345 +0,0 @@
{
"id": "c86e21cd-144e-4c9a-abf6-b14b38774154",
"prevId": "015070b2-ab36-4bf6-a009-f7bb126c4aab",
"version": "5",
"dialect": "pg",
"tables": {
"articles": {
"name": "articles",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": false
},
"source_video_id": {
"name": "source_video_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"title": {
"name": "title",
"type": "text",
"primaryKey": false,
"notNull": false
},
"seo_slug": {
"name": "seo_slug",
"type": "text",
"primaryKey": false,
"notNull": false
},
"is_public": {
"name": "is_public",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"views": {
"name": "views",
"type": "integer",
"primaryKey": false,
"notNull": false,
"default": 0
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"articles_site_id_sites_id_fk": {
"name": "articles_site_id_sites_id_fk",
"tableFrom": "articles",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"articles_site_id_seo_slug_unique": {
"name": "articles_site_id_seo_slug_unique",
"nullsNotDistinct": true,
"columns": [
"site_id",
"seo_slug"
]
}
}
},
"sessions": {
"name": "sessions",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"google_access_token": {
"name": "google_access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"google_refresh_token": {
"name": "google_refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"signups": {
"name": "signups",
"schema": "",
"columns": {
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"site_id": {
"name": "site_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"source": {
"name": "source",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"signups_site_id_sites_id_fk": {
"name": "signups_site_id_sites_id_fk",
"tableFrom": "signups",
"tableTo": "sites",
"columnsFrom": [
"site_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"sites": {
"name": "sites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"primary_color_hex": {
"name": "primary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'c4ced4'"
},
"secondary_color_hex": {
"name": "secondary_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'27251f'"
},
"text_color_hex": {
"name": "text_color_hex",
"type": "varchar(6)",
"primaryKey": false,
"notNull": true,
"default": "'ffffff'"
}
},
"indexes": {},
"foreignKeys": {
"sites_user_id_users_id_fk": {
"name": "sites_user_id_users_id_fk",
"tableFrom": "sites",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"google_id": {
"name": "google_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": false
},
"channel_id": {
"name": "channel_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uploads_playlist_id": {
"name": "uploads_playlist_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"subscription_tier": {
"name": "subscription_tier",
"type": "subscription_tier",
"primaryKey": false,
"notNull": true,
"default": "'free'"
},
"tokens": {
"name": "tokens",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {
"subscription_tier": {
"name": "subscription_tier",
"values": {
"free": "free",
"basic": "basic",
"pro": "pro",
"enterprise": "enterprise"
}
}
},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}

View File

@ -5,162 +5,71 @@
{
"idx": 0,
"version": "5",
"when": 1713532681066,
"tag": "0000_huge_ares",
"when": 1716305931541,
"tag": "0000_rapid_moira_mactaggert",
"breakpoints": true
},
{
"idx": 1,
"version": "5",
"when": 1713547912112,
"tag": "0001_slim_xavin",
"when": 1716305965347,
"tag": "0001_dizzy_preak",
"breakpoints": true
},
{
"idx": 2,
"version": "5",
"when": 1713549800799,
"tag": "0002_small_forge",
"when": 1716306011573,
"tag": "0002_bent_warpath",
"breakpoints": true
},
{
"idx": 3,
"version": "5",
"when": 1713550262815,
"tag": "0003_elite_falcon",
"when": 1716401149580,
"tag": "0003_past_mikhail_rasputin",
"breakpoints": true
},
{
"idx": 4,
"version": "5",
"when": 1713550343102,
"tag": "0004_daffy_ironclad",
"when": 1716562329579,
"tag": "0004_worthless_meltdown",
"breakpoints": true
},
{
"idx": 5,
"version": "5",
"when": 1713551541682,
"tag": "0005_tricky_sheva_callister",
"when": 1716627095303,
"tag": "0005_purple_firebird",
"breakpoints": true
},
{
"idx": 6,
"version": "5",
"when": 1713614011867,
"tag": "0006_wide_the_hunter",
"when": 1716668597716,
"tag": "0006_same_bulldozer",
"breakpoints": true
},
{
"idx": 7,
"version": "5",
"when": 1714378789934,
"tag": "0007_familiar_thor_girl",
"when": 1716723156673,
"tag": "0007_shiny_colossus",
"breakpoints": true
},
{
"idx": 8,
"version": "5",
"when": 1714739422527,
"tag": "0008_jittery_piledriver",
"when": 1716723180254,
"tag": "0008_long_chameleon",
"breakpoints": true
},
{
"idx": 9,
"version": "5",
"when": 1714739443139,
"tag": "0009_opposite_slayback",
"breakpoints": true
},
{
"idx": 10,
"version": "5",
"when": 1714739875253,
"tag": "0010_same_famine",
"breakpoints": true
},
{
"idx": 11,
"version": "5",
"when": 1714856795946,
"tag": "0011_serious_tenebrous",
"breakpoints": true
},
{
"idx": 12,
"version": "5",
"when": 1714859887333,
"tag": "0012_nervous_penance",
"breakpoints": true
},
{
"idx": 13,
"version": "5",
"when": 1715191000039,
"tag": "0013_windy_marvel_zombies",
"breakpoints": true
},
{
"idx": 14,
"version": "5",
"when": 1715191022918,
"tag": "0014_brown_leo",
"breakpoints": true
},
{
"idx": 15,
"version": "5",
"when": 1715191126676,
"tag": "0015_sparkling_drax",
"breakpoints": true
},
{
"idx": 16,
"version": "5",
"when": 1715191283764,
"tag": "0016_kind_riptide",
"breakpoints": true
},
{
"idx": 17,
"version": "5",
"when": 1715191316156,
"tag": "0017_goofy_lethal_legion",
"breakpoints": true
},
{
"idx": 18,
"version": "5",
"when": 1715197442428,
"tag": "0018_light_victor_mancha",
"breakpoints": true
},
{
"idx": 19,
"version": "5",
"when": 1715199975839,
"tag": "0019_lying_tomorrow_man",
"breakpoints": true
},
{
"idx": 20,
"version": "5",
"when": 1715247605191,
"tag": "0020_nifty_frog_thor",
"breakpoints": true
},
{
"idx": 21,
"version": "5",
"when": 1715288497718,
"tag": "0021_perfect_leopardon",
"breakpoints": true
},
{
"idx": 22,
"version": "5",
"when": 1715289112690,
"tag": "0022_tidy_proemial_gods",
"when": 1716744598232,
"tag": "0009_aromatic_rachel_grey",
"breakpoints": true
}
]

View File

@ -1,10 +1,11 @@
import { boolean, integer, pgEnum, pgTable, text, timestamp, unique, uuid, varchar } from "drizzle-orm/pg-core";
import { boolean, integer, jsonb, pgEnum, pgTable, text, timestamp, unique, uuid, varchar } from "drizzle-orm/pg-core";
export const subscription_enum = pgEnum("subscription_tier", ["free", "basic", "pro", "enterprise"])
export const users = pgTable("users", {
id: uuid("id").defaultRandom().primaryKey(),
google_id: text("google_id"),
stripe_id: text("stripe_id"),
name: text("name"),
email: text("email"),
channel_id: text("channel_id"),
@ -21,6 +22,18 @@ export const sessions = pgTable("sessions", {
expires_at: timestamp("expires_at")
});
function makeid(length) {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const charactersLength = characters.length;
let counter = 0;
while (counter < length) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
counter += 1;
}
return result;
}
export const sites = pgTable("sites", {
id: uuid("id").defaultRandom().primaryKey(),
user_id: uuid("user_id").references(() => users.id),
@ -28,6 +41,18 @@ export const sites = pgTable("sites", {
primary_color_hex: varchar("primary_color_hex", { length: 6 }).default("c4ced4").notNull(),
secondary_color_hex: varchar("secondary_color_hex", { length: 6 }).default('27251f').notNull(),
text_color_hex: varchar("text_color_hex", { length: 6 }).default('ffffff').notNull(),
title: text("title"),
subtitle: text("subtitle"),
domain: text("domain").unique(),
use_freebie: boolean("send_freebie"),
freebie_name: text("freebie_name"),
freebie_url: text("freebie_url"),
freebie_text: text("freebie_text"),
freebie_image_url: text("freebie_image_url"),
subdomain_slug: text("subdomain_slug").$defaultFn(() => {
return makeid(7);
}),
social_medias: jsonb("social_medias")
});
export const articles = pgTable("articles", {
@ -40,9 +65,10 @@ export const articles = pgTable("articles", {
is_public: boolean("is_public").default(true),
views: integer("views").default(0),
created_at: timestamp("created_at").defaultNow()
}, (t) => ({
unq: unique().on(t.site_id, t.seo_slug).nullsNotDistinct()
}));
// }, (t) => ({
// unq: unique().on(t.site_id, t.seo_slug).nullsNotDistinct()
})
// );
export const signups = pgTable("signups", {
email: text("email").notNull(),

View File

@ -1,11 +1,10 @@
import { initDb } from "./db/index.js";
import { channelRoutes, authRoutes, videoRoutes, meRoutes, blogRoutes } from "./routes/index.js";
import { channelRoutes, authRoutes, videoRoutes, meRoutes, blogRoutes, dashboardRoutes } from "./routes/index.js";
import { env, Logger, Redis } from "./utils/index.js";
import fastify from "fastify";
import { middleware } from "./modules/middleware.js";
import oauth from '@fastify/oauth2';
import fastifyCookie from "@fastify/cookie";
import { dashboardRoutes } from "./routes/dashboard.js";
// import fastifyMultipart from "@fastify/multipart";
const API_VERSION = "v1";

View File

@ -1,10 +1,11 @@
import { createSession as createSession } from '../utils/token.js';
import { getChannelInfo, getUserInfo } from '../utils/youtube.js';
import { db } from '../db/index.js';
import { sessions, users, users as usersTable } from '../db/schemas.js';
import { sessions, sites, users, users as usersTable } from '../db/schemas.js';
import { eq } from 'drizzle-orm';
import { env } from '../utils/env.js';
import { authMiddleware, authMiddlewareFn } from '../modules/middleware.js';
import { createCustomer } from '../utils/stripe.js';
/** @typedef {import("fastify").FastifyInstance} FastifyInstance */
/**
@ -39,14 +40,21 @@ export const authRoutes = (fastify, _, done) => {
}
}
else {
const customer = await createCustomer(user_info.email, user_info.name);
[user] = await db.insert(usersTable).values({
name: user_info.name,
google_id: user_info.id,
email: user_info.email,
channel_id: channel_info.id,
uploads_playlist_id: channel_info.contentDetails.relatedPlaylists.uploads
uploads_playlist_id: channel_info.contentDetails.relatedPlaylists.uploads,
stripe_id: customer.id
}).returning({ id: usersTable.id });
await db.insert(sites).values({
name: `${user_info.name}'s Website`,
user_id: user.id
});
if (user.length == 0) {
response.status(400).send({ success: false, message: "Problem when creating user account" });
return;
@ -79,7 +87,7 @@ export const authRoutes = (fastify, _, done) => {
// domain: ".omersabic.com"
// }).redirect(env.FRONTEND_URL);
response.redirect(env.FRONTEND_URL+"/auth?token="+session_id);
response.redirect(env.FRONTEND_URL + "/app/auth?token=" + session_id);
// response.send({
// token: session_id

View File

@ -5,6 +5,7 @@ import { getAccessToken, getCaptionText, getChannelInfo, getVideoCaptions, parse
import { articles, articles as articlesTable, signups as signupsTable, sites, users } from "../db/schemas.js";
import { createBlogFromCaptions } from "../utils/ai.js";
import { createArticleSlug } from "../utils/index.js";
import { sendFreebie } from "../utils/email.js";
/**
*
@ -30,13 +31,14 @@ export const blogRoutes = (fastify, _, done) => {
}
}, async (request, response) => {
try {
const mine = request.query.mine != 'false' ?? true;
const mine = request.query.mine ? request.query.mine : false;
const blog_id = request.query.blog_id;
if (!mine && !blog_id) {
response.send({
if (!mine && blog_id === "") {
response.status(400).send({
success: false,
message: "Request can either have \"mine\" set to true or provide a blog_id"
})
});
return;
}
let clause;
let site;
@ -45,13 +47,21 @@ export const blogRoutes = (fastify, _, done) => {
[site] = await db.select().from(sites).where(and(eq(sites.user_id, request.session.user_id)));
}
else {
[site] = await db.select().from(sites).where(eq(sites.id, request.query.blog_id));
let referer = new URL(request.headers.origin).host;
console.log(referer)
[site] = await db.select().from(sites).where(eq(sites.domain, referer)).limit(1);
}
if (!site) {
response.status(400).send({
success: false,
message: "Site not found"
});
return;
}
clause = eq(articlesTable.site_id, site.id);
if (mine == false) {
clause = and(eq(articlesTable.site_id, request.query.blog_id), eq(articlesTable.is_public, true));
clause = and(eq(articlesTable.site_id, site.id), eq(articlesTable.is_public, true));
}
// const access_token = await getAccessToken(fastify, request);
@ -62,7 +72,7 @@ export const blogRoutes = (fastify, _, done) => {
seo_slug: articlesTable.seo_slug,
views: articlesTable.views,
is_public: articlesTable.is_public,
created_at: articlesTable.created_at
created_at: articlesTable.created_at,
}).from(articlesTable).where(clause).limit(10).offset(request.query.offset || 0).orderBy(desc(articlesTable.created_at));
const [{ total }] = await db.select({
@ -77,6 +87,11 @@ export const blogRoutes = (fastify, _, done) => {
});
} catch (e) {
console.log(e);
response.status(500).send({
success: false,
message: "Unexpected error"
});
}
});
@ -133,7 +148,7 @@ export const blogRoutes = (fastify, _, done) => {
email: req.body.email,
site_id: req.body.site_id,
source: req.body.source
});
}).returning();
if (inserted.rowCount != 1) {
reply.status(400).send({
@ -143,6 +158,9 @@ export const blogRoutes = (fastify, _, done) => {
return;
}
await sendFreebie(req.body.email, req.body.site_id)
reply.send({
success: true
});

View File

@ -4,7 +4,7 @@ import { desc, eq, getTableColumns, sql } from "drizzle-orm";
import { db } from "../db/index.js";
import { articles, articles as articlesTable, signups as signupsTable, sites, users } from "../db/schemas.js";
import { authMiddleware, authMiddlewareFn } from "../modules/middleware.js";
import { jsonToCsv } from "../utils/index.js";
import { jsonToCsv, getAccessToken, getVideoCaptions, getCaptionText, parseTextFromCaptions, createBlogFromCaptions, createArticleSlug, getVideoById } from "../utils/index.js";
/**
*
@ -37,12 +37,17 @@ export const dashboardRoutes = (fastify, _, done) => {
.where(eq(signupsTable.site_id, site_id))
.orderBy(desc(signupsTable.created_at)).limit(8);
const [{ totalArticles }] = await db.select({ totalArticles: sql`count(*)` }).from(articlesTable).where(eq(articlesTable.site_id, site_id));
const [{ totalViews }] = await db.select({ totalViews: sql`sum(${articlesTable.views})` }).from(articlesTable).where(eq(articlesTable.site_id, site_id));
const [{ totalEmails }] = await db.select({ totalEmails: sql`count(*)` }).from(signupsTable).where(eq(signupsTable.site_id, site_id));
response.send({
success: true,
recentArticles,
recentSignups
recentSignups,
totalArticles,
totalEmails,
totalViews
});
return;
} catch (e) {
@ -157,6 +162,9 @@ export const dashboardRoutes = (fastify, _, done) => {
format: {
type: "string"
},
faq: {
type: "boolean"
},
}
},
}
@ -186,7 +194,9 @@ export const dashboardRoutes = (fastify, _, done) => {
const caption_body = await getCaptionText(access_token, preferred_caption_id);
const caption_text = parseTextFromCaptions(caption_body).substring(28);
const blog_content = await createBlogFromCaptions(caption_text, req.body);
const video_data = await getVideoById(access_token, req.body.video_id);
const blog_content = await createBlogFromCaptions(caption_text, { title: video_data.title, description: video_data.description }, req.body);
const blog_content_json = JSON.parse(blog_content);
// TODO: once I add multiple sites per user, this should come from the client
const site = await db.select().from(sites).where(eq(sites.user_id, req.session.user_id));
@ -202,7 +212,8 @@ export const dashboardRoutes = (fastify, _, done) => {
await db.update(users).set({
tokens: tokens - 1
}).where(eq(users.user_id, req.session.user_id));
}).where(eq(users.id, req.session.user_id));
} catch (e) {
console.log(e);
}
@ -233,6 +244,29 @@ export const dashboardRoutes = (fastify, _, done) => {
type: "string",
maxLength: 6,
minLength: 6
},
use_freebie: {
type: "boolean"
},
freebie_name: {
type: "string"
},
freebie_url: {
type: "string",
format: "uri"
},
freebie_image_url: {
type: "string",
format: "uri"
},
freebie_text: {
type: "string",
},
title: {
type: "string",
},
subtitle: {
type: "string",
}
},
required: ["id"]
@ -240,6 +274,7 @@ export const dashboardRoutes = (fastify, _, done) => {
},
preValidation: authMiddlewareFn
}, async (req, reply) => {
try {
const [site] = await db.select().from(sites).where(eq(sites.id, req.body.id));
if (site.user_id !== req.session.user_id) {
@ -254,6 +289,9 @@ export const dashboardRoutes = (fastify, _, done) => {
return {
success: true
}
} catch (e) {
console.log(e);
}
});
done();

View File

@ -1,5 +1,7 @@
export * from "./channels.js";
export * from "./auth.js";
export * from "./videos.js";
export * from "./me.js";
export * from "./blog.js"
export * from "./channels.js";
export * from "./dashboard.js"
export * from "./me.js";
export * from "./videos.js";
export * from "./webhook.js";

View File

@ -4,6 +4,8 @@ import { eq } from "drizzle-orm";
import { db } from "../db/index.js";
import { users } from "../db/schemas.js";
import { authMiddleware } from "../modules/middleware.js";
import { getBillingDashboard } from "../utils/stripe.js";
import { env } from "../utils/env.js";
/**
*
@ -40,5 +42,22 @@ export const meRoutes = (fastify, _, done) => {
}
});
fastify.get("/billing", async (request, response) => {
try {
const [user] = await db.select().from(users).where(eq(users.id, request.session.user_id));
const billing_session_url = await getBillingDashboard(user.stripe_id, env.FRONTEND_URL+"/app");
response.redirect(billing_session_url);
return;
} catch (e) {
response.status(400).send({
success: false,
message: "User not found",
log: e.message
});
return;
}
});
done();
};

View File

@ -5,8 +5,6 @@ import { db } from "../db/index.js";
import { users } from "../db/schemas.js";
import { authMiddleware } from "../modules/middleware.js";
import { getAccessToken, getCaptionText, getVideoCaptions, getVideosFromPlaylist } from "../utils/youtube.js";
import { createBlogFromCaptions } from "../utils/ai.js";
/**
*
* @param {FastifyInstance} fastify
@ -58,28 +56,28 @@ export const videoRoutes = (fastify, _, done) => {
}
})
fastify.get("/blogify/:video_id", async (request, response) => {
try {
const token = await getAccessToken(fastify, request);
const captions_list = await getVideoCaptions(token.access_token, request.params.video_id);
// fastify.get("/blogify/:video_id", async (request, response) => {
// try {
// const token = await getAccessToken(fastify, request);
// const captions_list = await getVideoCaptions(token.access_token, request.params.video_id);
const caption = captions_list.filter(x => x.snippet.language === "en");
if (caption.length === 0) {
response.send({
success: false,
message: "Couldn't find caption"
});
return;
}
const caption_text = await getCaptionText(token.access_token, caption[0].id);
// const caption = captions_list.filter(x => x.snippet.language === "en");
// if (caption.length === 0) {
// response.send({
// success: false,
// message: "Couldn't find caption"
// });
// return;
// }
// const caption_text = await getCaptionText(token.access_token, caption[0].id);
const ai_response = await createBlogFromCaptions(caption_text);
// const ai_response = await createBlogFromCaptions(caption_text);
response.send(ai_response);
} catch (e) {
console.log(e);
}
});
// response.send(ai_response);
// } catch (e) {
// console.log(e);
// }
// });
done();
};

29
src/routes/webhook.js Normal file
View File

@ -0,0 +1,29 @@
/** @typedef {import("fastify").FastifyInstance} FastifyInstance */
import { eq } from "drizzle-orm";
import { db } from "../db/index.js";
import { users } from "../db/schemas.js";
import { authMiddleware } from "../modules/middleware.js";
/**
*
* @param {FastifyInstance} fastify
* @param {unknown} _
* @param {() => void} done
*/
export const webhookRoutes = (fastify, _, done) => {
fastify.get("/", async (request, response) => {
try {
} catch (e) {
response.status(400).send({
success: false,
message: "User not found",
log: e.message
});
return;
}
});
done();
};

View File

@ -23,20 +23,17 @@ async function cf_prompt(prompt, model = defaultModel) {
return res;
}
async function promptGPT(prompt, {model = "gpt-3.5-turbo", max_tokens = 1024}) {
async function promptGPT(prompt, { model, is_json } = {model: "gpt-3.5-turbo", is_json: true}) {
// return JSON.stringify({ "title": "Tech News Update: TikTok Ban, Snapdragon X Series CPUs, Tesla Troubles, and More", "body": "I was thinking about starting this video by singing the song Tik Tok by Kesha but I don't think anyone waking up in the morning feeling like P Diddy is a good vibe right now. The United States has officially passed a law banning TikTok next year if certain conditions aren't met. This ban is part of a larger foreign aid package in support of Ukraine and Israel. TikTok has vowed to fight the law in court, calling it an unconstitutional suppression of its American users' freedom of speech. In other tech news, Qualcomm has unveiled its upcoming lineup of Snapdragon X Series CPUs, including some confusing names. Tesla is facing troubles with its Cybertruck not being waterproof. And Google has delayed its plan to phase out third-party tracking cookies yet again. Stay tuned for more tech updates on TechLink!" });
const options = {
method: 'POST',
headers: { Authorization: 'Bearer sk-proj-kngnyz8wyoxx4Sw4X4OHT3BlbkFJJBmYAE9odHtYPu1OBEG7', "Content-Type": "application/json" },
body: JSON.stringify({
"model": "gpt-3.5-turbo",
"max_tokens": max_tokens,
"response_format": { "type": "json_object" },
"messages": [
{
"role": "user",
"content": prompt
}
]
// "max_tokens": max_tokens,
...(is_json ? {"response_format": { "type": "json_object" }} : {}),
"messages": prompt
})
};
@ -60,17 +57,26 @@ async function promptGPT(prompt, {model = "gpt-3.5-turbo", max_tokens = 1024}) {
* @returns {Promise<{title: string, body: string, seo_friendly_slug: string}>}
*/
export async function createBlogFromCaptions(captions, {
title,
description
}, {
length,
language,
format,
tone
} = {length: 500, language: "English", format: "summary", tone: "informal"}) {
tone,
faq
} = { length: 700, language: "English", format: "summary", tone: "informal", faq: false }) {
// const prompt = `Convert the following video transcript into a blog post. The approximate length should be around ${length || 500} characters, written in ${language || "English"}. The desired format of the blog post is a ${format || "summary"}. Please ensure the blog post has a ${tone || "informal"} tone throughout. Use markdown to format the article. You must always respond in the following json fromat: {"title": string, "content": string, "seo_friendly_slug": string}. \nHere is the transcript: `
const prompt = `Convert the following video transcript into an engaging blog post. You must always respond in the following json fromat: {"title": string, "body": string, "seo_friendly_slug": string}. Do not, under any circumstance, include the title inside the body, it should only be reserved for the body of the article. Use markdown to format the article. \nHere is the transcript: `;
// const prompt = `Convert the following video transcript into an engaging blog post. You must always respond in the following json fromat: {"title": string, "body": string, "seo_friendly_slug": string}. Do not, under any circumstance, include the title inside the body, it should only be reserved for the body of the article. Use markdown to format the article. Use "\\n" to add line-breaks. \nHere is the transcript: `;
const result = await promptGPT(prompt + captions, {
length: wordsToTokens(length)
});
const prompt = [{
"role": "user",
"content": `CONSTRAINT: Very important. Write AT THE VERY LEAST ${length+100} words.
Using the following video transcript, create a blog based on the information in the video transcript. You must always respond in the following json fromat: {"title": string, "body": string, "seo_friendly_slug": string}. Do not, under any circumstance, include the title inside the body, it should only be reserved for the body of the article. Use markdown to format the article. Use "\\n" to add line-breaks. \nHere is the transcript:
${captions}`
}];
const result = await promptGPT(prompt);
console.log(result);
return result;
}

37
src/utils/email.js Normal file
View File

@ -0,0 +1,37 @@
import { eq } from "drizzle-orm";
import { db } from "../db";
import { sites } from "../db/schemas";
import { MailtrapClient } from "mailtrap";
const TOKEN = "a0cc97f4f856d6c16d70bb5984e32cef";
const ENDPOINT = "https://send.api.mailtrap.io/";
const client = new MailtrapClient({ endpoint: ENDPOINT, token: TOKEN });
export async function sendFreebie(recipient, blog_id) {
const [blog] = await db.select().from(sites).where(eq(sites.id, blog_id));
if (!blog) throw new Error("Invalid site");
if (!blog.use_freebie) return;
const sender = {
email: "mailtrap@demomailtrap.com",
name: "Mailtrap Test",
};
const recipients = [
{
email: recipient,
}
];
client
.send({
from: sender,
to: recipients,
subject: `Your freebie from ${blog.name}`,
text: `Thank you for subscribing to ${blog.name}! Your freebie is linked below.\n ${blog.freebie_url}`,
})
.then(console.log, console.error);
}

View File

@ -7,7 +7,8 @@ const envSchema = z.object({
PORT: z.coerce.number().default(8080),
HOST: z.string().default("127.0.0.1"),
PUBLIC_API_URL: z.string(),
FRONTEND_URL: z.string()
FRONTEND_URL: z.string(),
SITES_HOST: z.string(),
});
export const env = envSchema.parse(process.env);

32
src/utils/stripe.js Normal file
View File

@ -0,0 +1,32 @@
import loadStripe from 'stripe';
const stripe = await loadStripe('sk_test_51MRcs0FrdGTeTMwdCgd6Z3I1913esqFD2W171b1W4PnRsdxfOCDrwtawiKFgS7R2ZDkWTSqfxp5Gl1GTd8aospWv00vFXvO6iC');
/**
*
* @param {string} email
* @param {string} name
* @returns {import('stripe-v3').customer.create}
*/
export async function createCustomer(email, name) {
return (await stripe.customers.create({
email: email,
name: name,
}));
}
/**
*
* @param {string} stripe_id
*/
export async function getBillingDashboard(stripe_id, return_url) {
const session = await stripe.billingPortal.sessions.create({
customer: stripe_id,
return_url,
flow_data: {
type: 'payment_method_update',
},
});
return session.url;
}

View File

@ -5,6 +5,16 @@ import { google } from 'googleapis';
const service = google.youtube("v3");
export async function getVideoById(access_token, video_id) {
const video = await service.videos.list({
access_token,
id: video_id,
part: "snippet"
}).then(x=>x.data.items[0].snippet);
return video;
}
/**
*
* @param {string} access_token

60
test.js
View File

@ -1,60 +0,0 @@
const paths = [
'M-380 -189C-380 -189 -312 216 152 343C616 470 684 875 684 875',
'M-373 -197C-373 -197 -305 208 159 335C623 462 691 867 691 867',
'M-366 -205C-366 -205 -298 200 166 327C630 454 698 859 698 859',
'M-359 -213C-359 -213 -291 192 173 319C637 446 705 851 705 851',
'M-352 -221C-352 -221 -284 184 180 311C644 438 712 843 712 843',
'M-345 -229C-345 -229 -277 176 187 303C651 430 719 835 719 835',
'M-338 -237C-338 -237 -270 168 194 295C658 422 726 827 726 827',
'M-331 -245C-331 -245 -263 160 201 287C665 414 733 819 733 819',
'M-324 -253C-324 -253 -256 152 208 279C672 406 740 811 740 811',
'M-317 -261C-317 -261 -249 144 215 271C679 398 747 803 747 803',
'M-310 -269C-310 -269 -242 136 222 263C686 390 754 795 754 795',
'M-303 -277C-303 -277 -235 128 229 255C693 382 761 787 761 787',
'M-296 -285C-296 -285 -228 120 236 247C700 374 768 779 768 779',
'M-289 -293C-289 -293 -221 112 243 239C707 366 775 771 775 771',
'M-282 -301C-282 -301 -214 104 250 231C714 358 782 763 782 763',
'M-275 -309C-275 -309 -207 96 257 223C721 350 789 755 789 755',
'M-268 -317C-268 -317 -200 88 264 215C728 342 796 747 796 747',
'M-261 -325C-261 -325 -193 80 271 207C735 334 803 739 803 739',
'M-254 -333C-254 -333 -186 72 278 199C742 326 810 731 810 731',
'M-247 -341C-247 -341 -179 64 285 191C749 318 817 723 817 723',
'M-240 -349C-240 -349 -172 56 292 183C756 310 824 715 824 715',
'M-233 -357C-233 -357 -165 48 299 175C763 302 831 707 831 707',
'M-226 -365C-226 -365 -158 40 306 167C770 294 838 699 838 699',
'M-219 -373C-219 -373 -151 32 313 159C777 286 845 691 845 691',
'M-212 -381C-212 -381 -144 24 320 151C784 278 852 683 852 683',
'M-205 -389C-205 -389 -137 16 327 143C791 270 859 675 859 675',
'M-198 -397C-198 -397 -130 8 334 135C798 262 866 667 866 667',
'M-191 -405C-191 -405 -123 0 341 127C805 254 873 659 873 659',
'M-184 -413C-184 -413 -116 -8 348 119C812 246 880 651 880 651',
'M-177 -421C-177 -421 -109 -16 355 111C819 238 887 643 887 643',
'M-170 -429C-170 -429 -102 -24 362 103C826 230 894 635 894 635',
'M-163 -437C-163 -437 -95 -32 369 95C833 222 901 627 901 627',
'M-156 -445C-156 -445 -88 -40 376 87C840 214 908 619 908 619',
'M-149 -453C-149 -453 -81 -48 383 79C847 206 915 611 915 611',
'M-142 -461C-142 -461 -74 -56 390 71C854 198 922 603 922 603',
'M-135 -469C-135 -469 -67 -64 397 63C861 190 929 595 929 595',
'M-128 -477C-128 -477 -60 -72 404 55C868 182 936 587 936 587',
'M-121 -485C-121 -485 -53 -80 411 47C875 174 943 579 943 579',
'M-114 -493C-114 -493 -46 -88 418 39C882 166 950 571 950 571',
'M-107 -501C-107 -501 -39 -96 425 31C889 158 957 563 957 563',
'M-100 -509C-100 -509 -32 -104 432 23C896 150 964 555 964 555',
'M-93 -517C-93 -517 -25 -112 439 15C903 142 971 547 971 547',
'M-86 -525C-86 -525 -18 -120 446 7C910 134 978 539 978 539',
'M-79 -533C-79 -533 -11 -128 453 -1C917 126 985 531 985 531',
'M-72 -541C-72 -541 -4 -136 460 -9C924 118 992 523 992 523',
'M-65 -549C-65 -549 3 -144 467 -17C931 110 999 515 999 515',
'M-58 -557C-58 -557 10 -152 474 -25C938 102 1006 507 1006 507',
'M-51 -565C-51 -565 17 -160 481 -33C945 94 1013 499 1013 499',
'M-44 -573C-44 -573 24 -168 488 -41C952 86 1020 491 1020 491',
'M-37 -581C-37 -581 31 -176 495 -49C959 78 1027 483 1027 483'
];
let r = [];
for(let i = 0; i < paths.length; i+=2) {
r.push(paths[i])
}
console.log(r);

1034
yarn.lock

File diff suppressed because it is too large Load Diff