db

package
v0.0.0-...-2119b44 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPackageRepo

func NewPackageRepo(db sql.Db) *packageRepo

Types

type Package

type Package struct {
	gorm.Model
	Uuid           uuid.UUID `gorm:"unique;type:uuid;index"`
	OwnerId        uuid.UUID
	Name           string
	SimType        ukama.SimType
	OrgId          uuid.UUID      `gorm:"not null;type:uuid;index"`
	Active         bool           `gorm:"not null; default:false"`
	Duration       uint64         `gorm:"not null; default:0"`
	SmsVolume      uint64         `gorm:"not null; default:0"`
	DataVolume     uint64         `gorm:"not null; default:0"`
	VoiceVolume    uint64         `gorm:"not null; default:0"`
	PackageRate    PackageRate    `gorm:"foreignKey:PackageID;references:Uuid"`
	PackageMarkup  PackageMarkup  `gorm:"foreignKey:PackageID;references:Uuid"`
	PackageDetails PackageDetails `gorm:"foreignKey:PackageID;references:Uuid"`
	Type           ukama.PackageType
	DataUnits      ukama.DataUnitType
	VoiceUnits     ukama.CallUnitType
	MessageUnits   ukama.MessageUnitType
	Flatrate       bool      `gorm:"not null; default:false"`
	Currency       string    `gorm:"not null; default:Dollar"`
	From           time.Time `gorm:"not null"`
	To             time.Time `gorm:"not null"`
	Country        string    `gorm:"not null;type:string"`
	Provider       string    `gorm:"not null;type:string"`
	Overdraft      float64
	TrafficPolicy  uint32
	Networks       pq.StringArray `gorm:"type:varchar(64)[]" json:"networks"`
	SyncStatus     ukama.StatusType
}

type PackageDetails

type PackageDetails struct {
	gorm.Model
	PackageID uuid.UUID
	Dlbr      uint64 `gorm:"not null; default:10240000"`
	Ulbr      uint64 `gorm:"not null; default:10240000"`
	Apn       string
}

type PackageMarkup

type PackageMarkup struct {
	gorm.Model
	PackageID  uuid.UUID
	BaseRateId uuid.UUID `gorm:"not null;type:uuid"`
	Markup     float64   `gorm:"type:float"`
}

View only for owners

type PackageRate

type PackageRate struct {
	gorm.Model
	PackageID uuid.UUID
	Amount    float64 `gorm:"type:float"`
	SmsMo     float64 `gorm:"type:float"`
	SmsMt     float64 `gorm:"type:float"`
	Data      float64 `gorm:"type:float"`
}

type PackageRepo

type PackageRepo interface {
	Add(_package *Package) error
	Get(uuid uuid.UUID) (*Package, error)
	GetDetails(uuid.UUID) (*Package, error)
	Delete(uuid uuid.UUID) error
	GetByOrg(orgId uuid.UUID) ([]Package, error)
	Update(uuid uuid.UUID, pkg *Package) error
}

Jump to

Keyboard shortcuts

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