Skip to content

Commit

Permalink
prefix revert for gql editor integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Matnabru committed Aug 2, 2023
1 parent 032d346 commit f0913e6
Show file tree
Hide file tree
Showing 24 changed files with 227 additions and 226 deletions.
60 changes: 30 additions & 30 deletions packages/integrations/gei-stripe/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

type Query{
products(
filter: StripeProductFilter
): StripeProductsPage
subscriptions(
filter: StripeSubscriptionFilter
): [StripeSubscription!]
filter: ProductFilter
): ProductsPage
subscriptions(
filter: SubscriptionFilter
): [Subscription!]
}

type Mutation{
Expand All @@ -28,24 +28,24 @@ type Mutation{
webhook: String
}

input StripeSubscriptionFilter {
input SubscriptionFilter {
customerId: String
}

type StripeSubscription {
type Subscription {
id: String!
cancel_at_period_end: Boolean!
current_period_end: Timestamp!
current_period_start: Timestamp!
customer: String!
description: String
items:[StripeItem!]!
items:[Item!]!
quantity: Int!
start: Timestamp!
status: StripeSubStatus!
status: SubStatus!
}

enum StripeSubStatus{
enum SubStatus{
incomplete
incomplete_expired
trialing
Expand All @@ -55,16 +55,16 @@ enum StripeSubStatus{
unpaid
}

type StripeItem {
type Item {
id: String!
created: Timestamp!
metadata: AnyObject
price: StripePrice!
price: Price!
quantity: Int!
subscription: String!
}

type StripeUser{
type User{
stripeId: String
email: String!
}
Expand All @@ -73,7 +73,7 @@ input InitStripeCustomerInput{
email: String!
name: String
phone: String
address: StripeAddressInput
address: AddressInput
}

input CreateNewUserPaymentSessionPayload{
Expand All @@ -82,7 +82,7 @@ input CreateNewUserPaymentSessionPayload{
"""
successUrl: String!
cancelUrl: String!
products: [StripeProductInput!]!
products: [ProductInput!]!
}

input CreatePaymentSessionPayload{
Expand All @@ -92,10 +92,10 @@ input CreatePaymentSessionPayload{
"""
successUrl: String!
cancelUrl: String!
products: [StripeProductInput!]!
products: [ProductInput!]!
}

input StripeProductInput{
input ProductInput{
productId: String!
quantity: Int!
}
Expand All @@ -105,7 +105,7 @@ input CreateCustomerPortalPayload{
returnUrl: String!
}

input StripeAddressInput{
input AddressInput{
"""
City, district, suburb, town, village, or ward.
"""
Expand All @@ -132,14 +132,14 @@ input StripeAddressInput{
state: String!
}

type StripeCustomer{
type Customer{
customerId: String!
email: String!
name: String
address: StripeAddress
address: Address
}

type StripeAddress{
type Address{
city: String
country: String
line1: String
Expand All @@ -148,7 +148,7 @@ type StripeAddress{
state: String
}

input StripeProductFilter{
input ProductFilter{
active: Boolean
created: TimestampFilter
limit: Int
Expand All @@ -164,7 +164,7 @@ input RecurringFilter{
usageType: UsageType
}

input StripePriceFilter{
input PriceFilter{
active: Boolean
currency: String
product: ID
Expand All @@ -183,11 +183,11 @@ type Dimensions{
width: Float
}

type StripeProduct{
type Product{
id: ID!
active: Boolean!
created: Timestamp
default_price: StripePrice
default_price: Price
description: String
images: [String!]
livemode: Boolean
Expand All @@ -200,7 +200,7 @@ type StripeProduct{
unitLabel: String
updated: Timestamp
url: String
prices: [StripePrice!]
prices: [Price!]
}

enum BillingScheme{
Expand Down Expand Up @@ -284,7 +284,7 @@ enum Type{
ONE_TIME
}

type StripePrice{
type Price{
id: ID!
active: Boolean
billing_scheme: BillingScheme
Expand All @@ -295,7 +295,7 @@ type StripePrice{
lookup_key: String
metadata: AnyObject
nickname: String
product: StripeProduct
product: Product
recurring: PriceRecurring
tax_behavior: TaxBehaviour
tiers_mode: TiersMode
Expand All @@ -305,8 +305,8 @@ type StripePrice{
unit_amount_decimal: String
}

type StripeProductsPage{
products: [StripeProduct!]
type ProductsPage{
products: [Product!]
startingAfter: ID
endingBefore: ID
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Stripe from 'stripe';
import { MongoOrb } from '../db/orm.js';

export const handler = async (input: FieldResolveInput) =>
resolverFor('StripeProduct','default_price',async (_, src: Stripe.Product) => {
resolverFor('Product','default_price',async (_, src: Stripe.Product) => {
if (typeof src.default_price === "string") {
return await MongoOrb('StripePriceCollection').collection.findOne({ id: src.default_price });
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Stripe from 'stripe';
import { MongoOrb } from '../db/orm.js';

export const handler = async (input: FieldResolveInput) =>
resolverFor('StripeProduct','prices', async (_, src: Stripe.Product) => {
resolverFor('Product','prices', async (_, src: Stripe.Product) => {
const cursor = MongoOrb('StripePriceCollection').collection.find({ product: src.id });
const prices = await cursor.toArray();
return prices;
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/gei-stripe/src/db/orm.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { iGraphQL } from 'i-graphql';
import { ObjectId } from 'mongodb';
import Stripe from 'stripe';
import { StripeUserModel } from '../models/StripeUserModel';
import { UserModel } from '../models/UserModel';

export const orm = async () => {
return iGraphQL<
Expand All @@ -13,7 +13,7 @@ export const orm = async () => {
StripePaymentIntentCollection: Stripe.PaymentIntent,
StripeTaxRateCollection: Stripe.TaxRate,
StripeInvoiceCollection: Stripe.Invoice,
UserCollection: StripeUserModel
UserCollection: UserModel
StripeCustomerCollection: Stripe.Customer
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/gei-stripe/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const integration = NewIntegration({
handler: webhookHandler,
}
},
StripeProduct: {
Product: {
default_price: {
name: 'default_price',
description: 'Resolver for querying default price object',
Expand Down
3 changes: 3 additions & 0 deletions packages/integrations/gei-stripe/src/models/AddressModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type AddressModel = ModelTypes['Address'];
3 changes: 3 additions & 0 deletions packages/integrations/gei-stripe/src/models/CustomerModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type CustomerModel = ModelTypes['Customer'];
3 changes: 3 additions & 0 deletions packages/integrations/gei-stripe/src/models/ItemModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type ItemModel = ModelTypes['Item'];
3 changes: 3 additions & 0 deletions packages/integrations/gei-stripe/src/models/PriceModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type PriceModel = ModelTypes['Price'];
3 changes: 3 additions & 0 deletions packages/integrations/gei-stripe/src/models/ProductModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type ProductModel = ModelTypes['Product'];
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type ProductsPageModel = ModelTypes['ProductsPage'];

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type SubscriptionModel = ModelTypes['Subscription'];
3 changes: 3 additions & 0 deletions packages/integrations/gei-stripe/src/models/UserModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ModelTypes } from '../zeus/index.js';

export type UserModel = ModelTypes['User'];
32 changes: 16 additions & 16 deletions packages/integrations/gei-stripe/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { QueryModel } from './QueryModel.js'
import { MutationModel } from './MutationModel.js'
import { StripeSubscriptionModel } from './StripeSubscriptionModel.js'
import { StripeItemModel } from './StripeItemModel.js'
import { StripeUserModel } from './StripeUserModel.js'
import { StripeCustomerModel } from './StripeCustomerModel.js'
import { StripeAddressModel } from './StripeAddressModel.js'
import { SubscriptionModel } from './SubscriptionModel.js'
import { ItemModel } from './ItemModel.js'
import { UserModel } from './UserModel.js'
import { CustomerModel } from './CustomerModel.js'
import { AddressModel } from './AddressModel.js'
import { DimensionsModel } from './DimensionsModel.js'
import { StripeProductModel } from './StripeProductModel.js'
import { ProductModel } from './ProductModel.js'
import { CustomUnitAmountModel } from './CustomUnitAmountModel.js'
import { PriceRecurringModel } from './PriceRecurringModel.js'
import { TransformQuantityModel } from './TransformQuantityModel.js'
import { StripePriceModel } from './StripePriceModel.js'
import { StripeProductsPageModel } from './StripeProductsPageModel.js'
import { PriceModel } from './PriceModel.js'
import { ProductsPageModel } from './ProductsPageModel.js'


export type Models = {
QueryModel: QueryModel;
MutationModel: MutationModel;
StripeSubscriptionModel: StripeSubscriptionModel;
StripeItemModel: StripeItemModel;
StripeUserModel: StripeUserModel;
StripeCustomerModel: StripeCustomerModel;
StripeAddressModel: StripeAddressModel;
SubscriptionModel: SubscriptionModel;
ItemModel: ItemModel;
UserModel: UserModel;
CustomerModel: CustomerModel;
AddressModel: AddressModel;
DimensionsModel: DimensionsModel;
StripeProductModel: StripeProductModel;
ProductModel: ProductModel;
CustomUnitAmountModel: CustomUnitAmountModel;
PriceRecurringModel: PriceRecurringModel;
TransformQuantityModel: TransformQuantityModel;
StripePriceModel: StripePriceModel;
StripeProductsPageModel: StripeProductsPageModel;
PriceModel: PriceModel;
ProductsPageModel: ProductsPageModel;
};
Loading

0 comments on commit f0913e6

Please sign in to comment.