Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL 코드젠 수정 #13

Open
kyusooK opened this issue Jun 13, 2024 · 0 comments
Open

GraphQL 코드젠 수정 #13

kyusooK opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
bug 오류사항

Comments

@kyusooK
Copy link
Contributor

kyusooK commented Jun 13, 2024

image

GraphQL의 typedef 내에서는 배열은

이렇게 생성되면 안되고 [Address] 이렇게 생성되어야 함

before: 


import {gql} from 'apollo-server';

const typeDefs = gql`
    scalar Date
    scalar Long
    scalar Double
    scalar Integer

    type Sales {
    	id: Long! 
			qty: Integer 
			status: String 
			companyId: CompanyId 
			itemId: ItemId
    }
    type Production {
    	id: Long! 
			productId: String 
			qty: Integer 
			orderId: Long
    }
    type Company {
    	id: String! 
			name: String 
			addresses: List<Address>
    }
    type User {
    	id: String! 
			email: String 
			name: String 
			addresses: List<Address>
    }
    type Item {
    	id: String! 
			name: String
    }

    type Query {
      sales: [Sales]
      sales(id: Long!): Sales
      productions: [Production]
      production(id: Long!): Production
      companies: [Company]
      company(id: Long!): Company
      users: [User]
      user(id: Long!): User
      items: [Item]
      item(id: Long!): Item
    }
`;

export default typeDefs;




after:


import {gql} from 'apollo-server';

const typeDefs = gql`
    scalar Date
    scalar Long
    scalar Double
    scalar Integer

    type Sales {
    	id: Long! 
			qty: Integer 
			status: String 
			companyId: CompanyId 
			itemId: ItemId
    }
    type Production {
    	id: Long! 
			productId: String 
			qty: Integer 
			orderId: Long
    }
    type CompanyId {
    	id: String! 
			name: String 
    }
    type ItemId {
    	id: String! 
			name: String 
    }
    type Company {
    	id: String! 
			name: String 
			addresses: [Address]
    }
    type User {
    	id: String! 
			email: String 
			name: String 
			addresses: [Address]
    }
    type Item {
    	id: String! 
			name: String
    }
    type Address {
    	city: String! 
			street: String
    }


    type Query {
      sales: [Sales]
      sale(id: Long!): Sales
      productions: [Production]
      production(id: Long!): Production
      companies: [Company]
      company(id: Long!): Company
      users: [User]
      user(id: Long!): User
      items: [Item]
      item(id: Long!): Item
    }
`;

export default typeDefs;

@kyusooK kyusooK added the bug 오류사항 label Jun 13, 2024
@kyusooK kyusooK self-assigned this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 오류사항
Projects
None yet
Development

No branches or pull requests

1 participant