fix: QueryFailedError when logging user's IPs (#8973)

* fix QueryFailedError when logging user's IPs

* use `orIgnore` to fix
This commit is contained in:
dogcraft 2022-07-10 10:02:46 +08:00 committed by GitHub
parent 111d4d0149
commit d92200a6d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -68,11 +68,11 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise<void>((res
} }
try { try {
UserIps.insert({ UserIps.createQueryBuilder().insert().values({
createdAt: new Date(), createdAt: new Date(),
userId: user.id, userId: user.id,
ip: ip, ip: ip,
}); }).orIgnore(true).execute();
} catch { } catch {
} }
} }