AI Newsletter Digest improvements: fixed QP soft line break decoding, URL extraction, and content cleaning
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "comments" (
|
||||
"id" TEXT NOT NULL,
|
||||
"post_id" TEXT NOT NULL,
|
||||
"agent_id" TEXT NOT NULL,
|
||||
"content" TEXT NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "comments_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "votes" (
|
||||
"id" TEXT NOT NULL,
|
||||
"post_id" TEXT NOT NULL,
|
||||
"agent_id" TEXT NOT NULL,
|
||||
"vote" INTEGER NOT NULL,
|
||||
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updated_at" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "votes_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "posts_published_at_idx" ON "posts"("published_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "comments_post_id_idx" ON "comments"("post_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "comments_agent_id_idx" ON "comments"("agent_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "comments_created_at_idx" ON "comments"("created_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "votes_post_id_idx" ON "votes"("post_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "votes_agent_id_idx" ON "votes"("agent_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "votes_post_id_agent_id_key" ON "votes"("post_id", "agent_id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "comments" ADD CONSTRAINT "comments_post_id_fkey" FOREIGN KEY ("post_id") REFERENCES "posts"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "votes" ADD CONSTRAINT "votes_post_id_fkey" FOREIGN KEY ("post_id") REFERENCES "posts"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,98 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
directUrl = env("DIRECT_URL")
|
||||
}
|
||||
|
||||
// AI Agent Blogs Models ONLY
|
||||
model Agent {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
name String
|
||||
slug String @unique
|
||||
bio String?
|
||||
avatarUrl String? @map("avatar_url")
|
||||
apiKey String @unique @default(uuid()) @map("api_key")
|
||||
verified Boolean @default(false)
|
||||
subdomainCreated Boolean @default(false) @map("subdomain_created")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
posts Post[]
|
||||
verificationTokens VerificationToken[]
|
||||
|
||||
@@map("agents")
|
||||
}
|
||||
|
||||
model Post {
|
||||
id String @id @default(uuid())
|
||||
agentId String @map("agent_id")
|
||||
title String
|
||||
slug String
|
||||
contentMd String @map("content_md") @db.Text
|
||||
contentHtml String @map("content_html") @db.Text
|
||||
status String @default("draft")
|
||||
publishedAt DateTime? @map("published_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
||||
comments Comment[]
|
||||
votes Vote[]
|
||||
|
||||
@@unique([agentId, slug])
|
||||
@@index([agentId])
|
||||
@@index([status])
|
||||
@@index([publishedAt])
|
||||
@@map("posts")
|
||||
}
|
||||
|
||||
model Comment {
|
||||
id String @id @default(uuid())
|
||||
postId String @map("post_id")
|
||||
agentId String @map("agent_id")
|
||||
content String @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([postId])
|
||||
@@index([agentId])
|
||||
@@index([createdAt])
|
||||
@@map("comments")
|
||||
}
|
||||
|
||||
model Vote {
|
||||
id String @id @default(uuid())
|
||||
postId String @map("post_id")
|
||||
agentId String @map("agent_id")
|
||||
vote Int // 1 for upvote, -1 for downvote
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([postId, agentId])
|
||||
@@index([postId])
|
||||
@@index([agentId])
|
||||
@@map("votes")
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
id String @id @default(uuid())
|
||||
agentId String @map("agent_id")
|
||||
token String @unique @default(uuid())
|
||||
expiresAt DateTime @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([agentId])
|
||||
@@index([token])
|
||||
@@map("verification_tokens")
|
||||
}
|
||||
248
archive/inactive-skills/agent-voice/prisma/schema.prisma
Normal file
248
archive/inactive-skills/agent-voice/prisma/schema.prisma
Normal file
@@ -0,0 +1,248 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
directUrl = env("DIRECT_URL")
|
||||
}
|
||||
|
||||
model Agent {
|
||||
id String @id @default(uuid())
|
||||
email String @unique
|
||||
name String
|
||||
slug String @unique
|
||||
bio String?
|
||||
avatarUrl String? @map("avatar_url")
|
||||
apiKey String @unique @default(uuid()) @map("api_key")
|
||||
verified Boolean @default(false)
|
||||
subdomainCreated Boolean @default(false) @map("subdomain_created")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
posts Post[]
|
||||
verificationTokens VerificationToken[] @relation("AgentToVerificationToken")
|
||||
|
||||
@@map("agents")
|
||||
}
|
||||
|
||||
model Comment {
|
||||
id String @id @default(uuid())
|
||||
postId String @map("post_id")
|
||||
agentId String? @map("agent_id")
|
||||
anonymousId String? @map("anonymous_id")
|
||||
displayName String? @map("display_name")
|
||||
content String
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
||||
commentVotes CommentVote[]
|
||||
|
||||
@@index([agentId])
|
||||
@@index([anonymousId])
|
||||
@@index([createdAt])
|
||||
@@index([postId])
|
||||
@@map("comments")
|
||||
}
|
||||
|
||||
/// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
|
||||
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
|
||||
model pending_booking_travellers {
|
||||
id Int @id @default(autoincrement())
|
||||
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
deleted_at DateTime? @db.Timestamptz(6)
|
||||
pending_booking_id Int?
|
||||
traveller_id Int?
|
||||
role String @default("guest") @db.VarChar(20)
|
||||
first_name String? @db.VarChar(255)
|
||||
last_name String? @db.VarChar(255)
|
||||
email String? @db.VarChar(255)
|
||||
phone String? @db.VarChar(255)
|
||||
passport_number String? @db.VarChar(255)
|
||||
passport_country String? @db.VarChar(2)
|
||||
pending_bookings pending_bookings? @relation(fields: [pending_booking_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
||||
travellers travellers? @relation(fields: [traveller_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
||||
|
||||
@@unique([pending_booking_id, traveller_id])
|
||||
@@index([pending_booking_id], map: "idx_pending_booking_travellers_booking_id")
|
||||
@@index([traveller_id], map: "idx_pending_booking_travellers_traveller_id")
|
||||
}
|
||||
|
||||
/// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
|
||||
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
|
||||
model pending_bookings {
|
||||
id Int @id @default(autoincrement())
|
||||
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
deleted_at DateTime? @db.Timestamptz(6)
|
||||
booking_type String @db.VarChar(20)
|
||||
status String @default("pending") @db.VarChar(20)
|
||||
flight_id String? @db.VarChar(255)
|
||||
flight_details Json?
|
||||
hotel_id String? @db.VarChar(255)
|
||||
hotel_details Json?
|
||||
hotel_room_rate_id String? @db.VarChar(255)
|
||||
check_in_date DateTime? @db.Date
|
||||
check_out_date DateTime? @db.Date
|
||||
payment_intent_id String @db.VarChar(255)
|
||||
currency String @db.VarChar(3)
|
||||
total_amount Decimal @db.Decimal(10, 2)
|
||||
payment_status String @default("pending") @db.VarChar(20)
|
||||
user_id Int?
|
||||
metadata Json?
|
||||
expires_at DateTime @default(dbgenerated("(CURRENT_TIMESTAMP + '24:00:00'::interval)")) @db.Timestamptz(6)
|
||||
duffel_booking_id String? @db.VarChar(255)
|
||||
duffel_booking_reference String? @db.VarChar(255)
|
||||
pending_booking_travellers pending_booking_travellers[]
|
||||
users users? @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||
|
||||
@@index([duffel_booking_id], map: "idx_pending_bookings_duffel_booking_id")
|
||||
@@index([duffel_booking_reference], map: "idx_pending_bookings_duffel_booking_reference")
|
||||
@@index([expires_at], map: "idx_pending_bookings_expires_at")
|
||||
@@index([payment_intent_id], map: "idx_pending_bookings_payment_intent_id")
|
||||
@@index([payment_status], map: "idx_pending_bookings_payment_status")
|
||||
@@index([status], map: "idx_pending_bookings_status")
|
||||
@@index([user_id], map: "idx_pending_bookings_user_id")
|
||||
}
|
||||
|
||||
model Post {
|
||||
id String @id @default(uuid())
|
||||
agentId String @map("agent_id")
|
||||
title String
|
||||
slug String
|
||||
contentMd String @map("content_md")
|
||||
contentHtml String @map("content_html")
|
||||
status String @default("draft")
|
||||
publishedAt DateTime? @map("published_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
comments Comment[]
|
||||
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
||||
votes Vote[]
|
||||
|
||||
@@unique([agentId, slug])
|
||||
@@index([agentId])
|
||||
@@index([publishedAt])
|
||||
@@index([status])
|
||||
@@map("posts")
|
||||
}
|
||||
|
||||
model traveller_addresses {
|
||||
id Int @id @default(autoincrement())
|
||||
traveller_id Int?
|
||||
street String @db.VarChar(255)
|
||||
city String @db.VarChar(100)
|
||||
state String? @db.VarChar(100)
|
||||
postal_code String? @db.VarChar(20)
|
||||
country String @db.VarChar(100)
|
||||
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
deleted_at DateTime? @db.Timestamptz(6)
|
||||
travellers travellers? @relation(fields: [traveller_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
||||
|
||||
@@index([deleted_at], map: "idx_traveller_addresses_deleted_at")
|
||||
}
|
||||
|
||||
model travellers {
|
||||
id Int @id @default(autoincrement())
|
||||
user_id Int?
|
||||
is_primary Boolean? @default(false)
|
||||
first_name String @db.VarChar(255)
|
||||
last_name String @db.VarChar(255)
|
||||
date_of_birth DateTime @db.Date
|
||||
nationality String? @db.VarChar(100)
|
||||
email String? @db.VarChar(255)
|
||||
phone String? @db.VarChar(50)
|
||||
passport_number String? @db.VarChar(100)
|
||||
passport_expiry DateTime? @db.Date
|
||||
passport_issue_country String? @db.VarChar(100)
|
||||
passport_issue_date DateTime? @db.Date
|
||||
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
deleted_at DateTime? @db.Timestamptz(6)
|
||||
pending_booking_travellers pending_booking_travellers[]
|
||||
traveller_addresses traveller_addresses[]
|
||||
users users? @relation(fields: [user_id], references: [id], onDelete: Cascade, onUpdate: NoAction)
|
||||
|
||||
@@index([deleted_at], map: "idx_travellers_deleted_at")
|
||||
}
|
||||
|
||||
model user_preferences {
|
||||
user_id Int @id
|
||||
show_flights Boolean? @default(true)
|
||||
show_stays Boolean? @default(true)
|
||||
theme String? @default("system") @db.VarChar(10)
|
||||
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
deleted_at DateTime? @db.Timestamptz(6)
|
||||
language String @default("en") @db.VarChar(10)
|
||||
currency String @default("USD") @db.VarChar(3)
|
||||
timezone String @default("UTC") @db.VarChar(50)
|
||||
email_notifications Boolean @default(true)
|
||||
marketing_emails Boolean @default(false)
|
||||
users users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction)
|
||||
}
|
||||
|
||||
model users {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @db.VarChar(255)
|
||||
email String @unique @db.VarChar(255)
|
||||
user_type String @db.VarChar(255)
|
||||
password_hash String @db.VarChar(255)
|
||||
stripe_customer_id String? @db.VarChar(255)
|
||||
stripe_card_last String? @db.VarChar(4)
|
||||
unity_contact_id String? @db.VarChar(255)
|
||||
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
||||
deleted_at DateTime? @db.Timestamptz(6)
|
||||
pending_bookings pending_bookings[]
|
||||
travellers travellers[]
|
||||
user_preferences user_preferences?
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
id String @id @default(uuid())
|
||||
agentId String @map("agent_id")
|
||||
token String @unique @default(uuid())
|
||||
expiresAt DateTime @map("expires_at")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
agent Agent @relation("AgentToVerificationToken", fields: [agentId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([agentId])
|
||||
@@index([token])
|
||||
@@map("verification_tokens")
|
||||
}
|
||||
|
||||
model Vote {
|
||||
id String @id @default(uuid())
|
||||
postId String @map("post_id")
|
||||
agentId String? @map("agent_id")
|
||||
anonymousId String? @map("anonymous_id")
|
||||
vote Int
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([postId, agentId])
|
||||
@@unique([postId, anonymousId])
|
||||
@@index([agentId])
|
||||
@@index([anonymousId])
|
||||
@@index([postId])
|
||||
@@map("votes")
|
||||
}
|
||||
|
||||
model CommentVote {
|
||||
id String @id @default(uuid())
|
||||
commentId String @map("comment_id")
|
||||
anonymousId String @map("anonymous_id")
|
||||
vote Int
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at")
|
||||
comment Comment @relation(fields: [commentId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([commentId, anonymousId])
|
||||
@@index([commentId])
|
||||
@@index([anonymousId])
|
||||
@@map("comment_votes")
|
||||
}
|
||||
Reference in New Issue
Block a user