This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const nestFieldsInSections = (fields: FieldBase[]): FieldBase[] => { | |
const sections: FieldBase[] = [] | |
fields.forEach((field) => { | |
if (field.type === 'section') { | |
field.subfields = [] | |
sections.push(field) | |
} else if (field.type === 'embed') { | |
const metadata: Embed = JSON.parse(field.section_text) | |
sections[sections.length - 1].metadata = metadata | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const response = await axios({ | |
method: 'GET', | |
url: `${formstackBaseUrl}/form/${formId}?oauth_token=${formstackToken}`, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloServer } from 'apollo-server' | |
import { PrismaClient } from '@prisma/client' | |
import { schema } from './schema' | |
const prismaClient = new PrismaClient() | |
const server = new ApolloServer({ | |
schema, | |
// context is a function that is invoked on every GraphQL request. | |
context: () => ({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// schema.ts | |
import { makeSchema, asNexusMethod } from 'nexus' | |
import { nexusPrisma } from 'nexus-plugin-prisma' | |
import { DateTimeResolver } from 'graphql-scalars' | |
import path from 'path' | |
// This is types we had created | |
import * as types from './typeDefs' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const budget = objectType({ | |
name: BUDGET, | |
definition(t) { | |
t.model.id() | |
t.model.name() | |
t.model.amount() | |
t.model.fiscalYearStart() | |
t.model.fiscalYearEnd() | |
}, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { NexusGenAllTypes, NexusGenFieldTypes } from 'typegen-nexus' | |
type Nonprofit = NexusGenAllTypes['Nonprofit'] | |
type GetAllNonprofit = NexusGenFieldTypes['Query']['getAllNonprofit'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// typeDefs.ts | |
import { objectType, extendType, enumType } from 'nexus' | |
import { NonprofitType } from '@prisma/client' | |
const NONPROFIT = 'Nonprofit' | |
const BUDGET = 'Budget' | |
const NONPROFIT_TYPE = 'NonprofitType' | |
export const nonprofit = objectType({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example.ts | |
// files you need to reference the type in your database | |
import type { Nonprofit, Budget, NonprofitType } from '@prisma/client' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prisma.schema | |
generator prisma_client { | |
provider = "prisma-client-js" | |
binaryTargets = ["native"] | |
} | |
datasource db { | |
provider = "postgresql" | |
url = env("DATABASE_URL") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pem=${1} | |
shift | |
nodes="${@}" | |
if [ -z ${pem} ] || [ -z "${nodes}" ]; then | |
echo "Usage `basename ${0}` <pem-file> <ip1> <ip2> .." | |
exit 1 | |
fi |
NewerOlder