From d55c6476cae3e49ea2025875cd9fa9dc142df64c Mon Sep 17 00:00:00 2001 From: bodymindarts Date: Fri, 7 Jun 2024 21:12:36 +0200 Subject: [PATCH] fix: check-code --- cala-server/schema.graphql | 393 ++++++++++++++++++++++++++++++++ cala-server/src/job/executor.rs | 4 +- cala-server/src/job/mod.rs | 1 + 3 files changed, 395 insertions(+), 3 deletions(-) diff --git a/cala-server/schema.graphql b/cala-server/schema.graphql index e69de29b..5bc02231 100644 --- a/cala-server/schema.graphql +++ b/cala-server/schema.graphql @@ -0,0 +1,393 @@ +type Account { + id: ID! + accountId: UUID! + version: Int! + code: String! + name: String! + normalBalanceType: DebitOrCredit! + status: Status! + externalId: String + description: String + metadata: JSON + createdAt: Timestamp! + modifiedAt: Timestamp! + balance(journalId: UUID!, currency: CurrencyCode!): Balance +} + +type AccountConnection { + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + A list of edges. + """ + edges: [AccountEdge!]! + """ + A list of nodes. + """ + nodes: [Account!]! +} + +input AccountCreateInput { + accountId: UUID! + externalId: String + code: String! + name: String! + normalBalanceType: DebitOrCredit! = CREDIT + description: String + status: Status! = ACTIVE + metadata: JSON + accountSetIds: [UUID!] +} + +type AccountCreatePayload { + account: Account! +} + +""" +An edge in a connection. +""" +type AccountEdge { + """ + The item at the end of the edge + """ + node: Account! + """ + A cursor for use in pagination + """ + cursor: String! +} + +type AccountSet { + id: ID! + accountSetId: UUID! + version: Int! + journalId: UUID! + name: String! + normalBalanceType: DebitOrCredit! + description: String + metadata: JSON + createdAt: Timestamp! + modifiedAt: Timestamp! + balance(currency: CurrencyCode!): Balance +} + +input AccountSetCreateInput { + accountSetId: UUID! + journalId: UUID! + name: String! + normalBalanceType: DebitOrCredit! = CREDIT + description: String + metadata: JSON +} + +type AccountSetCreatePayload { + accountSet: AccountSet! +} + +enum AccountSetMemberType { + ACCOUNT + ACCOUNT_SET +} + +input AddToAccountSetInput { + accountSetId: UUID! + memberId: UUID! + memberType: AccountSetMemberType! +} + +type AddToAccountSetPayload { + accountSet: AccountSet! +} + +type Balance { + id: ID! + journalId: UUID! + accountId: UUID! + entryId: UUID! + currency: CurrencyCode! + settled: BalanceAmount! + pending: BalanceAmount! + encumbrance: BalanceAmount! + version: Int! +} + +type BalanceAmount { + drBalance: Money! + crBalance: Money! + normalBalance: Money! + entryId: UUID! +} + + +input CalaOutboxImportJobCreateInput { + name: String! + description: String + endpoint: String! +} + +type CalaOutboxImportJobCreatePayload { + job: Job! +} + +scalar CurrencyCode + +scalar Date + +enum DebitOrCredit { + DEBIT + CREDIT +} + +scalar Decimal + +type EntryInput { + entryType: Expression! + accountId: Expression! + layer: Expression! + direction: Expression! + units: Expression! + currency: Expression! + description: Expression +} + +scalar Expression + + + + +scalar JSON + +type Job { + id: ID! + jobId: UUID! + name: String! + description: String +} + +type JobConnection { + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + """ + A list of edges. + """ + edges: [JobEdge!]! + """ + A list of nodes. + """ + nodes: [Job!]! +} + +""" +An edge in a connection. +""" +type JobEdge { + """ + The item at the end of the edge + """ + node: Job! + """ + A cursor for use in pagination + """ + cursor: String! +} + +type Journal { + id: ID! + journalId: UUID! + version: Int! + name: String! + status: Status! + description: String + createdAt: Timestamp! + modifiedAt: Timestamp! +} + +input JournalCreateInput { + journalId: UUID! + name: String! + status: Status! = ACTIVE + description: String +} + +type JournalCreatePayload { + journal: Journal! +} + +type Money { + units: Decimal! + currency: CurrencyCode! +} + +type Mutation { + calaOutboxImportJobCreate(input: CalaOutboxImportJobCreateInput!): CalaOutboxImportJobCreatePayload! + accountCreate(input: AccountCreateInput!): AccountCreatePayload! + accountSetCreate(input: AccountSetCreateInput!): AccountSetCreatePayload! + addToAccountSet(input: AddToAccountSetInput!): AddToAccountSetPayload! + journalCreate(input: JournalCreateInput!): JournalCreatePayload! + txTemplateCreate(input: TxTemplateCreateInput!): TxTemplateCreatePayload! + postTransaction(input: TransactionInput!): PostTransactionPayload! +} + +""" +Information about pagination in a connection +""" +type PageInfo { + """ + When paginating backwards, are there more items? + """ + hasPreviousPage: Boolean! + """ + When paginating forwards, are there more items? + """ + hasNextPage: Boolean! + """ + When paginating backwards, the cursor to continue. + """ + startCursor: String + """ + When paginating forwards, the cursor to continue. + """ + endCursor: String +} + +enum ParamDataType { + STRING + INTEGER + DECIMAL + BOOLEAN + UUID + DATE + TIMESTAMP + JSON +} + +type ParamDefinition { + name: String! + type: ParamDataType! + default: Expression + description: String +} + +input ParamDefinitionInput { + name: String! + type: ParamDataType! + default: Expression + description: String +} + +type PostTransactionPayload { + transaction: Transaction! +} + +type Query { + serverVersion: String! + account(id: UUID!): Account + accountByExternalId(externalId: String!): Account + accounts(first: Int!, after: String): AccountConnection! + accountSet(id: UUID!): AccountSet + journal(id: UUID!): Journal + balance(journalId: UUID!, accountId: UUID!, currency: CurrencyCode!): Balance + transaction(id: UUID!): Transaction + transactionByExternalId(externalId: String!): Transaction + txTemplate(id: UUID!): TxTemplate + txTemplateByCode(code: String!): TxTemplate + jobs(first: Int!, after: String): JobConnection! +} + +enum Status { + ACTIVE + LOCKED +} + + +scalar Timestamp + +type Transaction { + id: ID! + transactionId: UUID! + version: Int! + txTemplateId: UUID! + journalId: UUID! + effective: Date! + correlationId: String! + externalId: String + description: String + metadata: JSON + createdAt: Timestamp! + modifiedAt: Timestamp! +} + +input TransactionInput { + transactionId: UUID! + txTemplateCode: String! + params: JSON +} + +type TxInput { + effective: Expression! + journalId: Expression! + correlationId: Expression + externalId: Expression + description: Expression + metadata: Expression +} + +type TxTemplate { + id: ID! + txTemplateId: UUID! + version: Int! + code: String! + params: [ParamDefinition!] + txInput: TxInput! + entries: [EntryInput!]! + description: String + metadata: JSON + createdAt: Timestamp! + modifiedAt: Timestamp! +} + +input TxTemplateCreateInput { + txTemplateId: UUID! + code: String! + params: [ParamDefinitionInput!] + txInput: TxTemplateTxInput! + entries: [TxTemplateEntryInput!]! + description: String + metadata: JSON +} + +type TxTemplateCreatePayload { + txTemplate: TxTemplate! +} + +input TxTemplateEntryInput { + entryType: Expression! + accountId: Expression! + layer: Expression! + direction: Expression! + units: Expression! + currency: Expression! + description: Expression +} + +input TxTemplateTxInput { + effective: Expression! + journalId: Expression! + correlationId: Expression + externalId: Expression + description: Expression + metadata: Expression +} + +scalar UUID + +directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT +directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT +schema { + query: Query + mutation: Mutation +} diff --git a/cala-server/src/job/executor.rs b/cala-server/src/job/executor.rs index b468a23f..0a282194 100644 --- a/cala-server/src/job/executor.rs +++ b/cala-server/src/job/executor.rs @@ -4,9 +4,7 @@ use tracing::instrument; use std::{collections::HashMap, sync::Arc}; -pub use super::{ - config::*, current::*, entity::*, error::JobError, registry::*, repo::*, traits::*, -}; +use super::{config::*, current::*, entity::*, error::JobError, registry::*, repo::*, traits::*}; use crate::primitives::JobId; #[derive(Clone)] diff --git a/cala-server/src/job/mod.rs b/cala-server/src/job/mod.rs index a1be761b..a74da315 100644 --- a/cala-server/src/job/mod.rs +++ b/cala-server/src/job/mod.rs @@ -22,6 +22,7 @@ pub use traits::*; use error::*; use executor::*; +use repo::*; #[derive(Clone)] pub struct Jobs {