diff options
| author | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-22 16:27:58 +0000 |
|---|---|---|
| committer | Joe Carstairs <jcarstairs@scottlogic.com> | 2024-01-29 10:51:49 +0000 |
| commit | eac3fb00ef11c08a277dd8f9e2684b79f15193c2 (patch) | |
| tree | 1560e57bb5872d698565dc502aa7659d89c830a4 /api/db/_updateAuthenticator.ts | |
| parent | af44cac699b0591eba908db3835c4e5792303095 (diff) | |
Authenticator db functions use Uint8Array type for id, public_key fields
Diffstat (limited to 'api/db/_updateAuthenticator.ts')
| -rw-r--r-- | api/db/_updateAuthenticator.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/api/db/_updateAuthenticator.ts b/api/db/_updateAuthenticator.ts index a7e06e3..6c72327 100644 --- a/api/db/_updateAuthenticator.ts +++ b/api/db/_updateAuthenticator.ts @@ -5,7 +5,7 @@ import { AUTHENTICATORS } from './_tables'; export default async function updateAuthenticator< T extends keyof Omit<Authenticator, 'id'> ->(id: string, updatedFields: Pick<Authenticator, T>): Promise<void> { +>(id: Authenticator['id'], updatedFields: Pick<Authenticator, T>): Promise<void> { const assignments = Object.entries(updatedFields) .filter(([key]) => key !== 'id') // never update the ID .map(([key, value]) => `${key}=${value}`) @@ -14,12 +14,12 @@ export default async function updateAuthenticator< const query = ` UPDATE ${AUTHENTICATORS.name} SET ${assignments} - WHERE ${AUTHENTICATORS.fields.id} = '${id}'; + WHERE ${AUTHENTICATORS.fields.id} = '{ ${id.toString()} }'; `; try { await sql.query(query); } catch (err) { - throw new Error(`Failed to update authenticator with ID ${id} in database. Query was ${query.replace(/\s+/g, ' ')}. ${err}`); + throw new Error(`Failed to update authenticator with ID [${id.toString()}] in database. Query was ${query.replace(/\s+/g, ' ')}. ${err}`); } } |
