Feat/zapier app (#2623)
* create basic app structure * add zapierSubscription model to prisma.schema * change column name triggerEvent to lower case * add zapier functionality + enpoints + adjust prisma.schema * add subscriptionType + refactor code * add app store information * create setup page to generate api key * clean code * add copy functionality in setup page * clean code * add apiKeyType and delte key when uninstalled or new key generated * clean code * use Promise.all * only approve zapier api key * clean code * fix findValidApiKey for api keys that don't expire * fix migrations * clean code * small fixes * add i18n * add README.md file * add setup guide to README.md * fix yarn.lock * Renames zapierother to zapier * Typo * Updates package name * Rename fixes * Adds zapier to the App Store seeder * Adds missing zapier to apiHandlers * Adds credential relationship to App * Rename fixes * Allows tailwind to pick up custom app-store components * Consolidates zapier_setup_instructions * Webhook fixes * Uses app relationship instead of custom type * Refactors sendPayload to accept webhook object Instead of individual parameters * refactoring * Removes unused zapier check * Update cancel.ts * Refactoring * Removes example comments * Update InstallAppButton.tsx * Type fixes * E2E fixes * Deletes all user zapier webhooks on integration removal Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: zomars <[email protected]>
This commit is contained in:
37 files changed
+660
-57
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { hashAPIKey } from "@calcom/ee/lib/api/apiKeys";
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
const findValidApiKey = async (apiKey: string, appId?: string) => {
|
||||
const hashedKey = hashAPIKey(apiKey.substring(process.env.API_KEY_PREFIX?.length || 0));
|
||||
|
||||
const validKey = await prisma.apiKey.findFirst({
|
||||
where: {
|
||||
AND: [
|
||||
{
|
||||
hashedKey,
|
||||
},
|
||||
{
|
||||
appId,
|
||||
},
|
||||
],
|
||||
OR: [
|
||||
{
|
||||
expiresAt: {
|
||||
gte: new Date(Date.now()),
|
||||
},
|
||||
},
|
||||
{
|
||||
expiresAt: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
return validKey;
|
||||
};
|
||||
|
||||
export default findValidApiKey;
|
||||
Reference in new issue
Block a user