Skip to content

Commit 043bba2

Browse files
prisma の includeにjoinを追加した (#666)
# PRの概要 close #654 ## 具体的な変更内容 ## 影響範囲 ## 動作要件 ## 補足 ## レビューリクエストを出す前にチェック! - [ ] 改めてセルフレビューしたか - [ ] 手動での動作検証を行ったか - [ ] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [ ] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [ ] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 --> --------- Co-authored-by: naka-12 <104970808+naka-12@users.noreply.github.com>
1 parent 6e75b58 commit 043bba2

8 files changed

Lines changed: 8 additions & 10 deletions

File tree

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"license": "ISC",
1818
"dependencies": {
1919
"@hono/zod-validator": "^0.4.3",
20-
"@prisma/client": "^5.20.0",
20+
"@prisma/client": "5.22.0",
2121
"common": "workspace:common",
2222
"cookie-parser": "^1.4.6",
2323
"cors": "^2.8.5",
@@ -35,7 +35,7 @@
3535
"@types/cookie-parser": "^1.4.7",
3636
"@types/cors": "^2.8.17",
3737
"globals": "^15.8.0",
38-
"prisma": "^5.11.0",
38+
"prisma": "5.22.0",
3939
"typescript": "^5.4.5"
4040
},
4141
"trustedPackages": ["prisma"]

server/prisma/schema.prisma

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
generator client {
33
provider = "prisma-client-js"
44
binaryTargets = ["native", "debian-openssl-3.0.x"]
5-
previewFeatures = ["typedSql"]
5+
previewFeatures = ["typedSql","relationJoins"]
66
}
77

88
datasource db {

server/src/database/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ export const prisma = new PrismaClient(
3232
prisma.$on("query", (e) => {
3333
console.log(format(e.query, { language: "postgresql" }));
3434
console.log(`Params: ${e.params}`);
35+
console.log(`Duration: ${e.duration}`);
3536
console.log("\n");
3637
});

server/src/database/requests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export async function getPendingRequestsToUser(
116116
include: {
117117
course: {
118118
include: {
119-
enrollments: true,
120119
slots: true,
121120
},
122121
},

server/src/database/users.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export async function getUser(guid: GUID): Promise<UserWithCoursesAndSubjects> {
3131
include: {
3232
course: {
3333
include: {
34-
enrollments: true,
3534
slots: true,
3635
},
3736
},
@@ -84,7 +83,6 @@ export async function getUserByID(
8483
include: {
8584
course: {
8685
include: {
87-
enrollments: true,
8886
slots: true,
8987
},
9088
},
@@ -147,7 +145,6 @@ export async function getAllUsers(): Promise<
147145
include: {
148146
course: {
149147
include: {
150-
enrollments: true,
151148
slots: true,
152149
},
153150
},

server/src/firebase/auth/lib.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type DecodedIdToken = admin.DecodedIdToken;
1111
// THROWS: if idToken is not present in request cookie, or when the token is not valid.
1212
export async function getGUID(c: Context): Promise<GUID> {
1313
const idToken = c.req.header("Authorization");
14-
if (typeof idToken !== "string") error("token not found in query", 401);
14+
if (typeof idToken !== "string") error("token not found in header", 401);
1515
return await getGUIDFromToken(idToken);
1616
}
1717

server/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ if (corsOptions.origin.length > 1) {
3131
const app = new Hono()
3232
.onError((err, c) => {
3333
if (err instanceof HTTPException) {
34+
console.error(err);
3435
c.status(err.status);
3536
return c.json({ error: err });
3637
}

0 commit comments

Comments
 (0)