Skip to content

Commit

Permalink
fix: 修复版本更新时已注册的设备无法重新注册 #22
Browse files Browse the repository at this point in the history
  • Loading branch information
oustn committed Dec 4, 2024
1 parent d8042fb commit 764320d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/barks/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ export class RegisterEndpoint extends OpenAPIRoute {
try {
// 1. first select
const exist = device.key ? await db.select().from(devices)
.where(and(eq(devices.key, device.key), eq(devices.token, device.token)))
.where(eq(devices.key, device.key))
.get() : false
if (exist) {
await db.update(devices).set({
token: device.token,
})

return c.json({
data: {
key: device.key,
Expand Down

0 comments on commit 764320d

Please sign in to comment.