mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
refactor: remove unnecessary quota guard and usage report (#7040)
This commit is contained in:
parent
e7accfdab9
commit
1e8121e9fa
3 changed files with 3 additions and 23 deletions
|
@ -37,7 +37,7 @@ export function koaReportSubscriptionUpdates<StateT, ContextT, ResponseBodyT>({
|
|||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
if (methods.includes(ctx.method.toUpperCase() as Method)) {
|
||||
await quota.reportSubscriptionUpdatesUsage(key);
|
||||
void quota.reportSubscriptionUpdatesUsage(key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,13 +6,11 @@ import {
|
|||
type OrganizationRoleKeys,
|
||||
} from '@logto/schemas';
|
||||
import { generateStandardId } from '@logto/shared';
|
||||
import { condArray } from '@silverhand/essentials';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { buildManagementApiContext } from '#src/libraries/hook/utils.js';
|
||||
import koaGuard from '#src/middleware/koa-guard.js';
|
||||
import koaPagination from '#src/middleware/koa-pagination.js';
|
||||
import { koaReportSubscriptionUpdates, koaQuotaGuard } from '#src/middleware/koa-quota-guard.js';
|
||||
import { organizationRoleSearchKeys } from '#src/queries/organization/index.js';
|
||||
import SchemaRouter from '#src/utils/SchemaRouter.js';
|
||||
import { parseSearchOptions } from '#src/utils/search.js';
|
||||
|
@ -34,7 +32,6 @@ export default function organizationRoleRoutes<T extends ManagementApiRouter>(
|
|||
relations: { rolesScopes, rolesResourceScopes },
|
||||
},
|
||||
},
|
||||
libraries: { quota },
|
||||
},
|
||||
]: RouterInitArgs<T>
|
||||
) {
|
||||
|
@ -45,14 +42,7 @@ export default function organizationRoleRoutes<T extends ManagementApiRouter>(
|
|||
unknown,
|
||||
ManagementApiRouterContext
|
||||
>(OrganizationRoles, roles, {
|
||||
middlewares: condArray(
|
||||
koaQuotaGuard({ key: 'organizationsLimit', quota, methods: ['POST', 'PUT'] }),
|
||||
koaReportSubscriptionUpdates({
|
||||
key: 'organizationsLimit',
|
||||
quota,
|
||||
methods: ['POST', 'PUT', 'DELETE'],
|
||||
})
|
||||
),
|
||||
middlewares: [],
|
||||
disabled: { get: true, post: true },
|
||||
errorHandler,
|
||||
searchFields: ['name'],
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { OrganizationScopes } from '@logto/schemas';
|
||||
import { condArray } from '@silverhand/essentials';
|
||||
|
||||
import { koaQuotaGuard, koaReportSubscriptionUpdates } from '#src/middleware/koa-quota-guard.js';
|
||||
import SchemaRouter from '#src/utils/SchemaRouter.js';
|
||||
|
||||
import { errorHandler } from '../organization/utils.js';
|
||||
|
@ -14,19 +12,11 @@ export default function organizationScopeRoutes<T extends ManagementApiRouter>(
|
|||
queries: {
|
||||
organizations: { scopes },
|
||||
},
|
||||
libraries: { quota },
|
||||
},
|
||||
]: RouterInitArgs<T>
|
||||
) {
|
||||
const router = new SchemaRouter(OrganizationScopes, scopes, {
|
||||
middlewares: condArray(
|
||||
koaQuotaGuard({ key: 'organizationsLimit', quota, methods: ['POST', 'PUT'] }),
|
||||
koaReportSubscriptionUpdates({
|
||||
key: 'organizationsLimit',
|
||||
quota,
|
||||
methods: ['POST', 'PUT', 'DELETE'],
|
||||
})
|
||||
),
|
||||
middlewares: [],
|
||||
errorHandler,
|
||||
searchFields: ['name'],
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue