api

package
v0.0.0-...-176f8cf Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound              = errors.New("not found")
	ErrNoResults             = errors.New("no results found")
	ErrInvalidArg            = errors.New("invalid arguments")
	ErrInvalidEmail          = errors.New("invalid e-mail")
	ErrEmailAlreadyExists    = errors.New("e-mail already exists")
	ErrFacebookAlreadyExists = errors.New("facebook already exists")
	ErrUnexpected            = errors.New("unexpected error")
	ErrAccountMismatch       = errors.New("account mismatch")
)

Functions

func EqualEventDTO

func EqualEventDTO(a *EventDTO, b *EventDTO) bool

func EqualParticipantDTO

func EqualParticipantDTO(a *ParticipantDTO, b *ParticipantDTO) bool

Types

type AccessTokenDAO

type AccessTokenDAO interface {
	Load(userId int64) (*AccessTokenDTO, error)
	Insert(accessToken *AccessTokenDTO) error
	SetLastUsed(user_id int64, time int64) error
	Remove(user_id int64) error
}

type AccessTokenDTO

type AccessTokenDTO struct {
	UserId      int64
	Token       string
	LastUsed    int64
	CreatedDate int64
}

type ActiveSessionInfoDTO

type ActiveSessionInfoDTO struct {
	Node     int
	UserID   int64
	LastTime int64
}

type AttendanceResponse

type AttendanceResponse int8
const (
	AttendanceResponse_NO_RESPONSE AttendanceResponse = 0
	AttendanceResponse_NO_ASSIST   AttendanceResponse = 1
	AttendanceResponse_MAYBE       AttendanceResponse = 2
	AttendanceResponse_ASSIST      AttendanceResponse = 3
)

type Config

type Config interface {
	MaintenanceMode() bool
	ShowTestModeWarning() bool
	DomainName() string
	CertFile() string
	CertKey() string
	DbAddress() []string
	DbKeyspace() string
	DbCQLVersion() int
	ListenAddress() string
	ListenPort() int
	ImageListenPort() int
	ImageEnableHTTPS() bool
	SSHListenAddress() string
	SSHListenPort() int
	FBWebHookEnabled() bool
	FBWebHookListenPort() int
	FirebaseAPIKey() string
}

type DbSession

type DbSession interface {
	Connect() error
	IsValid() bool
	Closed() bool
}

type EventDAO

type EventDAO interface {
	RangeAll(f func(*EventDTO) error) error
	RangeEvents(f func(*EventDTO) error, event_ids ...int64) error
	LoadEvents(ids ...int64) (events []*EventDTO, err error)
	LoadEventPicture(eventId int64) (*PictureDTO, error)
	LoadParticipant(participantID int64, eventID int64) (*ParticipantDTO, error)
	Insert(event *EventDTO) error
	Replace(oldEvent *EventDTO, newEvent *EventDTO) error
	InsertParticipant(p *ParticipantDTO) error
	SetEventPicture(event_id int64, picture *PictureDTO) error
	DeleteAll() error
}

type EventDTO

type EventDTO struct {
	Id            int64
	AuthorId      int64
	AuthorName    string
	Description   string
	PictureDigest []byte
	CreatedDate   int64
	InboxPosition int64
	StartDate     int64
	EndDate       int64
	Cancelled     bool
	Timestamp     int64 // Microseconds
	Participants  map[int64]*ParticipantDTO
}

func (*EventDTO) Clone

func (d *EventDTO) Clone() *EventDTO

func (EventDTO) String

func (d EventDTO) String() string

type EventHistoryDAO

type EventHistoryDAO interface {
	Insert(userID int64, event *TimeLineEntryDTO) error
	InsertBatch(event *TimeLineEntryDTO, userIDs ...int64) error
	FindAllBackward(userID int64, fromDate time.Time) ([]int64, error)
	FindAllForward(userID int64, fromDate time.Time) ([]int64, error)
	DeleteAll() error
}

type EventState

type EventState int8
const (
	EventState_NOT_STARTED EventState = 0
	EventState_ONGOING     EventState = 1
	EventState_FINISHED    EventState = 2
	EventState_CANCELLED   EventState = 3
)

type EventTimeLineDAO

type EventTimeLineDAO interface {
	FindAllBackward(date time.Time) ([]*TimeLineEntryDTO, error)
	FindAllForward(date time.Time) ([]*TimeLineEntryDTO, error)
	FindAllBetween(fromDate time.Time, toDate time.Time) ([]*TimeLineEntryDTO, error)
	Insert(item *TimeLineEntryDTO) error
	Delete(item *TimeLineEntryDTO) error
	Replace(oldItem *TimeLineEntryDTO, newItem *TimeLineEntryDTO) error
	DeleteAll() error
}

type FriendDAO

type FriendDAO interface {
	LoadFriends(userId int64, groupId int32) ([]*FriendDTO, error)
	ContainsFriend(userId int64, otherUserId int64) (bool, error)
	LoadGroups(userId int64) ([]*GroupDTO, error)
	LoadGroupsWithMembers(userId int64) ([]*GroupDTO, error)
	SetFriendPictureDigest(userId int64, friendId int64, digest []byte) error
	InsertGroup(userId int64, group *GroupDTO) error
	SetGroupName(user_id int64, groupId int32, name string) error
	AddMembers(userId int64, groupId int32, friendIds ...int64) error
	MakeFriends(user1 *FriendDTO, user2 *FriendDTO) error
	DeleteGroup(userId int64, groupId int32) error
	DeleteMembers(userId int64, groupId int32, friendIds ...int64) error
}

type FriendDTO

type FriendDTO struct {
	UserId        int64
	Name          string
	PictureDigest []byte
}

type FriendRequestDAO

type FriendRequestDAO interface {
	Load(fromUser int64, toUser int64) (*FriendRequestDTO, error)
	LoadAll(user_id int64) ([]*FriendRequestDTO, error)
	Exist(fromUser int64, toUser int64) (bool, error)
	Insert(friendRequest *FriendRequestDTO) error
	Delete(friendRequest *FriendRequestDTO) error
}

type FriendRequestDTO

type FriendRequestDTO struct {
	ToUser      int64
	FromUser    int64
	Name        string
	Email       string
	CreatedDate int64
}

type GroupDTO

type GroupDTO struct {
	Id      int32
	Name    string
	Size    int32
	Members []int64
}

type IIDTokenDTO

type IIDTokenDTO struct {
	Token    string
	Version  int
	Platform string
}

type InvitationStatus

type InvitationStatus int8
const (
	InvitationStatus_NO_DELIVERED     InvitationStatus = 0
	InvitationStatus_SERVER_DELIVERED InvitationStatus = 1
	InvitationStatus_CLIENT_DELIVERED InvitationStatus = 2
)

type LogDAO

type LogDAO interface {
	LogRegisteredUser(userID int64, createdDate int64) error
	LogActiveSession(node int, userIDA int64, lastTime int64) error
	FindActiveSessions(node int, time time.Time) ([]*ActiveSessionInfoDTO, error)
}

type ParticipantDTO

type ParticipantDTO struct {
	UserID           int64
	EventID          int64
	Name             string
	Response         AttendanceResponse
	InvitationStatus InvitationStatus
	NameTS           int64 // Microseconds
	ResponseTS       int64 // Microseconds
	StatusTS         int64 // Microseconds
}

func (*ParticipantDTO) Clone

func (d *ParticipantDTO) Clone() *ParticipantDTO

type PictureDTO

type PictureDTO struct {
	RawData []byte
	Digest  []byte
}

type Server

type Server interface {
	Version() string
	BuildTime() string
}

type SettingOption

type SettingOption string
const (
	MasterLastArchiveTime SettingOption = "MasterLastArchiveTime"
)

type SettingsDAO

type SettingsDAO interface {
	Find(key SettingOption) (string, error)
	Insert(key SettingOption, value string) error
}

type ThumbnailDAO

type ThumbnailDAO interface {
	Load(id int64, dpi int32) ([]byte, error)
	Insert(id int64, digest []byte, thumbnails map[int32][]byte) error
	Remove(id int64) error
}

type TimeLineByEndDate

type TimeLineByEndDate []*TimeLineEntryDTO

func (TimeLineByEndDate) Len

func (a TimeLineByEndDate) Len() int

func (TimeLineByEndDate) Less

func (a TimeLineByEndDate) Less(i, j int) bool

func (TimeLineByEndDate) Swap

func (a TimeLineByEndDate) Swap(i, j int)

type TimeLineEntryDTO

type TimeLineEntryDTO struct {
	EventID  int64
	Position time.Time
}

type UserDAO

type UserDAO interface {
	Load(userId int64) (*UserDTO, error)
	LoadByEmail(email string) (*UserDTO, error)
	LoadByFB(fbId string) (*UserDTO, error)
	LoadProfilePicture(userId int64) (*PictureDTO, error)
	LoadIIDToken(userId int64) (*IIDTokenDTO, error)
	Insert(user *UserDTO) error
	InsertFacebookCredentials(userId int64, fbId string, fbToken string) (ok bool, err error)
	SetPassword(email string, newPassword [32]byte, newSalt [32]byte) (bool, error)
	SaveProfilePicture(userId int64, picture *PictureDTO) error
	SetLastConnection(userId int64, time int64) error
	SetAuthToken(userId int64, auth_token string) error
	SetFacebookCredential(userId int64, fbId string, fbToken string) error
	SetFacebook(userId int64, fbId string, fbToken string) error
	SetIIDToken(userId int64, iidToken *IIDTokenDTO) error
	Delete(user *UserDTO) error
	DeleteAll() error
}

type UserDTO

type UserDTO struct {
	Id            int64
	Name          string
	Email         string
	EmailVerified bool
	PictureDigest []byte
	IidToken      IIDTokenDTO
	AuthToken     string
	Password      [32]byte
	Salt          [32]byte
	FbId          string
	FbToken       string
	LastConn      int64
	CreatedDate   int64
}

Jump to

Keyboard shortcuts

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