types

package
v0.0.0-...-c869e04 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnnualBudget = graphql.NewObject(graphql.ObjectConfig{
	Name: "AnnualBudget",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type: graphql.NewNonNull(graphql.ID),
		},
		"year": &graphql.Field{
			Type: graphql.NewNonNull(graphql.Int),
		},
		"annualBudgetItems": &graphql.Field{
			Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(AnnualBudgetItem))),
		},
	},
})

AnnualBudget is the model type

View Source
var AnnualBudgetItem = graphql.NewObject(graphql.ObjectConfig{
	Name: "AnnualBudgetItem",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type: graphql.NewNonNull(graphql.ID),
		},
		"annualBudgetId": &graphql.Field{
			Type: graphql.NewNonNull(graphql.String),
		},
		"paid": &graphql.Field{
			Type: graphql.NewNonNull(graphql.Boolean),
		},
		"interval": &graphql.Field{
			Type: graphql.NewNonNull(graphql.Int),
		},
		"amount": &graphql.Field{
			Type: graphql.NewNonNull(graphql.String),
		},
		"dueDate": &graphql.Field{
			Type: graphql.NewNonNull(Date),
		},
		"name": &graphql.Field{
			Type: graphql.NewNonNull(graphql.String),
		},
	},
})

AnnualBudgetItem is the model type

AnnualBudgetItemInput is the params to upsert an annual budget item

View Source
var AssetLiability = graphql.NewObject(graphql.ObjectConfig{
	Name: "AssetLiability",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the asset/liability",
		},
		"name": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "Name of the asset/liability",
		},
		"isAsset": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Boolean),
			Description: "Is this an asset instead of a liability?",
		},
	},
})

AssetLiability is the model type

View Source
var Budget = graphql.NewObject(graphql.ObjectConfig{
	Name: "Budget",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the budget",
		},
		"month": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Int),
			Description: "Calendar Month of the budget",
		},
		"year": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Int),
			Description: "Calendar Year of the budget",
		},
		"income": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Expected Income for the month",
		},
		"budgetCategories": &graphql.Field{
			Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(BudgetCategory))),
		},
	},
})

Budget is the model type

View Source
var BudgetCategory = graphql.NewObject(graphql.ObjectConfig{
	Name: "BudgetCategory",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the budget category",
		},
		"budgetId": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the budget",
		},
		"name": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Name of the category",
		},
		"percentage": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Recommended percentage that should be allocated in the budget",
		},
		"budgetItems": &graphql.Field{
			Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(BudgetItem))),
		},
	},
})

BudgetCategory is the model type

View Source
var BudgetCategoryImport = graphql.NewObject(graphql.ObjectConfig{
	Name: "BudgetCategoryImport",
	Fields: graphql.Fields{
		"message": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Import message",
		},
	},
})

BudgetCategoryImport returns a message indicating what was imported

View Source
var BudgetItem = graphql.NewObject(graphql.ObjectConfig{
	Name: "BudgetItem",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the item",
		},
		"budgetCategoryId": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the category",
		},
		"name": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Name of the item",
		},
		"amount": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Amount budgeted for this item",
		},
		"budgetItemExpenses": &graphql.Field{
			Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(BudgetItemExpense))),
		},
	},
})

BudgetItem is the model type

View Source
var BudgetItemExpense = graphql.NewObject(graphql.ObjectConfig{
	Name: "BudgetItemExpense",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the expense",
		},
		"budgetItemId": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the item",
		},
		"name": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Name of the expense",
		},
		"amount": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Amount spent for this expense",
		},
		"date": &graphql.Field{
			Type:        graphql.NewNonNull(Date),
			Description: "Date of the expense",
		},
	},
})

BudgetItemExpense is the model type

BudgetItemExpenseInput is the params to upsert a budget item expense

BudgetItemInput is the params to upsert a budget item

View Source
var Date = graphql.NewScalar(graphql.ScalarConfig{
	Name:        "Date",
	Description: "Returns a Date (e.g. 2006-01-02)",
	Serialize: func(value interface{}) interface{} {
		switch value := value.(type) {
		case string:
			if len(value) > 9 {
				return value[0:10]
			}
			return value
		case time.Time:
			return value.Format("2006-01-02")
		case *time.Time:
			return value.Format("2006-01-02")
		default:
			return nil
		}
	},
})

Date represents a date without time

View Source
var Message = graphql.NewObject(graphql.ObjectConfig{
	Name: "Message",
	Fields: graphql.Fields{
		"message": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Message",
		},
	},
})

Message is the model type

View Source
var MonthlyStatistic = graphql.NewObject(graphql.ObjectConfig{
	Name: "MonthlyStatistic",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the statistic",
		},
		"month": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Int),
			Description: "Calendar Month of the statistic",
		},
		"year": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Int),
			Description: "Calendar Year of the statistic",
		},
		"name": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Name of the budget category",
		},
		"amountSpent": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Amount spent in that category",
		},
		"totalSpent": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Total spent in the month",
		},
		"percentSpent": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Percent spent in that category",
		},
	},
})

MonthlyStatistic is the model type

View Source
var NetWorth = graphql.NewObject(graphql.ObjectConfig{
	Name: "NetWorth",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the NetWorth",
		},
		"month": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Int),
			Description: "Calendar Month of the NetWorth",
		},
		"year": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Int),
			Description: "Calendar Year of the NetWorth",
		},
		"netWorthItems": &graphql.Field{
			Type: graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(NetWorthItem))),
		},
	},
})

NetWorth is the model type

View Source
var NetWorthItem = graphql.NewObject(graphql.ObjectConfig{
	Name: "NetWorthItem",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the item",
		},
		"netWorthId": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the net worth",
		},
		"assetLiabilityId": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Name of the item",
		},
		"amount": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Amount budgeted for this item",
		},
		"asset": &graphql.Field{
			Type: graphql.NewNonNull(AssetLiability),
		},
	},
})

NetWorthItem is the model type

View Source
var NetWorthItemImport = graphql.NewObject(graphql.ObjectConfig{
	Name: "NetWorthItemImport",
	Fields: graphql.Fields{
		"message": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Import message",
		},
		"netWorth": &graphql.Field{
			Type:        graphql.NewNonNull(NetWorth),
			Description: "Net worth month with all items after import finished",
		},
	},
})

NetWorthItemImport returns a message indicating what was imported

View Source
var NewSession = graphql.NewObject(graphql.ObjectConfig{
	Name: "NewSession",
	Fields: graphql.Fields{
		"authenticationToken": &graphql.Field{
			Type:        graphql.ID,
			Description: "ID of the session",
		},
		"user": &graphql.Field{
			Type:        User,
			Description: "User the new session",
		},
		"error": &graphql.Field{
			Type:        graphql.String,
			Description: "User error message when email or password is invalid",
		},
	},
})

NewSession is the sign in response type

View Source
var NullableString = graphql.NewScalar(graphql.ScalarConfig{
	Name:        "NullableString",
	Description: "Returns a string or null",
	Serialize: func(value interface{}) interface{} {
		switch value := value.(type) {
		case nulls.String:
			var v *string
			if value.Valid {
				v = &value.String
			}
			return v
		case *nulls.String:
			var v *string
			if value.Valid {
				v = &value.String
			}
			return v
		default:
			return nil
		}
	},
})

NullableString represents buffalo's null type

View Source
var NullableTime = graphql.NewScalar(graphql.ScalarConfig{
	Name:        "NullableTime",
	Description: "Returns a string or null",
	Serialize: func(value interface{}) interface{} {
		switch value := value.(type) {
		case nulls.Time:
			var v *time.Time
			if value.Valid {
				v = &value.Time
			}
			return v
		case *nulls.Time:
			var v *time.Time
			if value.Valid {
				v = &value.Time
			}
			return v
		default:
			return nil
		}
	},
})

NullableTime represents buffalo's null type

View Source
var Session = graphql.NewObject(graphql.ObjectConfig{
	Name: "Session",
	Fields: graphql.Fields{
		"authenticationKey": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the session",
		},
		"userAgent": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "UserAgent of session when it started",
		},
		"ipAddress": &graphql.Field{
			Type:        graphql.String,
			Description: "IP address used when session started",
		},
		"deviceName": &graphql.Field{
			Type:        NullableString,
			Description: "Name of device session started on",
		},
		"createdAt": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.DateTime),
			Description: "Time session started",
		},
		"expiredAt": &graphql.Field{
			Type:        NullableTime,
			Description: "Time session ended",
		},
	},
})

Session is the model type

View Source
var Sessions = graphql.NewObject(graphql.ObjectConfig{
	Name: "Sessions",
	Fields: graphql.Fields{
		"active": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(Session))),
			Description: "Active Sessions",
		},
		"expired": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.NewList(graphql.NewNonNull(Session))),
			Description: "Expired Sessions",
		},
	},
})

Sessions returns two kinds

View Source
var UploadType = graphql.NewScalar(graphql.ScalarConfig{
	Name:        "Upload",
	Description: "HTML Multipart file upload",
})
View Source
var User = graphql.NewObject(graphql.ObjectConfig{
	Name: "User",
	Fields: graphql.Fields{
		"id": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.ID),
			Description: "ID of the User",
		},
		"email": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.String),
			Description: "Email of user",
		},
		"firstName": &graphql.Field{
			Type:        NullableString,
			Description: "First name of user",
		},
		"lastName": &graphql.Field{
			Type:        NullableString,
			Description: "Last name of user",
		},
		"admin": &graphql.Field{
			Type:        graphql.NewNonNull(graphql.Boolean),
			Description: "Is user admin",
		},
		"avatarUrl": &graphql.Field{
			Type:        graphql.String,
			Description: "User's avatar url",
		},
	},
})

User is the model type

UserInput is the params to upsert an annual budget item

Functions

This section is empty.

Types

type File

type File struct {
	File     multipart.File
	Filename string
	Size     int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL