types

package
v0.0.0-...-8616468 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckOperationCashType

func CheckOperationCashType(cashType string) bool

func CheckOperationSource

func CheckOperationSource(source string) bool

func CheckOperationStatus

func CheckOperationStatus(status string) bool

func CheckOperationType

func CheckOperationType(operationType string) bool

Types

type Account

type Account struct {
	ID        int64          `json:"id" gorm:"primarykey"`
	Name      string         `json:"name"`
	Token     string         `json:"token" gorm:"unique, not null"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index" swaggertype:"string"`
}

type Analytics

type Analytics struct {
	FullBalance float64 `json:"full_balance"`
	FullCredit  float64 `json:"full_credit"`
	FullDebit   float64 `json:"full_debit"`

	CashBalance float64 `json:"cash_balance"`
	CashCredit  float64 `json:"cash_credit"`
	CashDebit   float64 `json:"cash_debit"`

	SettlementBalance float64 `json:"settlement_balance"`
	SettlementCredit  float64 `json:"settlement_credit"`
	SettlementDebit   float64 `json:"settlement_debit"`

	DayPaymentsCredit float64 `json:"day_payments_credit"`
	FineCredit        float64 `json:"fine_credit"`
	OtherCredit       float64 `json:"other_credit"`

	NumberOfOperations int64 `json:"number_of_operations"`

	BalanceByDays   map[string]AnalyticsBalance `json:"balance_by_days"`   //YYYY-MM-DD
	BalanceByMonths map[string]AnalyticsBalance `json:"balance_by_months"` //YYYY-MM

}

type AnalyticsBalance

type AnalyticsBalance struct {
	Credit float64 `json:"credit"`
	Debit  float64 `json:"debit"`
}

type BalanaceAndMonth

type BalanaceAndMonth struct {
	Balance float64 `json:"balance"`
	Month   string  `json:"month"`
}

type Bill

type Bill struct {
	ID         int64          `json:"id" gorm:"primarykey"`
	UID        string         `json:"uid" gorm:"not null"`
	ExtID      int64          `json:"ext_id"`
	AccountsID int64          `json:"accounts_id" gorm:"not null"`
	Code       string         `json:"code" gorm:"not null"`
	Name       string         `json:"name" gorm:"not null"`
	CashType   string         `json:"cash_type" gorm:"default:SETTLEMENT"`
	Balance    float64        `json:"balance" gorm:"-"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at"`
	DeletedAt  gorm.DeletedAt `json:"deleted_at" gorm:"index" swaggertype:"string"`
}

type BillByDay

type BillByDay struct {
	Amount               float64 `json:"amount"`
	MisleadingOperations int64   `json:"misleading_operations"`
}

type Category

type Category struct {
	ID            int64          `json:"id" gorm:"primarykey"`
	UID           string         `json:"uid" gorm:"not null"`
	ExtID         int64          `json:"ext_id"`
	AccountsID    int64          `json:"accounts_id" gorm:"not null"`
	ParentID      int64          `json:"parent_id"`
	OperationType string         `json:"operation_type" gorm:"not null"`
	Name          string         `json:"name" gorm:"not null"`
	Description   string         `json:"description"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	DeletedAt     gorm.DeletedAt `json:"deleted_at" gorm:"index" swaggertype:"string"`
}

type CategoryListFilters

type CategoryListFilters struct {
	OperationType *string `json:"operation_type"`
}

type FullAnalytics

type FullAnalytics struct {
	Months map[string]OneMonthFullAnalytics `json:"months"`
}

type History

type History struct {
	ID            int64          `json:"id" gorm:"primarykey"`
	AccountsID    int64          `json:"accounts_id"`
	SourceTable   string         `json:"source_table" gorm:"index"`
	SourceID      int64          `json:"source_id" gorm:"index"`
	OperationType string         `json:"operation_type"`
	After         datatypes.JSON `json:"after"`
	Before        datatypes.JSON `json:"before"`
	UserID        int64          `json:"user_id"`
	UserData      interface{}    `json:"user_data" gorm:"-"`
	CreatedAt     time.Time      `json:"created_at"`
}

type InputAccountTokenHeader

type InputAccountTokenHeader struct {
	Token string `header:"Token"`
}

type InputBillBalanceByDays

type InputBillBalanceByDays struct {
	DateStart *string `json:"date_start" example:"YYYY-MM-DD"`
	DateEnd   *string `json:"date_end" example:"YYYY-MM-DD"`
}

type InputCreateCategory

type InputCreateCategory struct {
	ExtID         int64   `json:"ext_id"`
	ParentUID     *string `json:"parent_id"`
	OperationType string  `json:"operation_type" example:"CREDIT|DEBIT"`
	Name          string  `json:"name"`
	Description   string  `json:"description"`
}

type InputCreateEditAccount

type InputCreateEditAccount struct {
	Name  *string `json:"name"`
	Token *string `json:"token"`
}

type InputCreateEditBill

type InputCreateEditBill struct {
	MainRelationUID *string `json:"main_relation_uid"`
	ExtID           *int64  `json:"ext_id"`
	Code            *string `json:"code"`
	Name            *string `json:"name"`
	CashType        *string `json:"cash_type" example:"CASH|SETTLEMENT"`
}

type InputCreateFromRex

type InputCreateFromRex struct {
	ID          int64  `json:"id"`
	CategoryID  int64  `json:"category_id"`
	UserID      int64  `json:"users_id"`
	UID         string `json:"uid"`
	Description string `json:"description"`
	Amount      string `json:"amount"`
	Date        string `json:"date"`
	RentUserID  int64  `json:"rent_users_id"`
	Deposit     bool   `json:"deposit"`
	CashType    string `json:"cash_type"`
	VehicleID   int64  `json:"vehicles_id"`
	Status      string `json:"status"`
	AchiveAt    string `json:"archive_at"`
}

type InputCreateOperation

type InputCreateOperation struct {
	ExtID            *int64     `json:"ext_id"`
	CategoriesID     *int64     `json:"categories_id"`
	RelationsUIDs    *[]string  `json:"relations_uids"`
	RelationsSources *[]string  `json:"relations_sources" example:"vehicle|user|ransom_order|rent_order|bill"`
	FromUID          *string    `json:"from_uid"`
	FromSource       *string    `json:"from_source" example:"vehicle|user|ransom_order|rent_order|bill"`
	ToUID            string     `json:"to_uid"`
	ToSource         string     `json:"to_source" example:"vehicle|user|ransom_order|rent_order|bill"`
	Amount           float64    `json:"amount"`
	Description      *string    `json:"description"`
	Date             *time.Time `json:"date"`
	Deposit          *bool      `json:"deposit"`
	CashType         string     `json:"cash_type" example:"CASH|SETTLEMENT"`
	Status           string     `json:"status" example:"FAILED|SUCCESS|DEFAULT"`
	ToBillsID        *int64     `json:"to_bills_id"`
	FromBillsID      *int64     `json:"from_bills_id"`
}

type InputDeleteOperationsForOrder

type InputDeleteOperationsForOrder struct {
	AccountToken string `json:"-"`
	AccountID    int64  `json:"-"`
	AuthUsersID  int64  `json:"-"`
	UID          string `json:"uid"`
	RelationsUID string `json:"relations_uid"`
	ToSource     string `json:"to_source"`
	CategoriesID int64  `json:"categories_id"`
}

type InputEditCategory

type InputEditCategory struct {
	ExtID         *int64  `json:"ext_id"`
	ParentUID     *string `json:"parent_id"`
	OperationType *string `json:"operation_type" example:"CREDIT|DEBIT"`
	Name          *string `json:"name"`
	Description   *string `json:"description"`
}

type InputEditOperation

type InputEditOperation struct {
	ExtID            *int64     `json:"ext_id"`
	CategoriesID     *int64     `json:"categories_id"`
	RelationsUIDs    *[]string  `json:"relations_uids"`
	RelationsSources *[]string  `json:"relations_sources" example:"vehicle|user|ransom_order|rent_order|bill"`
	FromUID          *string    `json:"from_uid"`
	FromSource       *string    `json:"from_source" example:"vehicle|user|ransom_order|rent_order|bill"`
	ToUID            *string    `json:"to_uid"`
	ToSource         *string    `json:"to_source" example:"vehicle|user|ransom_order|rent_order|bill"`
	Amount           *float64   `json:"amount"`
	Description      *string    `json:"description"`
	Date             *time.Time `json:"date"`
	Deposit          *bool      `json:"deposit"`
	CashType         *string    `json:"cash_type" example:"CASH|SETTLEMENT"`
	Status           *string    `json:"status" example:"FAILED|SUCCESS|DEFAULT"`
	ToBillsID        *int64     `json:"to_bills_id"`
	FromBillsID      *int64     `json:"from_bills_id"`
}

type InputGetHistoryList

type InputGetHistoryList struct {
	Page          int    `json:"page"`
	PageSize      int    `json:"page_size"`
	OrderBy       string `json:"order_by"`
	OrderDir      string `json:"order_direction" example:"asc|desc"`
	Search        string `json:"search"`
	OperationType string `json:"operation_type" example:"create|edit|delete"`
}

type InputGetList

type InputGetList struct {
	Page     int    `json:"page"`
	PageSize int    `json:"page_size"`
	OrderBy  string `json:"order_by"`
	OrderDir string `json:"order_direction" example:"asc|desc"`
	Search   string `json:"search"`
}

type InputGetListCategory

type InputGetListCategory struct {
	Page     int                  `json:"page"`
	PageSize int                  `json:"page_size"`
	OrderBy  string               `json:"order_by"`
	OrderDir string               `json:"order_direction" example:"asc|desc"`
	Search   string               `json:"search"`
	Filters  *CategoryListFilters `json:"filters"`
}

type InputGetListOperations

type InputGetListOperations struct {
	Page     int                  `json:"page"`
	PageSize int                  `json:"page_size"`
	OrderBy  string               `json:"order_by"`
	OrderDir string               `json:"order_direction" example:"asc|desc"`
	Search   string               `json:"search"`
	Filters  OperationListFilters `json:"filters"`
}

type InputGetVehicleAnalytics

type InputGetVehicleAnalytics struct {
	OrderUIDs *[]string
}

type InputGinHeader

type InputGinHeader struct {
	Authorization string `header:"Authorization"`
}

type InputListBill

type InputListBill struct {
	Force    bool   `json:"force"`
	Page     int    `json:"page"`
	PageSize int    `json:"page_size"`
	OrderBy  string `json:"order_by"`
	OrderDir string `json:"order_direction" example:"asc|desc"`
	Search   string `json:"search"`
}

type InputRecreateOperationsForOrder

type InputRecreateOperationsForOrder struct {
	OrderUID    string  `json:"order_uid"`
	UserUID     string  `json:"user_uid"`
	VehicleUID  string  `json:"vehicle_uid"`
	DateStart   string  `json:"date_start"`
	DateEnd     *string `json:"date_end"`
	Description string  `json:"description"`
	Amount      float64 `json:"amount"`
	OrderType   string  `json:"order_type"`
}

type MiniBill

type MiniBill struct {
	Amount            float64 `json:"amount"`
	Deposit           float64 `json:"deposit"`
	DaysOfDelay       uint64  `json:"days_of_delay"`
	DayPaymentsAmount float64 `json:"day_payments_amount"`
	DaysOfDelayAmount float64 `json:"days_of_delay_amount"`
	Residual          float64 `json:"residual"`
	RentDebitAmount   float64 `json:"rent_debit_amount"`
}

type MiniOperation

type MiniOperation struct {
	ToUID    string  `json:"to_uid"`
	Coalesce float64 `json:"coalesce"`
}

type OneMonthFullAnalytics

type OneMonthFullAnalytics struct {
	Debit  map[string]float64 `json:"debit"`
	Credit map[string]float64 `json:"credit"`
}

type Operation

type Operation struct {
	ID               int64          `json:"id" gorm:"primarykey"`
	UID              string         `json:"uid" gorm:"not null,index"`
	ExtID            int64          `json:"ext_id"`
	AccountsID       int64          `json:"accounts_id" gorm:"not null"`
	CategoriesID     int64          `json:"categories_id"`
	RelationsUIDs    datatypes.JSON `json:"relations_uids" swaggertype:"string"`
	RelationsSources datatypes.JSON `json:"relations_sources" swaggertype:"string"`
	FromUID          string         `json:"from_uid"`
	FromSource       string         `json:"from_source"`
	ToUID            string         `json:"to_uid"`
	ToSource         string         `json:"to_source"`
	Amount           float64        `json:"amount" gorm:"not null"`
	Description      string         `json:"description"`
	Date             time.Time      `json:"date" gorm:"not null"`
	Deposit          bool           `json:"deposit" gorm:"not null"`
	CashType         string         `json:"cash_type"`
	Status           string         `json:"status"`
	CreateUsersID    int64          `json:"create_users_id"`
	ToBillsID        *int64         `json:"to_bills_id"`
	FromBillsID      *int64         `json:"from_bills_id"`
	CreatedAt        time.Time      `json:"created_at"`
	UpdatedAt        time.Time      `json:"updated_at"`
	DeletedAt        gorm.DeletedAt `json:"deleted_at" gorm:"index" swaggertype:"string"`
}

type OperationListFilters

type OperationListFilters struct {
	CashType             *string   `json:"cash_type" example:"SETTLEMENT|CASH"`
	BillCashType         *string   `json:"bill_cash_type" example:"SETTLEMENT|CASH"`
	AmountType           *string   `json:"amount_type" example:"credit|debit"`
	RelationsUIDs        *[]string `json:"relations_uids"`
	OrRelationsUIDs      *[]string `json:"or_relations_uids"`
	DateStart            *string   `json:"date_start" example:"YYYY-MM-DD"`
	DateEnd              *string   `json:"date_end" example:"YYYY-MM-DD"`
	CreatedAtStart       *string   `json:"created_at_start" example:"YYYY-MM-DD"`
	CreatedAtEnd         *string   `json:"created_at_end" example:"YYYY-MM-DD"`
	CategoriesID         *int64    `json:"categories_id"`
	InCategoriesID       *[]int64  `json:"in_categories_id"`
	ToUID                *string   `json:"to_uid"`
	InToUIDs             *[]string `json:"in_to_uids"`
	Deposit              *bool     `json:"deposit"`
	WithoutCache         *bool     `json:"without_cache"`
	SearchUID            *string   `json:"search_uid"`
	ToUIDAndRelations    *string   `json:"to_uid_and_relations"`
	Search               *string   `json:"search"`
	WithoutCategoriesIDs *[]int64  `json:"without_categories_ids"`
	ToBillsID            *int64    `json:"to_bills_id"`
	ToSource             *string   `json:"to_source"`
	MisleadingDate       *bool     `json:"misleading_date"`
	GroupBy              *string   `json:"group_by"`
}

type OperationWithSaldo

type OperationWithSaldo struct {
	Operation Operation `gorm:"embedded"`
	Saldo     float64   `json:"saldo"`
}

type Pagination

type Pagination struct {
	Page       *int        `json:"page"`
	Items      interface{} `json:"items"`
	TotalItems *int64      `json:"total_items"`
	TotalPages *int        `json:"total_pages"`
}

type ResponceRex

type ResponceRex struct {
	Payload interface{}
	Message string
	Code    string
	Status  int
}

type ResponceRexListCategories

type ResponceRexListCategories struct {
	Payload RexPaginationCategories `json:"payload"`
	Message string                  `json:"message"`
	Code    string                  `json:"code"`
	Status  int                     `json:"status"`
}

type ResponceRexListOperations

type ResponceRexListOperations struct {
	Payload RexPaginationOperation `json:"payload"`
	Message string                 `json:"message"`
	Code    string                 `json:"code"`
	Status  int                    `json:"status"`
}

type RestRespone

type RestRespone struct {
	Message string      `json:"message"`
	Payload interface{} `json:"payload"`
}

type RexCategory

type RexCategory struct {
	ID            int64  `json:"id"`
	UsersID       int64  `json:"users_id"`
	UID           string `json:"uid"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	ParentID      int64  `json:"parent_id"`
	OperationType string `json:"operation_type"`
}

type RexOperation

type RexOperation struct {
	ID              int64  `json:"id"`
	CategoryID      int64  `json:"category_id"`
	UsersID         int64  `json:"users_id"`
	UID             string `json:"uid"`
	Description     string `json:"description"`
	Amount          string `json:"amount"`
	Date            string `json:"date"`
	CashflowBoxesID int64  `json:"cashflow_boxes_id"`
	CashType        string `json:"cash_type"`
	RentUsersID     int64  `json:"rent_users_id"`
	Deposit         bool   `json:"deposit"`
	VehiclesID      int64  `json:"vehicles_id"`
	FromUsersID     int64  `json:"from_users_id"`
	ToUsersID       int64  `json:"to_users_id"`
	Status          string `json:"status"`
	AchiveAt        string `json:"archive_at"`
}

type RexPaginationCategories

type RexPaginationCategories struct {
	Items      []RexCategory `json:"items"`
	TotalPages uint64        `json:"total_pages"`
	TotalItems uint64        `json:"total_items"`
}

type RexPaginationOperation

type RexPaginationOperation struct {
	Items      []RexOperation `json:"items"`
	TotalPages uint64         `json:"total_pages"`
	TotalItems uint64         `json:"total_items"`
}

type SubAnalytics

type SubAnalytics struct {
	FullBalance       float64 `json:"full_balance"`
	FullCredit        float64 `json:"full_credit"`
	FullDebit         float64 `json:"full_debit"`
	CashBalance       float64 `json:"cash_balance"`
	CashCredit        float64 `json:"cash_credit"`
	CashDebit         float64 `json:"cash_debit"`
	SettlementBalance float64 `json:"settlement_balance"`
	SettlementCredit  float64 `json:"settlement_credit"`
	SettlementDebit   float64 `json:"settlement_debit"`
	DayPaymentsCredit float64 `json:"day_payments_credit"`
	FineCredit        float64 `json:"fine_credit"`
	OtherCredit       float64 `json:"other_credit"`
}

type VehicleAnalytics

type VehicleAnalytics struct {
	BuyDate           string  `json:"buy_date"`            //- находим операцию с категорией ext_id = 14 и берем date операции ////
	VehicleAmount     float64 `json:"vehicle_amount"`      // - находим операции с категорией ext_id = 14 и берем amount операции ////
	Deposit           float64 `json:"deposit"`             //- все операции по машине в deposit = true ////
	DaysCount         uint64  `json:"days_count"`          //- количество дней по операциям с категорией ext_id = 8
	Result            float64 `json:"result"`              //- (сумма всех операций в категориях ext_id IN (10,48,57) AND parent_id{ext_id} IN (49,54,58)) минус (сумма всех операций в категориях ext_id IN (14,16,17,20,21) AND parent_id{ext_id} IN (15,19,23) ////
	MetaVehicleAmount float64 `json:"meta_vehicle_amount"` //- current.vehicleAmount + current.repairCreditAmount + current.otherCreditAmount

	TrackerInstallAmount           float64 `json:"tracker_install_amount"`            //[16]
	TrackerMonthAmount             float64 `json:"tracker_month_amount"`              //[17]
	RegistrationAmount             float64 `json:"registration_amount"`               // [20],
	RepairCreditAmount             float64 `json:"repair_credit_amount"`              // [21],
	OtherCreditAmount              float64 `json:"other_credit_amount"`               // [23],
	VehicleTaxAmount               float64 `json:"vehicle_tax_amount"`                // [19],
	TotalCreditAmount              float64 `json:"total_credit_amount"`               // [14, 16, 17, 20, 21], // = 14 ~ 2000, 17 ~ 1000 = 3000
	RentDebitAmount                float64 `json:"rent_debit_amount"`                 // [10],
	InitialPaymentAmount           float64 `json:"initial_payment_amount"`            // [48],
	CategoryMandatoryPaymentAmount float64 `json:"category_mandatory_payment_amount"` // [49],
	RepairDebitAmount              float64 `json:"repair_debit_amount"`               // [57],
	TotalDebitAmount               float64 `json:"total_debit_amount"`                // [10, 48, 57],
	DayPaymentsAmount              float64 `json:"day_payments_amount"`               // [8],

	//CATEGORIES_PARENTS_IDS
	ParentsOsagoAndDkAmount       float64 `json:"parents_osago_and_dk_amount"`      // [15],
	ParentsTotalCreditAmount      float64 `json:"parents_total_credit_amount"`      // [15, 19, 23], // = 15 ~ 200, 23 ~ 3000 = 3200
	ParentsMandatoryPaymentAmount float64 `json:"parents_mandatory_payment_amount"` // [49, 54],
	ParentsOtherDebitAmount       float64 `json:"parents_other_debit_amount"`       // [58],
	ParentsTotalDebitAmount       float64 `json:"parents_total_debit_amount"`       // [49, 54, 58],

}

Jump to

Keyboard shortcuts

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