-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix build fix fix
- Loading branch information
Showing
29 changed files
with
1,143 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ next-env.d.ts | |
.idea | ||
*.iml | ||
package-lock.json | ||
/log.txt | ||
.env | ||
/.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
# japanese holy bible | ||
|
||
npx prisma init | ||
|
||
npx dotenv -e .env.production.local -- npx prisma db pull | ||
npx prisma generate | ||
|
||
|
||
ALTER TABLE bible | ||
ADD CONSTRAINT unique_combination UNIQUE (book, chapter, verse); | ||
|
||
|
||
next build | ||
next start -p 3001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
/// The underlying table does not contain a valid unique identifier and can therefore currently not be handled by Prisma Client. | ||
model test { | ||
name String? @db.VarChar | ||
@@ignore | ||
} | ||
|
||
model bible { | ||
id Int @id @default(autoincrement()) | ||
book String? @db.VarChar | ||
chapter Int? | ||
verse Int? | ||
text String? | ||
furigana String? | ||
@@unique([book, chapter, verse], map: "unique_combination") | ||
} | ||
|
||
model books { | ||
id Int @id @default(autoincrement()) | ||
sort Int? | ||
short_name String? @db.VarChar | ||
long_name String? @db.VarChar | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// no-config | ||
import { sql } from '@vercel/postgres'; | ||
|
||
import { createPool } from '@vercel/postgres'; | ||
import { NextResponse } from "next/server"; | ||
|
||
export const dynamic = 'force-dynamic' | ||
import { Prisma, PrismaClient } from "@prisma/client"; | ||
import { Bible } from "@/app/bible/data"; | ||
// import {Bible} from "@/app/bible/data"; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
export type BibleIndex = { | ||
book: string, | ||
chapter: number | ||
} | ||
|
||
export async function GET( | ||
request: Request, | ||
{ params }: { params: { book: string, chapter: string } } | ||
) { | ||
console.log(params) | ||
// console.log(process.env) | ||
// console.log(process.env.POSTGRES_URL) | ||
// console.log(process.env.NEXT_PUBLIC_POSTGRES_URL) | ||
// const pool = createPool({ | ||
// connectionString: process.env.POSTGRES_URL, | ||
// user: process.env.POSTGRES_USER, | ||
// database: process.env.POSTGRES_DB, | ||
// password: process.env.POSTGRES_PASSWORD, | ||
// host: process.env.POSTGRES_HOST, | ||
// port: process.env.POSTGRES_PORT, | ||
// ssl: {IN | ||
// rejectUnauthorized: false | ||
// } | ||
// }); | ||
// const id = 100; | ||
// A one-shot query | ||
// const {rows} = await sql`SELECT * FROM bible order by book,chapter,verse`; | ||
|
||
let words = await prisma.bible.findMany({ | ||
where: { | ||
book: params.book, | ||
chapter: parseInt(params.chapter) | ||
}, | ||
orderBy: { | ||
verse: 'asc' | ||
} | ||
}) as Bible[] | ||
// Multiple queries on the same connection (improves performance) | ||
// warning: Do not share clients across requests and be sure to release them! | ||
// const client = await sql.connect(); | ||
// // const { rows } = await client.sql`SELECT * FROM users WHERE id = ${userId};`; | ||
// await client.sql`UPDATE users SET status = 'satisfied' WHERE id = ${userId};`; | ||
// client.release(); | ||
let result = words | ||
// console.log(result); | ||
// res.status(200).json(result); | ||
// return {data: result} | ||
return NextResponse.json(result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {NextResponse} from "next/server"; | ||
|
||
import {PrismaClient} from "@prisma/client"; | ||
import * as Prisma from "@prisma/client"; | ||
|
||
// export const dynamic = 'force-dynamic' | ||
const prisma = new PrismaClient(); | ||
|
||
export type BibleBooks = { | ||
oldBooks: Prisma.books[], | ||
newBooks: Prisma.books[] | ||
} | ||
|
||
export async function GET( | ||
request: Request, | ||
) { | ||
let books = await prisma.books.findMany({ | ||
orderBy: { | ||
sort: 'asc' | ||
} | ||
}) as Prisma.books[] | ||
|
||
let res : BibleBooks = { | ||
oldBooks: books.filter(book => book.id < 39), | ||
newBooks: books.filter(book => book.id >= 39) | ||
} | ||
|
||
return NextResponse.json<BibleBooks>(res); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { NextResponse } from "next/server"; | ||
|
||
import { PrismaClient } from "@prisma/client"; | ||
import * as Prisma from "@prisma/client"; | ||
import { sql } from "@vercel/postgres"; | ||
|
||
// export const dynamic = 'force-dynamic' | ||
const prisma = new PrismaClient(); | ||
|
||
|
||
export async function GET( | ||
request: Request, | ||
// {params}: {params:{ book: string }} | ||
) { | ||
let params = new URL(request.url).searchParams | ||
let book = params.get("book") | ||
console.log(book) | ||
let chapaters = await sql`select DISTINCT chapter from bible WHERE book = ${book} ORDER BY chapter;`; | ||
let res: number[] = chapaters.rows.map(row => row.chapter) | ||
|
||
// let res: BibleBooks = { | ||
// oldBooks: books.filter(book => book.id < 39), | ||
// newBooks: books.filter(book => book.id >= 39) | ||
// } | ||
return NextResponse.json<number[]>(res); | ||
} |
Oops, something went wrong.