Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
chore: proper use of codegen (#219)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Burtey <[email protected]>
  • Loading branch information
nicolasburtey and Nicolas Burtey authored Jul 9, 2023
1 parent 160b056 commit 07017d1
Show file tree
Hide file tree
Showing 39 changed files with 5,068 additions and 4,123 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
graphql/__generated__
ci/

.next
.vscode

.github
ci/vendor

generated.ts
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ With a default installation, Admin Panel can be accessed with `admin.domain.com`

This project uses Next.js, to run it locally, you need to set the following environment variables (in a `.env.local` file):

```
NEXT_PUBLIC_GRAPHQL_URL=http://localhost:4002/admin/graphql
NEXT_PUBLIC_GALOY_AUTH_ENDPOINT=http://localhost:4002/auth
```

for staging:

```
NEXT_PUBLIC_GRAPHQL_URL=https://admin-api.staging.galoy.io/graphql
NEXT_PUBLIC_GALOY_AUTH_ENDPOINT=https://admin-api.staging.galoy.io/auth
Expand Down
22 changes: 0 additions & 22 deletions codegen.ts

This file was deleted.

56 changes: 56 additions & 0 deletions codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
overwrite: true
schema:
- "https://raw.githubusercontent.com/GaloyMoney/galoy/main/src/graphql/admin/schema.graphql"
documents:
- "graphql.gql"
generates:
generated.ts:
plugins:
- typescript
- typescript-operations
- typescript-react-apollo
- add:
content: "// this file is autogenerated by codegen"
- add:
content: "\/* eslint-disable *\/"
config:
# typesPrefix: GQL
enumsAsConst: true
immutableTypes: true
strictScalars: true
nonOptionalTypename: true
scalars:
AccountApiKeyLabel: "string"
AuthToken: "string"
CentAmount: "number"
ContactAlias: "string"
Hex32Bytes: "string"
Language: "string"
LnPaymentPreImage: "string"
LnPaymentRequest: "string"
LnPaymentSecret: "string"
Memo: "string"
OnChainAddress: "string"
OnChainTxHash: "string"
OneTimeAuthCode: "string"
PaymentHash: "string"
Phone: "string"
SafeInt: "number"
SatAmount: "number"
SignedAmount: "number"
TargetConfirmations: "number"
Timestamp: "number"
Username: "string"
WalletId: "string"
Seconds: "number"
DisplayCurrency: "string"
SignedDisplayMajorAmount: "string"
CountryCode: "string"
Email: "string"
Flow: "string"
EmailAddress: "string"
TotpSecret: "string"
TotpCode: "string"
Feedback: "string"
Minutes: "string"
LnPubkey: "string"
5 changes: 3 additions & 2 deletions components/account/business-map-update.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"use client"

import { useState, useEffect } from "react"
import { AccountBusinessInfo, AccountData } from "./index"
import { AccountBusinessInfo } from "./index"
import { Account } from "../../generated"

const isValidLatitude = (latitude: number) =>
isFinite(latitude) && Math.abs(latitude) <= 90
Expand All @@ -14,7 +15,7 @@ const isValidBusinessInfo = ({ title, coordinates }: AccountBusinessInfo) =>
isValidTitle(title)

const BusinessMapUpdate: React.FC<{
accountDetails: AccountData
accountDetails: Account
update: (info: AccountBusinessInfo) => void
deleteBusiness: (username: string) => void
updating: boolean
Expand Down
4 changes: 2 additions & 2 deletions components/account/details.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client"

import { AccountData } from "./index"
import { Account } from "../../generated"
import { formatDate } from "../../utils"

const Details: React.FC<{
accountDetails: AccountData
accountDetails: Account
loading?: boolean
}> = ({ accountDetails, loading = false }) => {
const data = accountDetails
Expand Down
Loading

0 comments on commit 07017d1

Please sign in to comment.