Skip to content

GraphQLクエリ・ミューテーションの型生成 #28

@yu23ki14

Description

@yu23ki14

概要

サブグラフから送金履歴や分配比率を取得するためのGraphQLクエリを定義し、型を自動生成します。

詳細

  • 送金履歴取得クエリの定義
  • ユーザー別送金履歴クエリの定義
  • 最新の分配比率取得クエリの定義
  • 分配比率変更履歴クエリの定義
  • graphql-codegenによる型生成

受け入れ基準

  • app/graphql/queries.tsの作成
  • 送金履歴取得クエリ定義
  • ユーザー送金履歴クエリ定義
  • 分配比率取得クエリ定義
  • pnpm codegenで型生成成功
  • 生成された型ファイルの確認

クエリ例

// app/graphql/queries.ts
import { gql } from '@apollo/client';

export const GET_TRANSFERS = gql`
  query GetTransfers($first: Int!, $skip: Int!) {
    transfers(first: $first, skip: $skip, orderBy: timestamp, orderDirection: desc) {
      id
      from
      to
      totalAmount
      recipientAmount
      fundAmount
      burnAmount
      timestamp
      transactionHash
    }
  }
`;

export const GET_CURRENT_DISTRIBUTION_RATIO = gql`
  query GetCurrentDistributionRatio {
    distributionRatios(first: 1, orderBy: timestamp, orderDirection: desc) {
      id
      fundRatio
      burnRatio
      recipientRatio
      timestamp
    }
  }
`;

技術スタック

  • GraphQL
  • graphql-codegen
  • TypeScript

依存関係

推定工数

1日

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendFrontend development

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions