Humane Transaction Flow

 
enum UserInsights {
	Transactions
	Scheduling
}
 
type DateTimeWhereOperator {
	_gt_: DateTime
	_lt_: DateTime
}
 
type TransactionWhere {
	transactionDate: DateTimeWhereOperator
}
 
enum RollUp {
	Day
	Week
	Month
	Quarter
	Year
}
 
type DateTimeGroupBy {
	rollup: RollUp
}
 
enum TransactionCategory {
    Entertainment
    Health
    Utilities
}
 
type TransactionCategoryInsights {
	transactionCategory: TransactionCategory
	percentage: Float!
	total: Float!
	count: Int
}
 
type Income {
	categories: [TransactionCategoryInsights]
	total: Float
}
 
type Expense {
	categories: [TransactionCategoryInsights]
	total: Float
}
 
type MonthsSummary {
	currencySymbol: String
	month: String
	income: Income
	expense: Expense
	saving: Float
}
 
type WeeksSummary {
	currencySymbol: String
	week: String
	income: Income
	expense: Expense
	saving: Float
}
 
union TransactionsSummaryRollup = MonthsSummary | WeeksSummary
 
type TransactionsSummaryResponse {
	income
	expense
	... on MonthsSummary {
		month
	}
	... on WeeksSummary {
		week
	}
}
 
# User Current Insights
 
type UserCurrentInsightTrend {
	name: String!
	value: String!
}
 
type UserCurrentInsights {
	insight: UserInsights!
	value: String!
	trends: [UserCurrentInsightTrend!]!
}
 
type Query {
	userCurrentInsights(orderBy: UserInsightOrderBy): [UserCurrentInsights!]!
	transactionsSummary(groupBy: TransactionGroupBy, where: TransactionWhere): TransactionsSummaryResponse
}

Questions

  1. Insights Screen is a broad one (May be it need another sprint to better design GraphQL based on possible scenarios). Not just thinking in terms of Transaction Flow
  2. Why to use total prefix everywhere?
  3. need explanation for TransactionOrderBy fields
# enums
 
enum OrderBy {
	asc
	desc
}
 
enum UserInsights {
	Transactions
	Scheduling
}
 
enum PaymentFlow {
	Expenses
	Income
}
 
enum Chart {
	PieChart
	LineChart
	DonutChart
}
 
type Pagination {
	limit: Int
	offset: Date
}
 
type Rollup {
	Week
	Month
	Year
}
 
type DateTimeGroupBy {
	rollup: Rollup
}
 
type DateTimeWhereOperator {
	_gt: DateTime
	_lt: DateTime
}
 
# User Current Insights
 
type UserCurrentInsights {
	insight: UserInsights!
	value: String!
	
}
 
# Transactions Summary Timeline
 
type TransactionsSummaryTimelineGroupBy {
	transactionDate: DateTimeGroupBy
}
 
type TransactionsSummaryTimelineWhere {
	transactionDate: DateTimeWhereOperator
}
 
type TransactionsSummaryTimeline {
	totalExpense: Float!
	totalIncome: Float!
	totalSavings: Float!
	transactionDate: EnhancedDateTime!
}
 
# Transactions Category Summary
 
enum TransactionCategory {
	Entertainment
	Health
	Utilities
	Salary
}
 
type TransactionsCategorySummaryWhere {
	transactionDate: DateTimeWhereOperator
}
 
type TransactionCategorySummaryData {
	paymentFlow: PaymentFlow!
	transactionCategory: TransactionCategory!
	totalPercentage: Float!
	totalAmount: Float!
}
 
type TransactionsCategorySummary {
	categories: [TransactionCategorySummaryData!]!
	totalAmount: Float!
}
 
# Transactions
 
enum PaymentStatus {
	PAID
	UNPAID
}
 
enum TransactionType {
	WaterBill
	PhoneBill
}
 
type TransactionsOrderBy {
	transactionId: OrderBy!
	transactionCategory: OrderBy!
	transactionType: OrderBy!
	amount: OrderBy!
	transactionDate: OrderBy!
	paymentStatus: OrderBy!
}
 
type TransactionsGroupBy {
	transactionDate: DateTimeGroupBy
}
 
type TransactionsWhere {
	transactionDate: DateTimeWhereOperator
}
 
type TransactionDocument {
	documentUrl: String!
}
 
type Transaction {
	transactionId: ID!
	transactionCategory: TransactionCategory!
	transactionType: TransactionType!
	amount: Float!
	transactionDate: DateTime
	paymentDueDate: Date
	paymentPaidDate: Date
	paymentStatus: PaymentStatus
	transactionDocuments: [TransactionDocument!]!
}
 
type Query {
	userCurrentInsights(orderBy: UserInsightOrderBy): [UserCurrentInsights!]!
	transactionsSummaryTimeline(pagination: Pagination, groupBy: TransactionsSummaryTimelineGroupBy, where: TransactionSummaryTimelineWhere): [TransactionsSummaryTimeline]!
	transactionsCategorySummary(pagination: Pagination, where: TransactionsCategorySummaryWhere): TransactionsCategorySummary!
	transactions(pagination: Pagination, orderBy: TransactionsOrderBy, groupBy: TransactionsGroupBy, where: TransactionsWhere): [Transaction!]!
}