Fix: appKeys handling (#8406)

* Handle appKeys save and read correctly

* Add missing zod file for zohocrm which needs keys

* Show team invites regardless of user plan

* Linting

---------

Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: zomars <zomars@me.com>
This commit is contained in:
Hariom Balhara
2023-04-20 21:14:50 +00:00
committed by GitHub
co-authored by Joe Au-Yeung Keith Williams zomars
parent 3af5a7404e
commit 986f9dca8d
5 changed files with 14 additions and 3 deletions
+1
View File
@@ -12,6 +12,7 @@ export const appStoreMetadata = {} as AppStoreMetaData;
for (const [key, value] of Object.entries(rawAppStoreMetadata)) {
appStoreMetadata[key as keyof typeof appStoreMetadata] = {
appData: null,
dirName: "dirName" in value ? value.dirName : value.slug,
__template: "",
...value,
} as AppStoreMetaData[keyof AppStoreMetaData];
@@ -24,6 +24,7 @@ import { appKeysSchema as event_type_app_card_zod_ts } from "./templates/event-t
import { appKeysSchema as vital_zod_ts } from "./vital/zod";
import { appKeysSchema as wordpress_zod_ts } from "./wordpress/zod";
import { appKeysSchema as zapier_zod_ts } from "./zapier/zod";
import { appKeysSchema as zohocrm_zod_ts } from "./zohocrm/zod";
import { appKeysSchema as zoomvideo_zod_ts } from "./zoomvideo/zod";
export const appKeysSchemas = {
@@ -49,5 +50,6 @@ export const appKeysSchemas = {
vital: vital_zod_ts,
wordpress: wordpress_zod_ts,
zapier: zapier_zod_ts,
zohocrm: zohocrm_zod_ts,
zoomvideo: zoomvideo_zod_ts,
};
@@ -24,6 +24,7 @@ import { appDataSchema as event_type_app_card_zod_ts } from "./templates/event-t
import { appDataSchema as vital_zod_ts } from "./vital/zod";
import { appDataSchema as wordpress_zod_ts } from "./wordpress/zod";
import { appDataSchema as zapier_zod_ts } from "./zapier/zod";
import { appDataSchema as zohocrm_zod_ts } from "./zohocrm/zod";
import { appDataSchema as zoomvideo_zod_ts } from "./zoomvideo/zod";
export const appDataSchemas = {
@@ -49,5 +50,6 @@ export const appDataSchemas = {
vital: vital_zod_ts,
wordpress: wordpress_zod_ts,
zapier: zapier_zod_ts,
zohocrm: zohocrm_zod_ts,
zoomvideo: zoomvideo_zod_ts,
};
+8
View File
@@ -0,0 +1,8 @@
import { z } from "zod";
export const appKeysSchema = z.object({
client_id: z.string().min(1),
client_secret: z.string().min(1),
});
export const appDataSchema = z.object({});
+1 -3
View File
@@ -255,9 +255,7 @@ export const appsRouter = router({
})
)
.mutation(async ({ ctx, input }) => {
let appKey = deriveAppDictKeyFromType(input.type, appKeysSchemas);
if (!appKey) appKey = deriveAppDictKeyFromType(input.slug, appKeysSchemas);
const keysSchema = appKeysSchemas[appKey as keyof typeof appKeysSchemas];
const keysSchema = appKeysSchemas[input.dirName as keyof typeof appKeysSchemas];
const keys = keysSchema.parse(input.keys);
// Get app name from metadata