feat: Cleanup api keys and webhooks for suspended users (#3756)
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
FileOperation,
|
||||
WebhookSubscription,
|
||||
WebhookDelivery,
|
||||
ApiKey,
|
||||
} from "@server/models";
|
||||
import {
|
||||
FileOperationState,
|
||||
@@ -24,6 +25,18 @@ import {
|
||||
|
||||
let count = 1;
|
||||
|
||||
export async function buildApiKey(overrides: Partial<ApiKey> = {}) {
|
||||
if (!overrides.userId) {
|
||||
const user = await buildUser();
|
||||
overrides.userId = user.id;
|
||||
}
|
||||
|
||||
return ApiKey.create({
|
||||
name: "My API Key",
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
export async function buildShare(overrides: Partial<Share> = {}) {
|
||||
if (!overrides.teamId) {
|
||||
const team = await buildTeam();
|
||||
|
||||
Reference in New Issue
Block a user