model

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MissionChangeNotificationMsg added in v0.16.3

func MissionChangeNotificationMsg(missionName string, scope string, c *Change) *cot.CotMessage

func MissionCreateNotificationMsg added in v0.16.3

func MissionCreateNotificationMsg(m *Mission) *cot.CotMessage

Types

type Answer added in v0.15.0

type Answer[T any] struct {
	Version string `json:"version"`
	Type    string `json:"type"`
	NodeID  string `json:"nodeId"`
	Data    T      `json:"data"`
}

type Change added in v0.15.0

type Change struct {
	ID          uint      `gorm:"primarykey"`
	CreateTime  time.Time `gorm:"index"`
	Type        string
	MissionID   uint
	CreatorUID  string
	ContentUID  string `gorm:"index"`
	CotType     string
	Callsign    string
	IconsetPath string
	Color       string
	Lat         float64
	Lon         float64
}

type ContentItemDTO added in v0.15.0

type ContentItemDTO struct {
	CreatorUID string  `json:"creatorUid"`
	Timestamp  CotTime `json:"timestamp"`
	Data       DataDTO `json:"data"`
}

type CotTime added in v0.15.0

type CotTime time.Time

func (CotTime) MarshalText added in v0.15.0

func (x CotTime) MarshalText() ([]byte, error)

func (*CotTime) UnmarshalText added in v0.15.0

func (x *CotTime) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type DataDTO added in v0.15.0

type DataDTO struct {
	UID            string   `json:"uid"`
	Keywords       []string `json:"keywords"`
	MimeType       string   `json:"mimeType"`
	Name           string   `json:"name"`
	SubmissionTime CotTime  `json:"submissionTime"`
	Submitter      string   `json:"submitter"`
	CreatorUID     string   `json:"creatorUid"`
	Hash           string   `json:"hash"`
	Size           int      `json:"size"`
}

type DataItem added in v0.15.0

type DataItem struct {
	ID          uint `gorm:"primarykey"`
	MissionID   uint
	UID         string `gorm:"index"`
	CreatorUID  string
	Timestamp   time.Time
	Type        string
	Callsign    string
	Title       string
	IconsetPath string
	Color       string
	Lat         float64
	Lon         float64
	EventData   []byte
	// contains filtered or unexported fields
}

func (*DataItem) BeforeCreate added in v0.15.0

func (d *DataItem) BeforeCreate(_ *gorm.DB) error

func (*DataItem) BeforeUpdate added in v0.15.0

func (d *DataItem) BeforeUpdate(_ *gorm.DB) error

func (*DataItem) GetEvent added in v0.15.0

func (d *DataItem) GetEvent() *cotproto.CotEvent

func (*DataItem) UpdateFromMsg added in v0.15.0

func (d *DataItem) UpdateFromMsg(msg *cot.CotMessage)

type Invitation added in v0.15.0

type Invitation struct {
	ID         uint   `gorm:"primarykey"`
	MissionID  uint   `gorm:"index"`
	Typ        string `gorm:"index"`
	Invitee    string `gorm:"index"`
	CreatorUID string
	CreateTime time.Time
	Role       string
}

type LocationDTO added in v0.15.0

type LocationDTO struct {
	Lat float64 `json:"lat"`
	Lon float64 `json:"lon"`
}

type Mission added in v0.14.7

type Mission struct {
	ID             uint   `gorm:"primarykey"`
	Scope          string `gorm:"index"`
	Name           string `gorm:"index"`
	Username       string
	CreatorUID     string
	CreateTime     time.Time
	LastEdit       time.Time
	BaseLayer      string
	Bbox           string
	ChatRoom       string
	Classification string
	Description    string
	InviteOnly     bool
	Password       string
	Path           string
	Tool           string
	Groups         string
	Keywords       string
	Hashes         string
	Items          []*DataItem
	Token          string
}

func (*Mission) AddHashes added in v0.15.0

func (m *Mission) AddHashes(hashes ...string) bool

func (*Mission) GetHashes added in v0.15.0

func (m *Mission) GetHashes() []string

func (*Mission) RemoveHash added in v0.15.0

func (m *Mission) RemoveHash(hash string) bool

type MissionChangeDTO added in v0.15.0

type MissionChangeDTO struct {
	Type        string             `json:"type"`
	MissionName string             `json:"missionName"`
	Timestamp   CotTime            `json:"timestamp"`
	CreatorUID  string             `json:"creatorUid"`
	ServerTime  CotTime            `json:"serverTime"`
	ContentUID  string             `json:"contentUid,omitempty"`
	Details     *MissionDetailsDTO `json:"details,omitempty"`
}

func NewChangeDTO added in v0.15.0

func NewChangeDTO(c *Change, name string) *MissionChangeDTO

type MissionDTO added in v0.15.0

type MissionDTO struct {
	Name              string            `json:"name"`
	Scope             string            `json:"scope,omitempty"`
	CreatorUID        string            `json:"creatorUid"`
	CreateTime        CotTime           `json:"createTime"`
	LastEdit          CotTime           `json:"lastEdited"`
	BaseLayer         string            `json:"baseLayer"`
	Bbox              string            `json:"bbox"`
	ChatRoom          string            `json:"chatRoom"`
	Classification    string            `json:"classification"`
	Contents          []*ContentItemDTO `json:"contents"`
	DefaultRole       *MissionRoleDTO   `json:"defaultRole,omitempty"`
	OwnerRole         *MissionRoleDTO   `json:"ownerRole,omitempty"`
	Description       string            `json:"description"`
	Expiration        int               `json:"expiration"`
	ExternalData      []any             `json:"externalData"`
	Feeds             []string          `json:"feeds"`
	Groups            []string          `json:"groups,omitempty"`
	InviteOnly        bool              `json:"inviteOnly"`
	Keywords          []string          `json:"keywords"`
	MapLayers         []string          `json:"mapLayers"`
	PasswordProtected bool              `json:"passwordProtected"`
	Path              string            `json:"path"`
	Tool              string            `json:"tool"`
	Uids              []*MissionItemDTO `json:"uids"`
	Token             string            `json:"token"`
}

func ToMissionDTO added in v0.15.0

func ToMissionDTO(m *Mission, pm *pm.PackageManager, withToken bool) *MissionDTO

func ToMissionDTOAdm added in v0.16.3

func ToMissionDTOAdm(m *Mission, pm *pm.PackageManager) *MissionDTO

func ToMissionDTOFull added in v0.16.3

func ToMissionDTOFull(m *Mission, pm *pm.PackageManager, withToken bool, withScope bool) *MissionDTO

type MissionDetailsDTO added in v0.15.0

type MissionDetailsDTO struct {
	Type        string       `json:"type"`
	Callsign    string       `json:"callsign"`
	Title       string       `json:"title,omitempty"`
	IconsetPath string       `json:"iconsetPath"`
	Color       string       `json:"color"`
	Location    *LocationDTO `json:"location,omitempty"`
}

type MissionInvitationDTO added in v0.15.0

type MissionInvitationDTO struct {
	MissionName string          `json:"mission_name"`
	Invitee     string          `json:"invitee"`
	Type        string          `json:"type"`
	CreatorUID  string          `json:"creator_uid"`
	CreateTime  CotTime         `json:"create_time"`
	Role        *MissionRoleDTO `json:"role"`
}

func ToMissionInvitationDTO added in v0.15.0

func ToMissionInvitationDTO(m *Invitation, name string) *MissionInvitationDTO

type MissionItemDTO added in v0.15.0

type MissionItemDTO struct {
	CreatorUID string             `json:"creatorUid"`
	Timestamp  CotTime            `json:"timestamp"`
	Data       string             `json:"data"`
	Details    *MissionDetailsDTO `json:"details"`
}

func NewItemDTO added in v0.15.0

func NewItemDTO(i *DataItem) *MissionItemDTO

type MissionLogEntryDTO added in v0.15.0

type MissionLogEntryDTO struct {
	Content       string    `json:"content"`
	ContentHashes []string  `json:"contentHashes"`
	Created       time.Time `json:"created"`
	CreatorUID    string    `json:"creatorUid"`
	Dtg           time.Time `json:"dtg"`
	ID            string    `json:"id"`
	Keywords      []string  `json:"keywords"`
	MissionNames  []string  `json:"missionNames"`
	Servertime    time.Time `json:"servertime"`
	EntryUID      string    `json:"entryUid"`
}

type MissionRoleDTO added in v0.15.0

type MissionRoleDTO struct {
	Type        string   `json:"type"`
	Permissions []string `json:"permissions"`
}

func GetRole added in v0.15.0

func GetRole(name string) *MissionRoleDTO

func NewRole added in v0.15.0

func NewRole(typ string, perms ...string) *MissionRoleDTO

type MissionSubscriptionDTO added in v0.15.0

type MissionSubscriptionDTO struct {
	ClientUID  string          `json:"clientUid"`
	Username   string          `json:"username"`
	CreateTime CotTime         `json:"createTime"`
	Role       *MissionRoleDTO `json:"role"`
	Token      string          `json:"token,omitempty"`
}

func ToMissionSubscriptionDTO added in v0.15.0

func ToMissionSubscriptionDTO(s *Subscription, token string) *MissionSubscriptionDTO

func ToMissionSubscriptionsDTO added in v0.15.0

func ToMissionSubscriptionsDTO(subscriptions []*Subscription) []*MissionSubscriptionDTO

type Subscription added in v0.15.0

type Subscription struct {
	ID         uint   `gorm:"primarykey"`
	MissionID  uint   `gorm:"index"`
	ClientUID  string `gorm:"index"`
	Username   string
	CreateTime time.Time
	Role       string
}

type User added in v0.14.0

type User struct {
	Login     string   `yaml:"user"`
	Callsign  string   `yaml:"callsign,omitempty"`
	Team      string   `yaml:"team,omitempty"`
	Role      string   `yaml:"role,omitempty"`
	Typ       string   `yaml:"type,omitempty"`
	Password  string   `yaml:"password"`
	Scope     string   `yaml:"scope"`
	ReadScope []string `yaml:"read_scope,omitempty"`
}

func (*User) CanSeeScope added in v0.14.4

func (u *User) CanSeeScope(scope string) bool

func (*User) GetLogin added in v0.14.4

func (u *User) GetLogin() string

func (*User) GetScope added in v0.14.4

func (u *User) GetScope() string

Jump to

Keyboard shortcuts

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