models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Large     = "large"
	Medium    = "medium"
	Small     = "small"
	Thumbnail = "thumbnail"
)

Variables

View Source
var SupportedAttachmentTypes = map[string]bool{"image": true, "gif": true, "video": true}

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Url  string `json:"url"`
	Type string `json:"type"`
}

type Birthday

type Birthday struct {
	Year  int `json:"year"`
	Month int `json:"month"`
	Day   int `json:"day"`
}

type Conversation

type Conversation struct {
	ID             string         `json:"id"`
	LastUpdated    sql.NullTime   `json:"last_updated"`
	Receiver       User           `json:"receiver"`
	LastMessage    sql.NullString `json:"last_message"`
	UnreadMessages int            `json:"unread_messages"`
}

type ConversationInitPayload

type ConversationInitPayload struct {
	ReceiverId string `json:"receiverId"`
	SenderId   string `json:"senderId"`
}

type DBAttachment

type DBAttachment struct {
	Urls  pgtype.VarcharArray `json:"url"`
	Types pgtype.VarcharArray `json:"type"`
}

type DBPost

type DBPost struct {
	ID          string       `json:"id"`
	Author      User         `json:"author"`
	Content     string       `json:"content"`
	CreatedAt   time.Time    `json:"created_at"`
	ReplyingTo  ParentPost   `json:"replying_to"`
	Attachments []Attachment `json:"attachments"`
	Likes       int          `json:"likes"`
	Comments    int          `json:"comments"`
	Liked       bool         `json:"liked"`
}

type DeleteMessageBody

type DeleteMessageBody struct {
	MessageID      string `json:"message_id"`
	ConversationID string `json:"conversation_id"`
}

type DeleteMessageSocketPayload

type DeleteMessageSocketPayload struct {
	MessageID  string `json:"message_id"`
	ReceiverID string `json:"receiver_id"`
}

type DeletePostBody

type DeletePostBody struct {
	PostAuthorId string `json:"postAuthorId"`
	PostId       string `json:"postId"`
}

type ForgotPasswordCreds

type ForgotPasswordCreds struct {
	Email string `json:"email"`
}

type LikePostBody

type LikePostBody struct {
	PostId   string   `json:"postId"`
	LikeType LikeType `json:"likeType"`
}

type LikeType

type LikeType string

func (LikeType) String

func (n LikeType) String() string

type LoginCreds

type LoginCreds struct {
	Username     string `json:"username"`
	Password     string `json:"password"`
	StayLoggedIn bool   `json:"stayLoggedIn"`
}

type MarkMessagesAsReadData

type MarkMessagesAsReadData struct {
	ConversationID string `json:"conversationId"`
	UserID         string `json:"userId"`
}

type MarkMessagesAsReadReturnData

type MarkMessagesAsReadReturnData struct {
	ConversationID string `json:"conversationId"`
}

type Message

type Message struct {
	ID             string     `json:"id"`
	AuthorID       string     `json:"author_id"`
	ConversationID string     `json:"conversation_id"`
	Content        string     `json:"content"`
	SentTime       time.Time  `json:"sent_time"`
	ReadBy         []string   `json:"read_by"`
	Attachment     Attachment `json:"attachment"`
	Deleted        bool       `json:"deleted"`
}

type MessageReturnPayload

type MessageReturnPayload struct {
	MessageID      string     `json:"id"`
	Attachment     Attachment `json:"attachment"`
	Content        string     `json:"content"`
	ConversationID string     `json:"conversation_id"`
	ReceiverID     string     `json:"receiver_id"`
	AuthorID       string     `json:"author_id"`
	SentTime       string     `json:"sent_time"`
	Deleted        bool       `json:"deleted"`
}

type ParentPost

type ParentPost struct {
	ID         sql.NullString `json:"id"`
	Author     ParentUser     `json:"author"`
	Content    sql.NullString `json:"content"`
	CreatedAt  sql.NullTime   `json:"created_at"`
	ReplyingTo *ParentPost    `json:"replying_to"`
	Likes      sql.NullInt32  `json:"likes"`
	Comments   sql.NullInt32  `json:"comments"`
}

type ParentUser

type ParentUser struct {
	ID            sql.NullString `json:"id"`
	Username      sql.NullString `json:"username"`
	DisplayName   sql.NullString `json:"display_name"`
	Bio           sql.NullString `json:"bio"`
	AvatarURL     sql.NullString `json:"avatar_url"`
	Birthday      sql.NullTime   `json:"birthday"`
	CreatedAt     sql.NullTime   `json:"created_at"`
	FinishedSetup sql.NullBool   `json:"finished_setup"`
}

type PostReturnPayload

type PostReturnPayload struct {
	ID          string       `json:"id"`
	Content     string       `json:"content"`
	Author      User         `json:"author"`
	CreatedAt   time.Time    `json:"created_at"`
	Attachments []Attachment `json:"attachments"`
	Likes       int          `json:"likes"`
	Comments    int          `json:"comments"`
	ReplyingTo  ParentPost   `json:"replying_to"`
}

type ProfileValues

type ProfileValues struct {
	UserID       string           `json:"userId"`
	DisplayName  string           `json:"displayName"`
	ProfileImage SocketAttachment `json:"profileImage"`
	Bio          string           `json:"bio"`
	Birthday     Birthday         `json:"birthday"`
}

type RegisterCreds

type RegisterCreds struct {
	Username        string `json:"username"`
	Password        string `json:"password"`
	Email           string `json:"email"`
	ConfirmPassword string `json:"confirm_password"`
}

type RemoveBirthdayReturnPayload

type RemoveBirthdayReturnPayload struct {
	ID string `json:"id"`
}

type ResetPasswordCreds

type ResetPasswordCreds struct {
	Token           string `json:"token"`
	Password        string `json:"password"`
	ConfirmPassword string `json:"confirm_password"`
}

type SocketAttachment

type SocketAttachment struct {
	Mimetype string `json:"mimetype"`
	Data     string `json:"data"`
}

type SocketComment

type SocketComment struct {
	Content       string             `json:"content"`
	ContentLength int                `json:"contentLength"`
	Author        User               `json:"author"`
	Attachments   []SocketAttachment `json:"attachments"`
	ReplyingTo    string             `json:"replying_to"`
}

type SocketMessage

type SocketMessage struct {
	Content        string           `json:"message_content"`
	Attachment     SocketAttachment `json:"attachment"`
	SenderId       string           `json:"sender_id"`
	ReceiverId     string           `json:"receiver_id"`
	ConversationId string           `json:"conversation_id"`
}

type SocketPayload

type SocketPayload struct {
	EventType string      `json:"eventType"`
	Data      interface{} `json:"data"`
}

type SocketPost

type SocketPost struct {
	Content       string             `json:"content"`
	ContentLength int                `json:"contentLength"`
	Author        User               `json:"author"`
	Attachments   []SocketAttachment `json:"attachments"`
}

type TypingData

type TypingData struct {
	ConversationID string `json:"conversationId"`
	ReceiverID     string `json:"receiverId"`
}

type TypingReturnPayload

type TypingReturnPayload struct {
	ConversationID string `json:"conversationId"`
}

type UpdateProfileReturnPayload

type UpdateProfileReturnPayload struct {
	UserID       string       `json:"userId"`
	DisplayName  string       `json:"displayName"`
	Bio          string       `json:"bio"`
	ProfileImage string       `json:"profileImage"`
	Birthday     sql.NullTime `json:"birthday"`
}

type User

type User struct {
	ID            string       `json:"id"`
	Username      string       `json:"username"`
	DisplayName   string       `json:"display_name"`
	Bio           string       `json:"bio"`
	AvatarURL     string       `json:"avatar_url"`
	Birthday      sql.NullTime `json:"birthday"`
	CreatedAt     time.Time    `json:"created_at"`
	FinishedSetup bool         `json:"finished_setup"`
}

Jump to

Keyboard shortcuts

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