models

package
v0.0.0-...-d8d7f37 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Error   bool   `json:"error"`
	Message string `json:"message"`
}

type ApiSuccess

type ApiSuccess struct {
	Success bool `json:"success"`
}

type ClientMessage

type ClientMessage struct {
	Type        string `json:"type"`
	SenderId    string `json:"senderId"`
	RecipientId string `json:"recipientId"`
}

type Conversation

type Conversation struct {
	ID        uint64    `gorm:"primaryKey;uniqueIndex;" json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	Users     []Profile `gorm:"many2many:profiles_conversations;constraint:onDelete:CASCADE" json:"users"`
	Messages  []Message `gorm:"foreignKey:ConversationId;references:ID;constraint:onDelete:CASCADE;" json:"messages"`
}

type Friend

type Friend struct {
	ID        uint64    `gorm:"primaryKey;uniqueIndex;" json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	Profiles  []Profile `gorm:"many2many:profiles_friends" json:"profiles"`
}

type FriendRequest

type FriendRequest struct {
	ID          uint64       `gorm:"primaryKey;uniqueIndex;" json:"id"`
	CreatedAt   time.Time    `json:"createdAt"`
	SenderId    string       `json:"senderId"`
	RecipientId string       `json:"recipientId"`
	Sender      ShortProfile `json:"sender"`
	Recipient   ShortProfile `json:"recipient"`
}

type Message

type Message struct {
	ID             uint64       `gorm:"primaryKey;uniqueIndex;" json:"id"`
	CreatedAt      time.Time    `json:"createdAt"`
	ConversationId uint64       `json:"conversationId"`
	From           string       `json:"from"`
	Content        string       `json:"content"`
	Seen           bool         `json:"seen"`
	Pinned         bool         `json:"pinned"`
	Conversation   Conversation `json:"conversation"`
}

type PrivateKey

type PrivateKey struct {
	ID string `gorm:"primaryKey;uniqueIndex;" json:"id"`
	X  uint64 `json:"x"`
	Y  uint64 `json:"y"`
	D  uint64 `json:"d"`
}

type Profile

type Profile struct {
	ID                     string          `gorm:"primaryKey;uniqueIndex" json:"id"`
	CreatedAt              time.Time       `json:"createdAt"`
	Username               string          `json:"username"`
	Image                  string          `json:"image"`
	Bio                    string          `json:"bio"`
	PublicKey              string          `json:"publicKey"`
	SentFriendRequests     []FriendRequest `gorm:"foreignKey:SenderId;references:ID;constraint:onDelete:CASCADE;" json:"sentFriendRequests"`
	RecievedFriendRequests []FriendRequest `gorm:"foreignKey:RecipientId;references:ID;constraint:onDelete:CASCADE;" json:"recievedFriendRequests"`
	Friends                []Friend        `gorm:"many2many:profiles_friends" json:"friends"`
	Reports                []Report        `gorm:"foreignKey:ReportedId;references:ID;constraint:onDelete:CASCADE;" json:"reports"`
	Conversations          []Conversation  `gorm:"many2many:profiles_conversations;"`
}

type ProfilesConversations

type ProfilesConversations struct {
	ProfileID      string `gorm:"primaryKey;uniqueIndex:user_id_conversation_id;" json:"profileId"`
	ConversationID uint64 `gorm:"primaryKey;uniqueIndex:user_id_conversation_id;" json:"conversationId"`
}

type ProfilesFriends

type ProfilesFriends struct {
	ProfileID string `gorm:"primaryKey;uniqueIndex:profile_id_friendship_id;" json:"profileId"`
	FriendID  uint64 `gorm:"primaryKey;uniqueIndex:profile_id_friendship_id;" json:"friendshipId"`
}

type Report

type Report struct {
	ID            uint64    `gorm:"primaryKey;uniqueIndex;" json:"id"`
	CreatedAt     time.Time `json:"createdAt"`
	ReportedId    string    `json:"reportedId"`
	Spam          bool      `json:"spam"`
	Abuse         bool      `json:"abuse"`
	Impersonation bool      `json:"impersonation"`
	Illicit       bool      `json:"illicit"`
	Additional    string    `json:"additional"`
}

type ShortProfile

type ShortProfile struct {
	ID        string    `gorm:"primaryKey;uniqueIndex;" json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	Username  string    `json:"username"`
	Image     string    `json:"image"`
	Bio       string    `json:"bio"`
	PublicKey string    `json:"publicKey"`
}

type User

type User struct {
	ID                  string     `gorm:"primaryKey;default:gen_random_uuid();uniqueIndex:id_username_image;" json:"id"`
	CreatedAt           time.Time  `json:"createdAt"`
	ClerkId             string     `json:"clerkId"`
	ClerkPrimaryEmailId string     `json:"clerkPrimaryEmailId"`
	Username            string     `gorm:"uniqueIndex:id_username_image" json:"username"`
	Email               string     `gorm:"uniqueIndex" json:"email"`
	Image               string     `gorm:"uniqueIndex:id_username_image" json:"image"`
	PrivateKey          PrivateKey `gorm:"foreignKey:ID;references:ID;constraint:onDelete:CASCADE;" json:"privateKey"`
	Profile             Profile    `` /* 137-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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