models

package
v1.2.40 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RepeaterTypeMMDVM is the type for MMDVM repeaters.
	RepeaterTypeMMDVM = "mmdvm"
	// RepeaterTypeIPSC is the type for Motorola IPSC repeaters.
	RepeaterTypeIPSC = "ipsc"
)
View Source
const TalkgroupSeederRows = 1
View Source
const UserSeederRows = 1

Variables

View Source
var (
	ErrInvalidCallsign  = errors.New("invalid callsign")
	ErrInvalidColorCode = errors.New("invalid color code")
	ErrInvalidLatitude  = errors.New("invalid latitude")
	ErrInvalidLongitude = errors.New("invalid longitude")
	ErrInvalidInt       = errors.New("invalid integer")
	ErrInvalidFloat     = errors.New("invalid float")
)

Functions

func ActiveCallExists

func ActiveCallExists(db *gorm.DB, streamID uint, src uint, dst uint, slot bool, groupCall bool) (bool, error)

func CountActiveNets added in v1.2.36

func CountActiveNets(db *gorm.DB) (int, error)

CountActiveNets returns the number of currently active nets.

func CountCalls

func CountCalls(db *gorm.DB) (int, error)

func CountNets added in v1.2.36

func CountNets(db *gorm.DB) (int, error)

CountNets returns the total number of nets.

func CountNetsForTalkgroup added in v1.2.36

func CountNetsForTalkgroup(db *gorm.DB, talkgroupID uint) (int, error)

CountNetsForTalkgroup returns the total number of nets for a talkgroup.

func CountPeers added in v1.0.35

func CountPeers(db *gorm.DB) (int, error)

func CountRepeaterCalls

func CountRepeaterCalls(db *gorm.DB, repeaterID uint) (int, error)

func CountRepeaters

func CountRepeaters(db *gorm.DB) (int, error)

func CountScheduledNets added in v1.2.36

func CountScheduledNets(db *gorm.DB) (int, error)

CountScheduledNets returns the total number of scheduled nets.

func CountScheduledNetsForTalkgroup added in v1.2.36

func CountScheduledNetsForTalkgroup(db *gorm.DB, talkgroupID uint) (int, error)

CountScheduledNetsForTalkgroup returns the count of scheduled nets for a talkgroup.

func CountTalkgroupCalls

func CountTalkgroupCalls(db *gorm.DB, talkgroupID uint) (int, error)

func CountTalkgroupCallsInTimeRange added in v1.2.36

func CountTalkgroupCallsInTimeRange(db *gorm.DB, talkgroupID uint, startTime, endTime time.Time) (int, error)

CountTalkgroupCallsInTimeRange returns the count of calls for a talkgroup within a time window.

func CountTalkgroups

func CountTalkgroups(db *gorm.DB) (int, error)

func CountTalkgroupsByOwnerID

func CountTalkgroupsByOwnerID(db *gorm.DB, ownerID uint) (int, error)

func CountUniqueUsersInTimeRange added in v1.2.39

func CountUniqueUsersInTimeRange(db *gorm.DB, talkgroupID uint, startTime, endTime time.Time) (int, error)

CountUniqueUsersInTimeRange returns the number of distinct users who made calls on a talkgroup within a time window.

func CountUserAdmins

func CountUserAdmins(db *gorm.DB) (int, error)

func CountUserCalls

func CountUserCalls(db *gorm.DB, userID uint) (int, error)

func CountUserPeers added in v1.0.35

func CountUserPeers(db *gorm.DB, id uint) (int, error)

func CountUserRepeaters

func CountUserRepeaters(db *gorm.DB, id uint) (int, error)

func CountUserSuspended

func CountUserSuspended(db *gorm.DB) (int, error)

func CountUserUnapproved

func CountUserUnapproved(db *gorm.DB) (int, error)

func CountUsers

func CountUsers(db *gorm.DB) (int, error)

func CreateNet added in v1.2.36

func CreateNet(db *gorm.DB, net *Net) error

CreateNet persists a new net to the database.

func CreateScheduledNet added in v1.2.36

func CreateScheduledNet(db *gorm.DB, sn *ScheduledNet) error

CreateScheduledNet persists a new scheduled net to the database.

func DeleteNet added in v1.2.36

func DeleteNet(db *gorm.DB, id uint) error

DeleteNet soft-deletes a net.

func DeletePeer added in v1.0.35

func DeletePeer(db *gorm.DB, id uint) error

func DeletePeerRule added in v1.2.36

func DeletePeerRule(db *gorm.DB, id uint) error

func DeleteRepeater

func DeleteRepeater(db *gorm.DB, id uint) error

func DeleteScheduledNet added in v1.2.36

func DeleteScheduledNet(db *gorm.DB, id uint) error

DeleteScheduledNet soft-deletes a scheduled net.

func DeleteTalkgroup

func DeleteTalkgroup(db *gorm.DB, id uint) ([]uint, error)

func DeleteUser

func DeleteUser(db *gorm.DB, id uint) error

func EndNet added in v1.2.36

func EndNet(db *gorm.DB, id uint) error

EndNet marks a net as inactive and records the end time.

func GenerateCronExpression added in v1.2.36

func GenerateCronExpression(dayOfWeek int, timeOfDay string) (string, error)

GenerateCronExpression builds a cron expression from schedule fields. The cron format is: minute hour * * day_of_week (evaluated in UTC). DayOfWeek uses 0=Sunday..6=Saturday. TimeOfDay is "HH:MM" 24h UTC.

func PeerIDExists added in v1.0.35

func PeerIDExists(db *gorm.DB, id uint) (bool, error)

func RatelimitKeyExists added in v1.0.66

func RatelimitKeyExists(db *gorm.DB, key string) (bool, error)

func RepeaterExists

func RepeaterExists(db *gorm.DB, repeater Repeater) (bool, error)

func RepeaterIDExists

func RepeaterIDExists(db *gorm.DB, id uint) (bool, error)

func TalkgroupIDExists

func TalkgroupIDExists(db *gorm.DB, id uint) (bool, error)

func UpdateNetShowcase added in v1.2.36

func UpdateNetShowcase(db *gorm.DB, id uint, showcase bool) error

UpdateNetShowcase toggles the showcase flag on a net.

func UpdateScheduledNet added in v1.2.36

func UpdateScheduledNet(db *gorm.DB, sn *ScheduledNet) error

UpdateScheduledNet updates a scheduled net in the database.

func UserExists

func UserExists(db *gorm.DB, user User) (bool, error)

func UserIDExists

func UserIDExists(db *gorm.DB, id uint) (bool, error)

Types

type AppSettings

type AppSettings struct {
	ID        uint `gorm:"primaryKey"`
	HasSeeded bool
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type Call

type Call struct {
	ID             uint           `json:"id" gorm:"primarykey"`
	CallData       []byte         `json:"-" gorm:"type:bytea"`
	StreamID       uint           `json:"-"`
	StartTime      time.Time      `json:"start_time"`
	Duration       time.Duration  `json:"duration"`
	Active         bool           `json:"active"`
	User           User           `json:"user" gorm:"foreignKey:UserID"`
	UserID         uint           `json:"-"`
	Repeater       Repeater       `json:"repeater" gorm:"foreignKey:RepeaterID"`
	RepeaterID     uint           `json:"-"`
	TimeSlot       bool           `json:"time_slot"`
	GroupCall      bool           `json:"group_call"`
	IsToTalkgroup  bool           `json:"is_to_talkgroup"`
	ToTalkgroupID  *uint          `json:"-"`
	ToTalkgroup    Talkgroup      `json:"to_talkgroup" gorm:"foreignKey:ToTalkgroupID"`
	IsToUser       bool           `json:"is_to_user"`
	ToUserID       *uint          `json:"-"`
	ToUser         User           `json:"to_user" gorm:"foreignKey:ToUserID"`
	IsToRepeater   bool           `json:"is_to_repeater"`
	ToRepeaterID   *uint          `json:"-"`
	ToRepeater     Repeater       `json:"to_repeater" gorm:"foreignKey:ToRepeaterID"`
	DestinationID  uint           `json:"destination_id"`
	TotalPackets   uint           `json:"-"`
	LostSequences  uint           `json:"-"`
	Loss           float32        `json:"loss"`
	Jitter         float32        `json:"jitter"`
	LastFrameNum   uint           `json:"-"`
	LastSeq        uint           `json:"-"`
	BER            float32        `json:"ber"`
	RSSI           float32        `json:"rssi"`
	TotalBits      uint           `json:"-"`
	TotalErrors    int            `json:"-"`
	LastPacketTime time.Time      `json:"-"`
	HasHeader      bool           `json:"-"`
	HasTerm        bool           `json:"-"`
	CreatedAt      time.Time      `json:"-"`
	UpdatedAt      time.Time      `json:"-"`
	DeletedAt      gorm.DeletedAt `json:"-" gorm:"index"`
}

func FindActiveCall

func FindActiveCall(db *gorm.DB, streamID uint, src uint, dst uint, slot bool, groupCall bool) (Call, error)

func FindCalls

func FindCalls(db *gorm.DB) ([]Call, error)

func FindRepeaterCalls

func FindRepeaterCalls(db *gorm.DB, repeaterID uint) ([]Call, error)

func FindTalkgroupCalls

func FindTalkgroupCalls(db *gorm.DB, talkgroupID uint) ([]Call, error)

func FindTalkgroupCallsInTimeRange added in v1.2.36

func FindTalkgroupCallsInTimeRange(db *gorm.DB, talkgroupID uint, startTime, endTime time.Time) ([]Call, error)

FindTalkgroupCallsInTimeRange returns calls for a talkgroup within a time window.

func FindUserCalls

func FindUserCalls(db *gorm.DB, userID uint) ([]Call, error)

type Net added in v1.2.36

type Net struct {
	ID              uint           `json:"id" gorm:"primarykey" msg:"id"`
	TalkgroupID     uint           `json:"talkgroup_id" gorm:"not null;index" msg:"talkgroup_id"`
	Talkgroup       Talkgroup      `json:"talkgroup" gorm:"foreignKey:TalkgroupID" msg:"-"`
	StartedByUserID uint           `json:"started_by_user_id" msg:"started_by_user_id"`
	StartedByUser   User           `json:"started_by_user" gorm:"foreignKey:StartedByUserID" msg:"-"`
	ScheduledNetID  *uint          `json:"scheduled_net_id,omitempty" msg:"scheduled_net_id,omitempty"`
	StartTime       time.Time      `json:"start_time" msg:"start_time"`
	EndTime         *time.Time     `json:"end_time,omitempty" msg:"end_time,omitempty"`
	DurationMinutes *uint          `json:"duration_minutes,omitempty" msg:"duration_minutes,omitempty"`
	Description     string         `json:"description" msg:"description"`
	Active          bool           `json:"active" gorm:"index" msg:"active"`
	Showcase        bool           `json:"showcase" gorm:"default:false" msg:"showcase"`
	CreatedAt       time.Time      `json:"-" msg:"-"`
	UpdatedAt       time.Time      `json:"-" msg:"-"`
	DeletedAt       gorm.DeletedAt `json:"-" gorm:"index" msg:"-"`
}

Net represents a single net check-in session on a talkgroup. A net is a period during which transmissions on a talkgroup are tracked as "check-ins". Nets can be started ad-hoc by an NCO or automatically by a ScheduledNet.

func FindActiveNetForTalkgroup added in v1.2.36

func FindActiveNetForTalkgroup(db *gorm.DB, talkgroupID uint) (Net, error)

FindActiveNetForTalkgroup returns the currently active net for a talkgroup, if any.

func FindNetByID added in v1.2.36

func FindNetByID(db *gorm.DB, id uint) (Net, error)

FindNetByID returns a net by its ID.

func FindNetsForTalkgroup added in v1.2.36

func FindNetsForTalkgroup(db *gorm.DB, talkgroupID uint) ([]Net, error)

FindNetsForTalkgroup returns all nets for a talkgroup, ordered by start time descending.

func ListActiveNets added in v1.2.36

func ListActiveNets(db *gorm.DB) ([]Net, error)

ListActiveNets returns all currently active nets.

func ListNets added in v1.2.36

func ListNets(db *gorm.DB) ([]Net, error)

ListNets returns all nets, ordered by active first, then showcase, then by talkgroup ID.

func ListShowcaseNets added in v1.2.36

func ListShowcaseNets(db *gorm.DB) ([]Net, error)

ListShowcaseNets returns nets marked as showcase, regardless of active status.

type Packet

type Packet struct {
	Signature   string             `msg:"signature"`
	Seq         uint               `msg:"seq"`
	Src         uint               `msg:"src"`
	Dst         uint               `msg:"dst"`
	Repeater    uint               `msg:"repeater"`
	Slot        bool               `msg:"slot"`
	GroupCall   bool               `msg:"groupCall"`
	FrameType   dmrconst.FrameType `msg:"frameType,extension"`
	DTypeOrVSeq uint               `msg:"dtypeOrVSeq"`
	StreamID    uint               `msg:"streamID"`
	DMRData     [33]byte           `msg:"dmrData"`
	// The next two are technically unsigned, but the data type is 1 byte
	// We also want to be able to represent -1 as a null, so we use int
	BER  int `msg:"ber"`
	RSSI int `msg:"rssi"`
}

Packet is a DMR packet

func UnpackPacket

func UnpackPacket(data []byte) (Packet, bool)

func (*Packet) Encode

func (p *Packet) Encode() []byte

Encode allocates and returns a new byte slice containing the encoded packet.

func (*Packet) EncodeTo added in v1.2.27

func (p *Packet) EncodeTo(dst []byte) []byte

EncodeTo encodes the packet into dst, which must be at least dmrconst.MMDVMMaxPacketLength bytes. Returns dst for convenience.

func (Packet) Equal

func (p Packet) Equal(other Packet) bool

func (*Packet) String

func (p *Packet) String() string

type Peer added in v1.0.35

type Peer struct {
	ID        uint           `json:"id" gorm:"primaryKey" msg:"id"`
	LastPing  time.Time      `json:"last_ping_time" msg:"last_ping"`
	IP        string         `json:"ip" msg:"ip"`
	Port      int            `json:"port" msg:"port"`
	Password  string         `json:"-" msg:"-"`
	Owner     User           `json:"owner" gorm:"foreignKey:OwnerID" msg:"-"`
	OwnerID   uint           `json:"-" msg:"-"`
	Ingress   bool           `json:"ingress" msg:"-"`
	Egress    bool           `json:"egress" msg:"-"`
	CreatedAt time.Time      `json:"created_at" msg:"-"`
	UpdatedAt time.Time      `json:"-" msg:"-"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index" msg:"-"`
}

Peer is the model for an OpenBridge DMR peer

func FindPeerByID added in v1.0.35

func FindPeerByID(db *gorm.DB, id uint) (Peer, error)

func GetUserPeers added in v1.0.35

func GetUserPeers(db *gorm.DB, id uint) ([]Peer, error)

func ListPeers added in v1.0.35

func ListPeers(db *gorm.DB) ([]Peer, error)

func (*Peer) String added in v1.0.35

func (p *Peer) String() string

type PeerRule added in v1.0.38

type PeerRule struct {
	ID     uint `json:"id" gorm:"primarykey"`
	PeerID uint `json:"-"`
	Peer   Peer `json:"peer" gorm:"foreignKey:PeerID"`

	// Direction is true for ingress, false for egress
	Direction bool `json:"direction"`
	// SubjectID is the ID of the subject (talkgroup/user/repeater)
	SubjectIDMin uint `json:"subject_id_min"`
	SubjectIDMax uint `json:"subject_id_max"`

	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
}

PeerRule is the model for an OpenBridge DMR peer's routing rules

func FindPeerRuleByID added in v1.2.36

func FindPeerRuleByID(db *gorm.DB, id uint) (PeerRule, error)

func ListEgressRulesForPeer added in v1.0.38

func ListEgressRulesForPeer(db *gorm.DB, peerID uint) ([]PeerRule, error)

func ListIngressRulesForPeer added in v1.0.38

func ListIngressRulesForPeer(db *gorm.DB, peerID uint) ([]PeerRule, error)

func ListRulesForPeer added in v1.0.38

func ListRulesForPeer(db *gorm.DB, peerID uint) ([]PeerRule, error)

func (*PeerRule) String added in v1.0.38

func (p *PeerRule) String() string

type Ratelimit added in v1.0.66

type Ratelimit struct {
	Key       string    `gorm:"primaryKey" json:"key"`
	Hits      int64     `json:"hits"`
	Timestamp time.Time `json:"timestamp"`
}

Ratelimit is the model for a rate limit entry

func FindRatelimitByKey added in v1.0.66

func FindRatelimitByKey(db *gorm.DB, key string) (*Ratelimit, error)

func (*Ratelimit) String added in v1.0.66

func (r *Ratelimit) String() string

type RawDMRPacket

type RawDMRPacket struct {
	Data       []byte `msg:"data"`
	RemoteIP   string `msg:"remote_ip"`
	RemotePort int    `msg:"remote_port"`
}

RawDMRPacket is a raw DMR packet

type Repeater

type Repeater struct {
	Connection            RepeaterState  `json:"-" gorm:"-" msg:"connection"`
	Connected             time.Time      `json:"connected_time" msg:"connected"`
	PingsReceived         uint           `json:"-" gorm:"-" msg:"pings_received"`
	LastPing              time.Time      `json:"last_ping_time" msg:"last_ping"`
	IP                    string         `json:"-" gorm:"-" msg:"ip"`
	Port                  int            `json:"-" gorm:"-" msg:"port"`
	Salt                  uint32         `json:"-" gorm:"-" msg:"salt"`
	Password              string         `json:"-" msg:"-"`
	Type                  string         `json:"type" gorm:"default:'mmdvm'" msg:"-"`
	TS1StaticTalkgroups   []Talkgroup    `json:"ts1_static_talkgroups" gorm:"many2many:repeater_ts1_static_talkgroups;" msg:"-"`
	TS2StaticTalkgroups   []Talkgroup    `json:"ts2_static_talkgroups" gorm:"many2many:repeater_ts2_static_talkgroups;" msg:"-"`
	TS1DynamicTalkgroupID *uint          `json:"-" msg:"-"`
	TS2DynamicTalkgroupID *uint          `json:"-" msg:"-"`
	TS1DynamicTalkgroup   Talkgroup      `json:"ts1_dynamic_talkgroup" gorm:"foreignKey:TS1DynamicTalkgroupID" msg:"-"`
	TS2DynamicTalkgroup   Talkgroup      `json:"ts2_dynamic_talkgroup" gorm:"foreignKey:TS2DynamicTalkgroupID" msg:"-"`
	Owner                 User           `json:"owner" gorm:"foreignKey:OwnerID" msg:"-"`
	OwnerID               uint           `json:"-" msg:"-"`
	SimplexRepeater       bool           `json:"simplex_repeater" msg:"simplex_repeater"`
	City                  string         `json:"city" msg:"-"`
	State                 string         `json:"state" msg:"-"`
	Country               string         `json:"country" msg:"-"`
	CreatedAt             time.Time      `json:"created_at" msg:"-"`
	UpdatedAt             time.Time      `json:"-" msg:"-"`
	DeletedAt             gorm.DeletedAt `json:"-" gorm:"index" msg:"-"`
	RepeaterConfiguration
}

Repeater is the model for a DMR repeater

func FindRepeaterByID

func FindRepeaterByID(db *gorm.DB, id uint) (Repeater, error)

func GetUserRepeaters

func GetUserRepeaters(db *gorm.DB, id uint) ([]Repeater, error)

func ListRepeaters

func ListRepeaters(db *gorm.DB) ([]Repeater, error)

func (*Repeater) String

func (p *Repeater) String() string

func (*Repeater) UpdateFrom added in v1.0.66

func (p *Repeater) UpdateFrom(repeater Repeater)

func (*Repeater) WantRX

func (p *Repeater) WantRX(packet Packet) (bool, bool)

func (*Repeater) WantRXCall added in v1.0.15

func (p *Repeater) WantRXCall(call Call) (bool, bool)

type RepeaterConfiguration added in v1.0.43

type RepeaterConfiguration struct {
	Callsign    string  `json:"callsign" msg:"callsign"`
	ID          uint    `json:"id" gorm:"primaryKey" msg:"id"`
	RXFrequency uint    `json:"rx_frequency" msg:"rx_frequency"`
	TXFrequency uint    `json:"tx_frequency" msg:"tx_frequency"`
	TXPower     uint8   `json:"tx_power" msg:"tx_power"`
	ColorCode   uint8   `json:"color_code" msg:"color_code"`
	Latitude    float64 `json:"latitude" msg:"latitude"`
	Longitude   float64 `json:"longitude" msg:"longitude"`
	Height      uint16  `json:"height" msg:"height"`
	Location    string  `json:"location" msg:"location"`
	Description string  `json:"description" msg:"description"`
	URL         string  `json:"url" msg:"url"`
	SoftwareID  string  `json:"software_id" msg:"software_id"`
	PackageID   string  `json:"package_id" msg:"package_id"`
	Slots       uint    `json:"slots" msg:"slots"`
}

func (*RepeaterConfiguration) Check added in v1.0.43

func (c *RepeaterConfiguration) Check(version, commit string) error

func (*RepeaterConfiguration) ParseConfig added in v1.0.43

func (c *RepeaterConfiguration) ParseConfig(data []byte, version, commit string) error

type RepeaterState added in v1.2.27

type RepeaterState string
const (
	RepeaterStateConnected     RepeaterState = "CONNECTED"
	RepeaterStateChallengeSent RepeaterState = "CHALLENGE_SENT"
	RepeaterStateWaitingConfig RepeaterState = "WAITING_CONFIG"
	RepeaterStateLoginReceived RepeaterState = "LOGIN_RECEIVED"
)

type ScheduledNet added in v1.2.36

type ScheduledNet struct {
	ID              uint           `json:"id" gorm:"primarykey" msg:"id"`
	TalkgroupID     uint           `json:"talkgroup_id" gorm:"not null;index" msg:"talkgroup_id"`
	Talkgroup       Talkgroup      `json:"talkgroup" gorm:"foreignKey:TalkgroupID" msg:"-"`
	CreatedByUserID uint           `json:"created_by_user_id" msg:"created_by_user_id"`
	CreatedByUser   User           `json:"created_by_user" gorm:"foreignKey:CreatedByUserID" msg:"-"`
	Name            string         `json:"name" msg:"name"`
	Description     string         `json:"description" msg:"description"`
	CronExpression  string         `json:"cron_expression" msg:"cron_expression"`
	DayOfWeek       int            `json:"day_of_week" msg:"day_of_week"`
	TimeOfDay       string         `json:"time_of_day" msg:"time_of_day"`
	Timezone        string         `json:"timezone" msg:"timezone"`
	DurationMinutes *uint          `json:"duration_minutes,omitempty" msg:"duration_minutes,omitempty"`
	Enabled         bool           `json:"enabled" gorm:"default:true" msg:"enabled"`
	Showcase        bool           `json:"showcase" gorm:"default:false" msg:"showcase"`
	NextRun         *time.Time     `json:"next_run,omitempty" msg:"next_run,omitempty"`
	CreatedAt       time.Time      `json:"created_at" msg:"-"`
	UpdatedAt       time.Time      `json:"-" msg:"-"`
	DeletedAt       gorm.DeletedAt `json:"-" gorm:"index" msg:"-"`
}

ScheduledNet represents a recurring net schedule for a talkgroup. DayOfWeek and TimeOfDay are stored in UTC (the frontend converts from the user's local time before sending). Timezone is stored for display purposes so the UI can show the schedule in the creator's local time. The CronExpression is generated from the UTC DayOfWeek and TimeOfDay.

func FindAllEnabledScheduledNets added in v1.2.36

func FindAllEnabledScheduledNets(db *gorm.DB) ([]ScheduledNet, error)

FindAllEnabledScheduledNets returns all enabled scheduled nets across all talkgroups.

func FindScheduledNetByID added in v1.2.36

func FindScheduledNetByID(db *gorm.DB, id uint) (ScheduledNet, error)

FindScheduledNetByID returns a scheduled net by its ID.

func FindScheduledNetsForTalkgroup added in v1.2.36

func FindScheduledNetsForTalkgroup(db *gorm.DB, talkgroupID uint) ([]ScheduledNet, error)

FindScheduledNetsForTalkgroup returns all scheduled nets for a talkgroup.

func ListScheduledNets added in v1.2.36

func ListScheduledNets(db *gorm.DB) ([]ScheduledNet, error)

ListScheduledNets returns all scheduled nets, ordered by creation time descending.

type Talkgroup

type Talkgroup struct {
	ID          uint           `json:"id" gorm:"primaryKey"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Admins      []User         `json:"admins" gorm:"many2many:talkgroup_admins;"`
	NCOs        []User         `json:"ncos" gorm:"many2many:talkgroup_ncos;"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"-"`
	DeletedAt   gorm.DeletedAt `json:"-" gorm:"index"`
}

func FindTalkgroupByID

func FindTalkgroupByID(db *gorm.DB, id uint) (Talkgroup, error)

func FindTalkgroupsByOwnerID

func FindTalkgroupsByOwnerID(db *gorm.DB, ownerID uint) ([]Talkgroup, error)

func ListTalkgroups

func ListTalkgroups(db *gorm.DB) ([]Talkgroup, error)

type TalkgroupsSeeder

type TalkgroupsSeeder struct {
	gorm_seeder.SeederAbstract
}

func (*TalkgroupsSeeder) Clear

func (s *TalkgroupsSeeder) Clear(_ *gorm.DB) error

func (*TalkgroupsSeeder) Seed

func (s *TalkgroupsSeeder) Seed(db *gorm.DB) error

type User

type User struct {
	ID         uint           `json:"id" gorm:"primaryKey" binding:"required"`
	Callsign   string         `json:"callsign" gorm:"uniqueIndex" binding:"required"`
	Username   string         `json:"username" gorm:"uniqueIndex" binding:"required"`
	Password   string         `json:"-"`
	Admin      bool           `json:"admin"`
	SuperAdmin bool           `json:"superAdmin"`
	Email      string         `json:"email"`
	Approved   bool           `json:"approved" binding:"required"`
	Suspended  bool           `json:"suspended"`
	Repeaters  []Repeater     `json:"repeaters" gorm:"foreignKey:OwnerID"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"-"`
	DeletedAt  gorm.DeletedAt `json:"-" gorm:"index"`
}

func FindUserAdmins

func FindUserAdmins(db *gorm.DB) ([]User, error)

func FindUserByID

func FindUserByID(db *gorm.DB, id uint) (User, error)

func FindUserSuspended

func FindUserSuspended(db *gorm.DB) ([]User, error)

func FindUserUnapproved

func FindUserUnapproved(db *gorm.DB) ([]User, error)

func ListUsers

func ListUsers(db *gorm.DB) ([]User, error)

func (User) TableName

func (u User) TableName() string

type UsersSeeder

type UsersSeeder struct {
	gorm_seeder.SeederAbstract
}

func (*UsersSeeder) Clear

func (s *UsersSeeder) Clear(_ *gorm.DB) error

func (*UsersSeeder) Seed

func (s *UsersSeeder) Seed(db *gorm.DB) error

Jump to

Keyboard shortcuts

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