export const link = mutation({
args: {
account: v.object({
user: v.id('users'),
type: v.string(),
provider: v.string(),
providerAccountID: v.string(),
})
},
handler: async (ctx, args) => {
const account = await ctx.db.query('accounts')
.withIndex('by_provider_and_type', q => q.eq('provider', args.account.provider)
.eq('providerAccountID', args.account.providerAccountID)
.eq('type', args.account.type))
.first();
if(!account) return undefined;
return await ctx.db.patch(account._id, args.account )
}
});
export const link = mutation({
args: {
account: v.object({
user: v.id('users'),
type: v.string(),
provider: v.string(),
providerAccountID: v.string(),
})
},
handler: async (ctx, args) => {
const account = await ctx.db.query('accounts')
.withIndex('by_provider_and_type', q => q.eq('provider', args.account.provider)
.eq('providerAccountID', args.account.providerAccountID)
.eq('type', args.account.type))
.first();
if(!account) return undefined;
return await ctx.db.patch(account._id, args.account )
}
});