Added received time and APRS API
Some checks failed
Test and build / Test and lint (push) Failing after 35s
Test and build / Build collector (push) Failing after 34s
Test and build / Build receiver (push) Failing after 35s

This commit is contained in:
2026-03-05 16:11:24 +01:00
parent 13afa08e8a
commit 7a8d7b0275
3 changed files with 86 additions and 72 deletions

View File

@@ -2,7 +2,6 @@ package schema
import (
"context"
"database/sql"
"os"
"strings"
"time"
@@ -21,8 +20,8 @@ type APRSStation struct {
Symbol string `xorm:"varchar(2)" json:"symbol"`
FirstHeardAt time.Time `xorm:"timestamp not null"`
LastHeardAt time.Time `xorm:"timestamp not null"`
LastLatitude sql.NullFloat64
LastLongitude sql.NullFloat64
LastLatitude *float64 `xorm:"numeric(10,8)" json:"latitude,omitempty"`
LastLongitude *float64 `xorm:"numeric(11,8)" json:"longitude,omitempty"`
}
func GetAPRSStation(ctx context.Context, call string) (*APRSStation, error) {
@@ -46,20 +45,20 @@ func (station APRSStation) GetPackets(ctx context.Context) ([]*APRSPacket, error
}
type APRSPacket struct {
ID int64 `xorm:"pk autoincr" json:"id"`
RadioID int64 `xorm:"index" json:"radio_id"`
Radio Radio `json:"radio"`
StationID int64 `json:"-"`
Station *APRSStation `xorm:"-" json:"station"`
Source string `xorm:"varchar(10) not null" json:"src"`
Destination string `xorm:"varchar(10) not null" json:"dst"`
Path string `xorm:"varchar(88) not null default ''" json:"path"`
Comment string `xorm:"varchar(250)" json:"comment"`
Latitude sql.NullFloat64 `json:"latitude,omitempty"`
Longitude sql.NullFloat64 `json:"longitude,omitempty"`
Symbol string `xorm:"varchar(2)" json:"symbol"`
Raw string `json:"raw"`
ReceivedAt time.Time `json:"received_at"`
ID int64 `xorm:"pk autoincr" json:"id"`
RadioID int64 `xorm:"index" json:"radio_id"`
Radio *Radio `xorm:"-" json:"radio"`
StationID int64 `json:"-"`
Source string `xorm:"varchar(10) not null" json:"src"`
Destination string `xorm:"varchar(10) not null" json:"dst"`
Path string `xorm:"varchar(88) not null default ''" json:"path"`
Comment string `xorm:"varchar(250)" json:"comment"`
Latitude *float64 `xorm:"numeric(10,8)" json:"latitude,omitempty"`
Longitude *float64 `xorm:"numeric(11,8)" json:"longitude,omitempty"`
Symbol string `xorm:"varchar(2)" json:"symbol"`
Raw string `json:"raw"`
ReceivedAt time.Time `json:"received_at"`
//Station *APRSStation `xorm:"-" json:"station"`
}
func GetAPRSPackets(ctx context.Context, limit int) ([]*APRSPacket, error) {