Add place enrichment favorites and AI search
Build and deploy Backend / build (push) Successful in 1m1s

This commit is contained in:
Ruslan Bakiev
2026-06-12 21:08:56 +07:00
parent 80a729fa6e
commit 98bfb032c6
17 changed files with 3313 additions and 236 deletions
@@ -0,0 +1,33 @@
-- AlterTable
ALTER TABLE "Place" ADD COLUMN "googleBusinessStatus" TEXT,
ADD COLUMN "googleCurrentOpeningHours" JSONB,
ADD COLUMN "googlePayload" JSONB,
ADD COLUMN "googlePayloadFetchedAt" TIMESTAMP(3),
ADD COLUMN "googlePhotos" JSONB,
ADD COLUMN "googleRating" DOUBLE PRECISION,
ADD COLUMN "googleRegularOpeningHours" JSONB,
ADD COLUMN "googleUserRatingCount" INTEGER;
-- AlterTable
ALTER TABLE "VoiceExperience" ADD COLUMN "promptHintsShown" TEXT[] DEFAULT ARRAY[]::TEXT[],
ADD COLUMN "recordingPayload" JSONB;
-- CreateTable
CREATE TABLE "UserFavoritePlace" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"placeId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "UserFavoritePlace_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "UserFavoritePlace_userId_placeId_key" ON "UserFavoritePlace"("userId", "placeId");
-- AddForeignKey
ALTER TABLE "UserFavoritePlace" ADD CONSTRAINT "UserFavoritePlace_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserFavoritePlace" ADD CONSTRAINT "UserFavoritePlace_placeId_fkey" FOREIGN KEY ("placeId") REFERENCES "Place"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
+33 -10
View File
@@ -17,16 +17,25 @@ enum VoiceExperienceStatus {
}
model Place {
id String @id @default(cuid())
googlePlaceId String @unique
name String
latitude Float
longitude Float
googlePrimaryType String?
googleTypes String[] @default([])
experiences VoiceExperience[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(cuid())
googlePlaceId String @unique
name String
latitude Float
longitude Float
googlePrimaryType String?
googleTypes String[] @default([])
googleBusinessStatus String?
googleRating Float?
googleUserRatingCount Int?
googleRegularOpeningHours Json?
googleCurrentOpeningHours Json?
googlePhotos Json?
googlePayload Json?
googlePayloadFetchedAt DateTime?
experiences VoiceExperience[]
favoriteUsers UserFavoritePlace[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model User {
@@ -41,10 +50,22 @@ model User {
sessions UserSession[]
loginRequests TelegramLoginRequest[]
voiceExperiences VoiceExperience[]
favoritePlaces UserFavoritePlace[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model UserFavoritePlace {
id String @id @default(cuid())
userId String
user User @relation(fields: [userId], references: [id])
placeId String
place Place @relation(fields: [placeId], references: [id])
createdAt DateTime @default(now())
@@unique([userId, placeId])
}
model UserSession {
id String @id @default(cuid())
tokenHash String @unique
@@ -82,6 +103,8 @@ model VoiceExperience {
status VoiceExperienceStatus @default(UPLOADED)
transcript String?
analysis Json?
recordingPayload Json?
promptHintsShown String[] @default([])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}