0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

fix(core): exclude demo connector for quota (#4245)

This commit is contained in:
wangsijie 2023-07-26 11:26:35 +08:00 committed by GitHub
parent 16d83dd2f1
commit 0aa00307cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
import { ConnectorType } from '@logto/connector-kit';
import { ConnectorType, DemoConnector } from '@logto/connector-kit';
import { EnvSet } from '#src/env-set/index.js';
import RequestError from '#src/errors/RequestError/index.js';
@ -55,12 +55,16 @@ export const createQuotaLibrary = (
},
socialConnectorsLimit: async () => {
const connectors = await getLogtoConnectors();
const count = connectors.filter(({ type }) => type === ConnectorType.Social).length;
const count = connectors.filter(
({ type, metadata: { id } }) => type === ConnectorType.Social && id !== DemoConnector.Social
).length;
return { count };
},
standardConnectorsLimit: async () => {
const connectors = await getLogtoConnectors();
const count = connectors.filter(({ metadata: { isStandard } }) => isStandard).length;
const count = connectors.filter(
({ metadata: { isStandard, id } }) => isStandard && id !== DemoConnector.Social
).length;
return { count };
},
customDomainEnabled: notNumber,