|
| 1 | +# Queries |
| 2 | + |
| 3 | +```graphql |
| 4 | + |
| 5 | +###### Begin: Extending existing types ###### |
| 6 | +type Company { |
| 7 | + credit: CompanyCredit! @doc(description: "Company credit balance") |
| 8 | + credit_history(filter: CompanyCreditHistoryFilterInput, pageSize: Int = 20, currentPage: Int = 1): CompanyCreditHistory! @doc(description: "Company credit operations history") |
| 9 | +} |
| 10 | +###### End: Extending existing types ###### |
| 11 | + |
| 12 | + |
| 13 | +###### Begin: Defining new types ###### |
| 14 | +type CompanyCreditHistory { |
| 15 | + items: [CompanyCreditOperation]! @doc(description: "An array of company credit operations") |
| 16 | + page_info: SearchResultPageInfo! @doc(description: "Metadata for pagination rendering") |
| 17 | + total_count: Int @doc(description: "The number of the company credit operations matching the specified filter") |
| 18 | +} |
| 19 | + |
| 20 | +type CompanyCreditOperation { |
| 21 | + date: String! @doc(description: "The date of the company credit operation") |
| 22 | + type: CompanyCreditOperationType! @doc(description: "The type of the company credit operation") |
| 23 | + amount: Money @doc(description: "The amount fo the company credit operation") |
| 24 | + balance: CompanyCredit! @doc(description: "Credit balance after the company credit operation") |
| 25 | + purchase_order: String @doc(description: "Purchase order number associated with the company credit operation") |
| 26 | + updated_by: CompanyCreditOperationUser! @doc(description: "The user submitting the company credit operation") |
| 27 | +} |
| 28 | + |
| 29 | +type CompanyCreditOperationUser { |
| 30 | + name: String! @doc(description: "The name of the user submitting the company credit operation") |
| 31 | + type: CompanyCreditOperationUserType! @doc(description: "The type of the user submitting the company credit operation") |
| 32 | +} |
| 33 | + |
| 34 | +type CompanyCredit { |
| 35 | + outstanding_balance: Money! @doc(description: "Outstanding company credit") |
| 36 | + available_credit: Money! @doc(description: "Available company credit") |
| 37 | + credit_limit: Money! @doc(description: "Company credit limit") |
| 38 | +} |
| 39 | + |
| 40 | +enum CompanyCreditOperationType { |
| 41 | + ALLOCATION |
| 42 | + UPDATE |
| 43 | + PURCHASE |
| 44 | + REIMBURSEMENT |
| 45 | + REFUND |
| 46 | + REVERT |
| 47 | +} |
| 48 | + |
| 49 | +enum CompanyCreditOperationUserType { |
| 50 | + CUSTOMER |
| 51 | + ADMIN |
| 52 | +} |
| 53 | + |
| 54 | +input CompanyCreditHistoryFilterInput { |
| 55 | + operation_type: CompanyCreditOperationType @doc(description: "Enum filter by the type of the company credit operation") |
| 56 | + purchase_order: String @doc(description: "Free text filter by the purchase order number associated with the company credit operation") |
| 57 | + updated_by: String @doc(description: "Free text filter by the name of the person submitting the company credit operation") |
| 58 | +} |
| 59 | +###### End: Defining new types ###### |
| 60 | + |
| 61 | +``` |
| 62 | + |
| 63 | + |
| 64 | + |
0 commit comments