arwat
arwat
BABetter Auth
Created by arwat on 4/8/2025 in #help
converting bigint
noice, I'm closing and waiting for an update
8 replies
BABetter Auth
Created by arwat on 4/8/2025 in #help
converting bigint
I just added this to the main backend file and it works
declare global {
interface BigInt {
toJSON(): string
}
}

BigInt.prototype.toJSON = function () {
return this.toString()
}
declare global {
interface BigInt {
toJSON(): string
}
}

BigInt.prototype.toJSON = function () {
return this.toString()
}
is it enough or do it differently?
8 replies
BABetter Auth
Created by arwat on 4/8/2025 in #help
converting bigint
drizzle
8 replies
BABetter Auth
Created by arwat on 4/8/2025 in #help
converting bigint
In the database, I made the ID a bigint and in databaseHooks I replace the string generated by the library with a bigint
databaseHooks: {
user: {
create: {
before: async (user) => {
const snowflakeId = snowflake.nextId()
user.id = snowflakeId.toString()

return {
data: {
...user,
},
}
},
},
},
}
databaseHooks: {
user: {
create: {
before: async (user) => {
const snowflakeId = snowflake.nextId()
user.id = snowflakeId.toString()

return {
data: {
...user,
},
}
},
},
},
}
8 replies