nook: fix idempotent reactivation SQL bind (row object -> id)
This commit is contained in:
@@ -57,9 +57,10 @@ export async function POST(event: APIEvent) {
|
|||||||
args: [license.id, fingerprint]
|
args: [license.id, fingerprint]
|
||||||
});
|
});
|
||||||
if (existingRes.rows.length > 0) {
|
if (existingRes.rows.length > 0) {
|
||||||
|
const existing = existingRes.rows[0] as { id: string }; // row we inserted as an activation
|
||||||
await conn.execute({
|
await conn.execute({
|
||||||
sql: "UPDATE activations SET activated_at = ? WHERE id = ?",
|
sql: "UPDATE activations SET activated_at = ? WHERE id = ?",
|
||||||
args: [new Date().toISOString(), existingRes.rows[0] as { id: string }]
|
args: [new Date().toISOString(), existing.id]
|
||||||
});
|
});
|
||||||
const count = await activeCount(conn, license.id);
|
const count = await activeCount(conn, license.id);
|
||||||
return json({ ok: true, email: license.email, activatedCount: count });
|
return json({ ok: true, email: license.email, activatedCount: count });
|
||||||
|
|||||||
Reference in New Issue
Block a user