fix(plugin-verification): fix duplication of installation (#2097)

This commit is contained in:
Junyi 2023-06-21 20:59:19 +07:00 committed by GitHub
parent 1006a66a6f
commit 6254fceb04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,12 @@ export default class VerificationPlugin extends Plugin {
INIT_ALI_SMS_VERIFY_CODE_SIGN INIT_ALI_SMS_VERIFY_CODE_SIGN
) { ) {
const ProviderRepo = this.db.getRepository('verifications_providers'); const ProviderRepo = this.db.getRepository('verifications_providers');
const existed = await ProviderRepo.count({
filterByTk: DEFAULT_SMS_VERIFY_CODE_PROVIDER,
});
if (existed) {
return;
}
await ProviderRepo.create({ await ProviderRepo.create({
values: { values: {
id: DEFAULT_SMS_VERIFY_CODE_PROVIDER, id: DEFAULT_SMS_VERIFY_CODE_PROVIDER,