feat: rename revokeInvite to deleteInvite and update related functionality

This commit is contained in:
shuaiplus
2026-06-29 11:47:05 +08:00
parent 4378e1b430
commit f82dcc3c17
15 changed files with 71 additions and 39 deletions
+3 -4
View File
@@ -151,11 +151,10 @@ export async function revertInviteUsed(db: D1Database, code: string, userId: str
return (result.meta.changes ?? 0) > 0;
}
export async function revokeInvite(db: D1Database, code: string): Promise<boolean> {
const now = new Date().toISOString();
export async function deleteInvite(db: D1Database, code: string): Promise<boolean> {
const result = await db
.prepare("UPDATE invites SET status = 'revoked', updated_at = ? WHERE code = ? AND status = 'active'")
.bind(now, code)
.prepare('DELETE FROM invites WHERE code = ?')
.bind(code)
.run();
return (result.meta.changes ?? 0) > 0;
}