2023-05-12 04:59:15 +00:00
/ * *
* @deprecated
* This file is deprecated . The only use of this file is to seed the database for E2E tests . Each test should take care of seeding it ' s own data going forward .
* /
2023-03-15 07:50:03 +00:00
import type { Prisma } from "@prisma/client" ;
2022-08-15 20:45:15 +00:00
import dotEnv from "dotenv" ;
2023-06-28 16:22:51 +00:00
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData" ;
2022-05-02 20:39:35 +00:00
import prisma from "." ;
2023-06-28 16:22:51 +00:00
import { AppCategories } from "./enums" ;
2022-05-02 20:39:35 +00:00
2022-08-15 20:45:15 +00:00
dotEnv . config ( { path : "../../.env.appStore" } ) ;
2022-08-13 11:04:57 +00:00
export const seededForm = {
id : "948ae412-d995-4865-875a-48302588de03" ,
name : "Seeded Form - Pro" ,
} ;
2022-07-28 10:50:25 +00:00
async function seedAppData() {
const form = await prisma . app_RoutingForms_Form . findUnique ( {
where : {
2022-08-13 11:04:57 +00:00
id : seededForm.id ,
2022-07-28 10:50:25 +00:00
} ,
} ) ;
if ( form ) {
console . log ( ` Skipping Routing Form - Form Seed, "Seeded Form - Pro" already exists ` ) ;
return ;
}
2022-08-04 14:15:23 +00:00
const proUser = await prisma . user . findFirst ( {
where : {
username : "pro" ,
} ,
} ) ;
if ( ! proUser ) {
console . log ( ` Skipping Routing Form - Seeding - Pro User not found ` ) ;
return ;
}
2022-07-28 10:50:25 +00:00
await prisma . app_RoutingForms_Form . create ( {
data : {
2022-08-13 11:04:57 +00:00
id : seededForm.id ,
2022-07-28 10:50:25 +00:00
routes : [
{
id : "8a898988-89ab-4cde-b012-31823f708642" ,
action : { type : "eventTypeRedirectUrl" , value : "pro/30min" } ,
queryValue : {
id : "8a898988-89ab-4cde-b012-31823f708642" ,
type : "group" ,
children1 : {
"8988bbb8-0123-4456-b89a-b1823f70c5ff" : {
type : "rule" ,
properties : {
field : "c4296635-9f12-47b1-8153-c3a854649182" ,
value : [ "event-routing" ] ,
operator : "equal" ,
valueSrc : [ "value" ] ,
valueType : [ "text" ] ,
} ,
} ,
} ,
} ,
} ,
{
id : "aa8aaba9-cdef-4012-b456-71823f70f7ef" ,
action : { type : "customPageMessage" , value : "Custom Page Result" } ,
queryValue : {
id : "aa8aaba9-cdef-4012-b456-71823f70f7ef" ,
type : "group" ,
children1 : {
"b99b8a89-89ab-4cde-b012-31823f718ff5" : {
type : "rule" ,
properties : {
field : "c4296635-9f12-47b1-8153-c3a854649182" ,
value : [ "custom-page" ] ,
operator : "equal" ,
valueSrc : [ "value" ] ,
valueType : [ "text" ] ,
} ,
} ,
} ,
} ,
} ,
{
id : "a8ba9aab-4567-489a-bcde-f1823f71b4ad" ,
action : { type : "externalRedirectUrl" , value : "https://google.com" } ,
queryValue : {
id : "a8ba9aab-4567-489a-bcde-f1823f71b4ad" ,
type : "group" ,
children1 : {
"998b9b9a-0123-4456-b89a-b1823f7232b9" : {
type : "rule" ,
properties : {
field : "c4296635-9f12-47b1-8153-c3a854649182" ,
value : [ "external-redirect" ] ,
operator : "equal" ,
valueSrc : [ "value" ] ,
valueType : [ "text" ] ,
} ,
} ,
} ,
} ,
} ,
2022-08-13 11:04:57 +00:00
{
id : "aa8ba8b9-0123-4456-b89a-b182623406d8" ,
action : { type : "customPageMessage" , value : "Multiselect chosen" } ,
queryValue : {
id : "aa8ba8b9-0123-4456-b89a-b182623406d8" ,
type : "group" ,
children1 : {
"b98a8abb-cdef-4012-b456-718262343d27" : {
type : "rule" ,
properties : {
field : "d4292635-9f12-17b1-9153-c3a854649182" ,
value : [ [ "Option-2" ] ] ,
operator : "multiselect_equals" ,
valueSrc : [ "value" ] ,
valueType : [ "multiselect" ] ,
} ,
} ,
} ,
} ,
} ,
2022-07-28 10:50:25 +00:00
{
id : "898899aa-4567-489a-bcde-f1823f708646" ,
action : { type : "customPageMessage" , value : "Fallback Message" } ,
isFallback : true ,
queryValue : { id : "898899aa-4567-489a-bcde-f1823f708646" , type : "group" } ,
} ,
] ,
fields : [
{ id : "c4296635-9f12-47b1-8153-c3a854649182" , type : "text" , label : "Test field" , required : true } ,
2022-08-13 11:04:57 +00:00
{
id : "d4292635-9f12-17b1-9153-c3a854649182" ,
type : "multiselect" ,
label : "Multi Select" ,
identifier : "multi" ,
selectText : "Option-1\nOption-2" ,
required : false ,
} ,
2022-07-28 10:50:25 +00:00
] ,
user : {
connect : {
feat: Organizations (#8993)
* Initial commit
* Adding feature flag
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* Letting duplicate slugs for teams to support orgs
* Covering null on unique clauses
* Supporting having the orgId in the session cookie
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Making sure we let localhost still work
* Feedback
* Type check fixes
* feat: Organization branding in side menu (#9279)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Making sure we show the set up profile on org only
* Profile username availability rely on org hook
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Update apps/web/pages/team/[slug].tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: Organization support for event types page (#9449)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Org branding provider used in shell sidebar
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Using org avatar (temp)
* Not showing org logo if not set
* User onboarding with org branding (slug)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Feedback
* Org public profile
* Public profiles for team event types
* Added setup profile alert
* Using org avatar on subteams avatar
* Processing orgs and children as profile options
* Reverting change not belonging to this PR
* Making sure we show the set up profile on org only
* Removing console.log
* Comparing memberships to choose the highest one
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Type errors
* Refactor and type fixes
* Update orgDomains.ts
* Feedback
* Reverting
* NIT
* fix issue getting org slug from domain
* Improving orgDomains util
* Host comes with port
* Update useRouterQuery.ts
* Feedback
* Feedback
* Feedback
* Feedback: SSR for user event-types to have org context
* chore: Cache node_modules (#9492)
* Adding check for cache hit
* Adding a separate install step first
* Put the restore cache steps back
* Revert the uses type for restoring cache
* Added step to restore nm cache
* Removed the cache-hit check
* Comments and naming
* Removed extra install command
* Updated the name of the linting step to be more clear
* Removes the need for useEffect here
* Feedback
* Feedback
* Cookie domain needs a dot
* Type fix
* Update apps/web/public/static/locales/en/common.json
Co-authored-by: Omar López <zomars@me.com>
* Update packages/emails/src/templates/OrganizationAccountVerifyEmail.tsx
* Feedback
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Efraín Rochín <roae.85@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
2023-06-14 21:40:20 +00:00
email_username : {
username : "pro" ,
email : "pro@example.com" ,
} ,
2022-07-28 10:50:25 +00:00
} ,
} ,
2022-08-13 11:04:57 +00:00
name : seededForm.name ,
2022-07-28 10:50:25 +00:00
} ,
} ) ;
}
2022-05-02 20:39:35 +00:00
async function createApp (
2022-05-06 17:21:30 +00:00
/** The App identifier in the DB also used for public page in `/apps/[slug]` */
2022-05-02 20:39:35 +00:00
slug : Prisma.AppCreateInput [ "slug" ] ,
/** The directory name for `/packages/app-store/[dirName]` */
dirName : Prisma.AppCreateInput [ "dirName" ] ,
categories : Prisma.AppCreateInput [ "categories" ] ,
2022-05-04 04:06:20 +00:00
/** This is used so credentials gets linked to the correct app */
2022-05-02 22:02:45 +00:00
type : Prisma . CredentialCreateInput [ "type" ] ,
2023-01-18 22:30:25 +00:00
keys? : Prisma.AppCreateInput [ "keys" ] ,
isTemplate? : boolean
2022-05-02 20:39:35 +00:00
) {
2023-04-20 04:41:14 +00:00
try {
const foundApp = await prisma . app . findFirst ( {
/ * *
* slug and dirName both are unique and any of them can be used to find the app uniquely
* Using both here allows us to rename ( after the app has been seeded already ) ` slug ` or ` dirName ` while still finding the app to apply the change on .
* Note : dirName is legacy and it is same as slug for all apps created through App - Store Cli .
* - Take the case there was an app with slug ` myvideo ` and dirName ` dirName-1 ` and that got seeded . Now , someone wants to rename the slug to ` my-video ` ( more readable ) for the app keeping dirName same .
* This would make this fn to be called with slug ` my-video ` and dirName ` dirName-1 ` .
* Now , we can find the app because dirName would still match .
* - Similar , if someone changes dirName keeping slug same , we can find the app because slug would still match .
* - If both dirName and slug are changed , it will be added as a new entry in the DB .
* /
where : {
OR : [
{
slug ,
} ,
{
dirName ,
} ,
] ,
} ,
} ) ;
// We need to enable seeded apps as they are used in tests.
const data = { slug , dirName , categories , keys , enabled : true } ;
if ( ! foundApp ) {
await prisma . app . create ( {
data ,
} ) ;
console . log ( ` 📲 Created ${ isTemplate ? "template" : "app" } : ' ${ slug } ' ` ) ;
} else {
// We know that the app exists, so either it would have the same slug or dirName
// Because update query can't have both slug and dirName, try to find the app to update by slug and dirName one by one
// if there would have been a unique App.uuid, that never changes, we could have used that in update query.
await prisma . app . update ( {
where : { slug : foundApp.slug } ,
data ,
} ) ;
await prisma . app . update ( {
where : { dirName : foundApp.dirName } ,
data ,
} ) ;
console . log ( ` 📲 Updated ${ isTemplate ? "template" : "app" } : ' ${ slug } ' ` ) ;
}
await prisma . credential . updateMany ( {
// Credential should stop using type and instead use an App.uuid to refer to app deterministically. That uuid would never change even if slug/dirName changes.
// This would allow credentials to be not orphaned when slug(appId) changes.
where : { type } ,
data : { appId : slug } ,
} ) ;
} catch ( e ) {
console . log ( ` Could not upsert app: ${ slug } . Error: ` , e ) ;
}
2022-05-02 20:39:35 +00:00
}
2022-07-28 10:50:25 +00:00
export default async function main() {
2022-05-02 20:39:35 +00:00
// Calendar apps
2022-05-02 22:02:45 +00:00
await createApp ( "apple-calendar" , "applecalendar" , [ "calendar" ] , "apple_calendar" ) ;
2023-08-19 20:04:56 +00:00
if (
process . env . BASECAMP3_CLIENT_ID &&
process . env . BASECAMP3_CLIENT_SECRET &&
process . env . BASECAMP3_USER_AGENT
) {
await createApp ( "basecamp3" , "basecamp3" , [ "other" ] , "basecamp3_other" , {
client_id : process.env.BASECAMP3_CLIENT_ID ,
client_secret : process.env.BASECAMP3_CLIENT_SECRET ,
user_agent : process.env.BASECAMP3_USER_AGENT ,
} ) ;
}
2022-05-02 22:02:45 +00:00
await createApp ( "caldav-calendar" , "caldavcalendar" , [ "calendar" ] , "caldav_calendar" ) ;
2022-05-02 20:39:35 +00:00
try {
2022-08-15 20:45:15 +00:00
const { client_secret , client_id , redirect_uris } = JSON . parse (
process . env . GOOGLE_API_CREDENTIALS || ""
) . web ;
2022-05-02 22:02:45 +00:00
await createApp ( "google-calendar" , "googlecalendar" , [ "calendar" ] , "google_calendar" , {
client_id ,
client_secret ,
redirect_uris ,
} ) ;
2023-06-28 16:22:51 +00:00
await createApp ( "google-meet" , "googlevideo" , [ "conferencing" ] , "google_video" , {
2022-05-02 20:39:35 +00:00
client_id ,
client_secret ,
redirect_uris ,
} ) ;
} catch ( e ) {
if ( e instanceof Error ) console . error ( "Error adding google credentials to DB:" , e . message ) ;
}
if ( process . env . MS_GRAPH_CLIENT_ID && process . env . MS_GRAPH_CLIENT_SECRET ) {
2022-05-02 22:02:45 +00:00
await createApp ( "office365-calendar" , "office365calendar" , [ "calendar" ] , "office365_calendar" , {
2022-05-02 20:39:35 +00:00
client_id : process.env.MS_GRAPH_CLIENT_ID ,
client_secret : process.env.MS_GRAPH_CLIENT_SECRET ,
} ) ;
2023-06-28 16:22:51 +00:00
await createApp ( "msteams" , "office365video" , [ "conferencing" ] , "office365_video" , {
2022-05-13 12:20:50 +00:00
client_id : process.env.MS_GRAPH_CLIENT_ID ,
client_secret : process.env.MS_GRAPH_CLIENT_SECRET ,
} ) ;
2022-05-02 20:39:35 +00:00
}
2022-08-05 17:56:20 +00:00
if (
process . env . LARK_OPEN_APP_ID &&
process . env . LARK_OPEN_APP_SECRET &&
process . env . LARK_OPEN_VERIFICATION_TOKEN
) {
await createApp ( "lark-calendar" , "larkcalendar" , [ "calendar" ] , "lark_calendar" , {
app_id : process.env.LARK_OPEN_APP_ID ,
app_secret : process.env.LARK_OPEN_APP_SECRET ,
open_verification_token : process.env.LARK_OPEN_VERIFICATION_TOKEN ,
} ) ;
}
2022-05-02 20:39:35 +00:00
// Video apps
if ( process . env . DAILY_API_KEY ) {
2023-06-28 16:22:51 +00:00
await createApp ( "daily-video" , "dailyvideo" , [ "conferencing" ] , "daily_video" , {
2022-05-02 20:39:35 +00:00
api_key : process.env.DAILY_API_KEY ,
scale_plan : process.env.DAILY_SCALE_PLAN ,
} ) ;
}
if ( process . env . TANDEM_CLIENT_ID && process . env . TANDEM_CLIENT_SECRET ) {
2023-06-28 16:22:51 +00:00
await createApp ( "tandem" , "tandemvideo" , [ "conferencing" ] , "tandem_video" , {
2022-05-02 20:39:35 +00:00
client_id : process.env.TANDEM_CLIENT_ID as string ,
client_secret : process.env.TANDEM_CLIENT_SECRET as string ,
base_url : ( process . env . TANDEM_BASE_URL as string ) || "https://tandem.chat" ,
} ) ;
}
if ( process . env . ZOOM_CLIENT_ID && process . env . ZOOM_CLIENT_SECRET ) {
2023-06-28 16:22:51 +00:00
await createApp ( "zoom" , "zoomvideo" , [ "conferencing" ] , "zoom_video" , {
2022-05-02 20:39:35 +00:00
client_id : process.env.ZOOM_CLIENT_ID ,
client_secret : process.env.ZOOM_CLIENT_SECRET ,
} ) ;
}
2023-06-28 16:22:51 +00:00
await createApp ( "jitsi" , "jitsivideo" , [ "conferencing" ] , "jitsi_video" ) ;
2022-05-02 20:39:35 +00:00
// Other apps
if ( process . env . HUBSPOT_CLIENT_ID && process . env . HUBSPOT_CLIENT_SECRET ) {
2023-06-28 16:22:51 +00:00
await createApp ( "hubspot" , "hubspot" , [ "crm" ] , "hubspot_other_calendar" , {
2022-05-02 20:39:35 +00:00
client_id : process.env.HUBSPOT_CLIENT_ID ,
client_secret : process.env.HUBSPOT_CLIENT_SECRET ,
} ) ;
}
2022-11-22 23:10:31 +00:00
if ( process . env . SALESFORCE_CONSUMER_KEY && process . env . SALESFORCE_CONSUMER_SECRET ) {
2023-06-28 16:22:51 +00:00
await createApp ( "salesforce" , "salesforce" , [ "crm" ] , "salesforce_other_calendar" , {
2022-11-22 23:10:31 +00:00
consumer_key : process.env.SALESFORCE_CONSUMER_KEY ,
consumer_secret : process.env.SALESFORCE_CONSUMER_SECRET ,
} ) ;
}
2023-03-15 07:50:03 +00:00
if ( process . env . ZOHOCRM_CLIENT_ID && process . env . ZOHOCRM_CLIENT_SECRET ) {
2023-06-28 16:22:51 +00:00
await createApp ( "zohocrm" , "zohocrm" , [ "crm" ] , "zohocrm_other_calendar" , {
2023-03-15 07:50:03 +00:00
client_id : process.env.ZOHOCRM_CLIENT_ID ,
client_secret : process.env.ZOHOCRM_CLIENT_SECRET ,
} ) ;
}
2023-06-28 16:22:51 +00:00
await createApp ( "wipe-my-cal" , "wipemycalother" , [ "automation" ] , "wipemycal_other" ) ;
2022-05-02 20:39:35 +00:00
if ( process . env . GIPHY_API_KEY ) {
2022-05-02 22:02:45 +00:00
await createApp ( "giphy" , "giphy" , [ "other" ] , "giphy_other" , {
2022-05-02 20:39:35 +00:00
api_key : process.env.GIPHY_API_KEY ,
} ) ;
}
2022-06-21 20:58:07 +00:00
2022-05-06 17:21:30 +00:00
if ( process . env . VITAL_API_KEY && process . env . VITAL_WEBHOOK_SECRET ) {
2023-06-28 16:22:51 +00:00
await createApp ( "vital-automation" , "vital" , [ "automation" ] , "vital_other" , {
2022-05-06 17:21:30 +00:00
mode : process.env.VITAL_DEVELOPMENT_MODE || "sandbox" ,
region : process.env.VITAL_REGION || "us" ,
api_key : process.env.VITAL_API_KEY ,
webhook_secret : process.env.VITAL_WEBHOOK_SECRET ,
} ) ;
}
2022-05-11 04:58:10 +00:00
if ( process . env . ZAPIER_INVITE_LINK ) {
2022-09-15 08:16:56 +00:00
await createApp ( "zapier" , "zapier" , [ "automation" ] , "zapier_automation" , {
2022-05-11 04:58:10 +00:00
invite_link : process.env.ZAPIER_INVITE_LINK ,
} ) ;
}
2023-09-04 14:52:34 +00:00
await createApp ( "make" , "make" , [ "automation" ] , "make_automation" , {
invite_link : "https://make.com/en/hq/app-invitation/6cb2772b61966508dd8f414ba3b44510" ,
} ) ;
2023-06-28 16:22:51 +00:00
await createApp ( "huddle01" , "huddle01video" , [ "conferencing" ] , "huddle01_video" ) ;
2022-11-10 11:54:15 +00:00
2022-05-02 20:39:35 +00:00
// Payment apps
if (
process . env . STRIPE_CLIENT_ID &&
process . env . STRIPE_PRIVATE_KEY &&
process . env . NEXT_PUBLIC_STRIPE_PUBLIC_KEY &&
2023-01-10 01:50:49 +00:00
process . env . STRIPE_WEBHOOK_SECRET &&
process . env . PAYMENT_FEE_FIXED &&
process . env . PAYMENT_FEE_PERCENTAGE
2022-05-02 20:39:35 +00:00
) {
2022-05-02 22:02:45 +00:00
await createApp ( "stripe" , "stripepayment" , [ "payment" ] , "stripe_payment" , {
2022-05-02 20:39:35 +00:00
client_id : process.env.STRIPE_CLIENT_ID ,
client_secret : process.env.STRIPE_PRIVATE_KEY ,
2023-01-10 01:50:49 +00:00
payment_fee_fixed : Number ( process . env . PAYMENT_FEE_FIXED ) ,
payment_fee_percentage : Number ( process . env . PAYMENT_FEE_PERCENTAGE ) ,
2022-05-02 20:39:35 +00:00
public_key : process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY ,
webhook_secret : process.env.STRIPE_WEBHOOK_SECRET ,
} ) ;
}
2022-06-07 06:13:32 +00:00
2023-06-28 16:22:51 +00:00
for ( const [ , app ] of Object . entries ( appStoreMetadata ) ) {
if ( app . isTemplate && process . argv [ 2 ] !== "seed-templates" ) {
2023-01-18 22:30:25 +00:00
continue ;
}
2023-06-28 16:22:51 +00:00
const validatedCategories = app . categories . filter (
( category ) : category is AppCategories = > category in AppCategories
) ;
2023-01-18 22:30:25 +00:00
await createApp (
2023-06-28 16:22:51 +00:00
app . slug ,
app . dirName ? ? app . slug ,
validatedCategories ,
app . type ,
2023-01-18 22:30:25 +00:00
undefined ,
2023-06-28 16:22:51 +00:00
app . isTemplate
2023-01-18 22:30:25 +00:00
) ;
2022-06-07 06:13:32 +00:00
}
2022-05-02 20:39:35 +00:00
2022-07-28 10:50:25 +00:00
await seedAppData ( ) ;
}
2022-08-04 14:15:23 +00:00
main ( )
. catch ( ( e ) = > {
console . error ( e ) ;
process . exit ( 1 ) ;
} )
. finally ( async ( ) = > {
await prisma . $disconnect ( ) ;
} ) ;