Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add license field to fetchLatestPageVersionWithTranslations query #131

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web/app/routes/reader.$encodedUrl/functions/queries.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function fetchLatestPageVersionWithTranslations(
title: true,
url: true,
content: true,
license: true,
sourceTexts: {
select: {
id: true,
Expand Down Expand Up @@ -63,6 +64,7 @@ export async function fetchLatestPageVersionWithTranslations(
return {
title: pageVersion.title,
url: pageVersion.url,
license: pageVersion.license,
content: pageVersion.content,
sourceTextInfoWithTranslations,
userId,
Expand Down
1 change: 1 addition & 0 deletions web/app/routes/reader.$encodedUrl/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default function ReaderView() {
}
userId={safeUser?.id ?? null}
/>
<p>license: {pageData.license}</p>
</article>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions web/app/routes/reader.$encodedUrl/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface LatestPageVersionWithTranslations {
title: string;
url: string;
content: string;
license: string;
sourceTextInfoWithTranslations: SourceTextInfoWithTranslations[];
userId: number | null;
}
Expand Down
2 changes: 2 additions & 0 deletions web/prisma/migrations/20240730150103_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "page_versions" ADD COLUMN "license" TEXT NOT NULL DEFAULT 'unknown';
2 changes: 1 addition & 1 deletion web/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ model PageVersion {
url String
title String
content String
license String @default("unknown")
contentHash Bytes @map("content_hash")
pageId Int @map("page_id")
createdAt DateTime @default(now()) @map("created_at")
Expand Down Expand Up @@ -162,7 +163,6 @@ model ApiUsage {
@@map("api_usage")
}


model CustomAIModel {
id String @id @default(cuid())
userId Int
Expand Down
Loading