Skip to content

Commit

Permalink
refactor: remove equal issuerId from query
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Branje <[email protected]>
  • Loading branch information
jeroenbranje committed Jan 30, 2024
1 parent 2217c3c commit eac4d2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/envited.ascs.digital/common/database/queries/users.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExtractTablesWithRelations, and, eq, inArray } from 'drizzle-orm'
import { ExtractTablesWithRelations, eq, inArray } from 'drizzle-orm'
import { PgTransaction } from 'drizzle-orm/pg-core'
import { PostgresJsDatabase } from 'drizzle-orm/postgres-js'
import { PostgresJsQueryResultHKT } from 'drizzle-orm/postgres-js'
Expand All @@ -19,11 +19,11 @@ import {
} from '../schema'
import { Credential, DatabaseConnection, Issuer, User } from '../types'

export const deleteUserById = (db: DatabaseConnection) => async (id: string, issuerId: string) =>
export const deleteUserById = (db: DatabaseConnection) => async (id: string) =>
db
.update(user)
.set({ isActive: false, updatedAt: new Date() })
.where(and(eq(user.id, id), eq(user.issuerId, issuerId)))
.where(eq(user.id, id))
.returning({ updatedId: user.id })

export const getUserById = (db: DatabaseConnection) => async (id: string) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const _deleteUserById =
throw badRequestError('Incorrect permissions')
}

const [deletedUser] = await connection.deleteUserById(user.id, user.issuerId)
const [deletedUser] = await connection.deleteUserById(user.id)

return deletedUser
} catch (e) {
Expand Down

0 comments on commit eac4d2a

Please sign in to comment.