Added received time and APRS API
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user