Skip to content

Commit

Permalink
refactor: Remove Prisma Accelerate (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoRCD authored Jun 28, 2024
1 parent b331f90 commit 9bc1b75
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
- name: 💅 Lint code
run: bun run lint:fix

- name: 📚 Build docs
run: bunx automd

- uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
with:
commit-message: 'chore: apply automated lint fixes'
4 changes: 2 additions & 2 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"@nuxt/image": "^1.7.0",
"@nuxt/ui": "^2.17.0",
"@prisma/client": "^5.16.0",
"@prisma/extension-accelerate": "^1.1.0",
"@shelve/types": "*",
"@shelve/utils": "*",
"@tsparticles/engine": "^3.4.0",
"@tsparticles/slim": "^3.4.0",
"@types/bcryptjs": "^2.4.6",
"@types/jsonwebtoken": "^9.0.6",
"@types/ua-parser-js": "^0.7.39",
"@vitejs/plugin-vue": "^5.0.5",
"@vue-email/components": "^0.0.17",
Expand All @@ -50,7 +50,7 @@
"prisma": "^5.16.0",
"resend": "^3.4.0",
"ua-parser-js": "^1.0.38",
"vue": "latest",
"vue": "^3.4.31",
"vue-eslint-parser": "^9.4.3",
"vue-router": "^4.4.0",
"vue-sonner": "^1.1.3"
Expand Down
4 changes: 2 additions & 2 deletions apps/app/server/app/authService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export async function generateOtp() {
return { otp, encryptedOtp }
}

export async function deleteOtp(userId: number) {
return await prisma.user.update({
export function deleteOtp(userId: number) {
return prisma.user.update({
where: {
id: userId
},
Expand Down
4 changes: 2 additions & 2 deletions apps/app/server/app/projectService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export async function updateProject(project: ProjectUpdateInput, projectId: numb
})
}

export const getProjectById = cachedFunction(async (id: number) => {
return await prisma.project.findUnique({
export const getProjectById = cachedFunction((id: number) => {
return prisma.project.findUnique({
where: {
id,
},
Expand Down
7 changes: 3 additions & 4 deletions apps/app/server/app/userService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ export async function upsertUser(createUserInput: CreateUserInput) {
return formatUser(user)
}

export async function getUserByEmail(email: string): Promise<User | null> {
return await prisma.user.findUnique({
export function getUserByEmail(email: string): Promise<User | null> {
return prisma.user.findUnique({
where: {
email,
},
cacheStrategy: { ttl: 60 },
}
})
}

Expand Down
3 changes: 1 addition & 2 deletions apps/app/server/database/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { withAccelerate } from '@prisma/extension-accelerate'
import { type User as prismaUser, PrismaClient } from '@prisma/client'
import { Role, type publicUser } from '@shelve/types'

const prisma = new PrismaClient().$extends(withAccelerate())
const prisma = new PrismaClient()

export default prisma

Expand Down
5 changes: 2 additions & 3 deletions apps/app/server/database/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ generator client {
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_DATABASE_URL")
provider = "postgresql"
url = env("DATABASE_URL")
}

model User {
Expand Down
Binary file modified bun.lockb
Binary file not shown.

0 comments on commit 9bc1b75

Please sign in to comment.