managers

package
v0.0.0-...-48bfdbc Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorAvatarScope

func AuthorAvatarScope(db *gorm.DB) *gorm.DB

func AuthorReactionScope

func AuthorReactionScope(db *gorm.DB) *gorm.DB

func ChatOwnerImageScope

func ChatOwnerImageScope(db *gorm.DB) *gorm.DB

---------------------------------- CHAT MANAGEMENT --------------------------------

func ChatPreloadMessagesScope

func ChatPreloadMessagesScope(db *gorm.DB) *gorm.DB

func MessageSenderFileScope

func MessageSenderFileScope(db *gorm.DB) *gorm.DB

func MessageSenderScope

func MessageSenderScope(db *gorm.DB) *gorm.DB

func UserAvatarReactionScope

func UserAvatarReactionScope(db *gorm.DB) *gorm.DB

---------------------------------- REACTIONS MANAGEMENT --------------------------------

Types

type ChatManager

type ChatManager struct {
}

func (ChatManager) Create

func (obj ChatManager) Create(db *gorm.DB, owner models.User, ctype choices.ChatTypeChoice, recipientsOpts ...[]models.User) models.Chat

func (ChatManager) CreateGroup

func (obj ChatManager) CreateGroup(db *gorm.DB, owner models.User, usersToAdd []models.User, data schemas.GroupChatCreateSchema) models.Chat

func (ChatManager) DropData

func (obj ChatManager) DropData(db *gorm.DB)

func (ChatManager) GetByID

func (obj ChatManager) GetByID(db *gorm.DB, id uuid.UUID) models.Chat

func (ChatManager) GetByUsernames

func (obj ChatManager) GetByUsernames(db *gorm.DB, usernames []string, excludeOpts ...uuid.UUID) []models.User

func (ChatManager) GetDMChat

func (obj ChatManager) GetDMChat(db *gorm.DB, user models.User, recipientUser models.User) models.Chat

func (ChatManager) GetMessagesCount

func (obj ChatManager) GetMessagesCount(db *gorm.DB, chatID uuid.UUID) int64

func (ChatManager) GetSingleUserChat

func (obj ChatManager) GetSingleUserChat(db *gorm.DB, user models.User, id uuid.UUID) models.Chat

func (ChatManager) GetSingleUserChatFullDetails

func (obj ChatManager) GetSingleUserChatFullDetails(db *gorm.DB, user models.User, id uuid.UUID) models.Chat

func (ChatManager) GetUserChats

func (obj ChatManager) GetUserChats(db *gorm.DB, user models.User) []models.Chat

func (ChatManager) GetUserGroup

func (obj ChatManager) GetUserGroup(db *gorm.DB, user models.User, id uuid.UUID, detailedOpts ...bool) models.Chat

func (ChatManager) UpdateGroup

func (obj ChatManager) UpdateGroup(db *gorm.DB, chat *models.Chat, data schemas.GroupChatInputSchema) (*models.Chat, *utils.ErrorResponse)

func (ChatManager) UserIsMember

func (obj ChatManager) UserIsMember(chat models.Chat, targetUser models.User) bool

func (ChatManager) UsernamesToAddAndRemoveValidations

func (obj ChatManager) UsernamesToAddAndRemoveValidations(db *gorm.DB, chat *models.Chat, usernamesToAdd *[]string, usernamesToRemove *[]string) (*models.Chat, *utils.ErrorResponse)

type CommentManager

type CommentManager struct {
}

---------------------------------- COMMENT MANAGEMENT --------------------------------

func (CommentManager) Create

func (obj CommentManager) Create(db *gorm.DB, author models.User, post models.Post, text string) models.Comment

func (CommentManager) DropData

func (obj CommentManager) DropData(db *gorm.DB)

func (CommentManager) GetByPostID

func (obj CommentManager) GetByPostID(db *gorm.DB, postID uuid.UUID) []models.Comment

func (CommentManager) GetBySlug

func (obj CommentManager) GetBySlug(db *gorm.DB, slug string, opts ...bool) (*models.Comment, *int, *utils.ErrorResponse)

func (CommentManager) Update

func (obj CommentManager) Update(db *gorm.DB, comment models.Comment, author *models.User, text string) models.Comment

type FriendManager

type FriendManager struct {
}

---------------------------------- FRIEND MANAGEMENT --------------------------------

func (FriendManager) DropData

func (obj FriendManager) DropData(db *gorm.DB)

func (FriendManager) GetFriendRequests

func (obj FriendManager) GetFriendRequests(db *gorm.DB, user *models.User) []models.User

func (FriendManager) GetFriends

func (obj FriendManager) GetFriends(db *gorm.DB, user models.User) []models.User

func (FriendManager) GetRequesteeAndFriendObj

func (obj FriendManager) GetRequesteeAndFriendObj(db *gorm.DB, user *models.User, username string, statusOpts ...choices.FriendStatusChoice) (*models.User, *models.Friend, *utils.ErrorResponse)

type MessageManager

type MessageManager struct {
}

func (MessageManager) Create

func (obj MessageManager) Create(db *gorm.DB, sender models.User, chat models.Chat, text *string, fileType *string) models.Message

func (MessageManager) DropData

func (obj MessageManager) DropData(db *gorm.DB)

func (MessageManager) GetByID

func (obj MessageManager) GetByID(db *gorm.DB, id uuid.UUID) models.Message

func (MessageManager) GetUserMessage

func (obj MessageManager) GetUserMessage(db *gorm.DB, user models.User, id uuid.UUID) models.Message

func (MessageManager) Update

func (obj MessageManager) Update(db *gorm.DB, message models.Message, text *string, fileType *string) models.Message

type NotificationManager

type NotificationManager struct {
}

---------------------------------- NOTIFICATION MANAGEMENT --------------------------------

func (NotificationManager) Create

func (obj NotificationManager) Create(db *gorm.DB, sender *models.User, ntype choices.NotificationChoice, receivers []models.User, post *models.Post, comment *models.Comment, reply *models.Reply, text *string) models.Notification

func (NotificationManager) DropData

func (obj NotificationManager) DropData(db *gorm.DB)

func (NotificationManager) Get

func (obj NotificationManager) Get(db *gorm.DB, sender *models.User, ntype choices.NotificationChoice, post *models.Post, comment *models.Comment, reply *models.Reply) *models.Notification

func (NotificationManager) GetOrCreate

func (obj NotificationManager) GetOrCreate(db *gorm.DB, sender *models.User, ntype choices.NotificationChoice, receivers []models.User, post *models.Post, comment *models.Comment, reply *models.Reply) (models.Notification, bool)

func (NotificationManager) GetQueryset

func (obj NotificationManager) GetQueryset(db *gorm.DB, userID uuid.UUID) []models.Notification

func (NotificationManager) IsAmongReceivers

func (obj NotificationManager) IsAmongReceivers(db *gorm.DB, notificationID uuid.UUID, receiverID uuid.UUID) bool

func (NotificationManager) MarkAsRead

func (obj NotificationManager) MarkAsRead(db *gorm.DB, user *models.User)

func (NotificationManager) ReadOne

func (obj NotificationManager) ReadOne(db *gorm.DB, user *models.User, notificationID uuid.UUID) *utils.ErrorResponse

type PostManager

type PostManager struct {
}

---------------------------------- POST MANAGEMENT --------------------------------

func (PostManager) All

func (obj PostManager) All(db *gorm.DB) []models.Post

func (PostManager) Create

func (obj PostManager) Create(db *gorm.DB, author models.User, postData schemas.PostInputSchema) models.Post

func (PostManager) DropData

func (obj PostManager) DropData(db *gorm.DB)

func (PostManager) GetBySlug

func (obj PostManager) GetBySlug(db *gorm.DB, slug string, opts ...bool) (*models.Post, *int, *utils.ErrorResponse)

func (PostManager) Update

func (obj PostManager) Update(db *gorm.DB, post *models.Post, postData schemas.PostInputSchema) *models.Post

type ReactionManager

type ReactionManager struct {
}

func (ReactionManager) Create

func (obj ReactionManager) Create(db *gorm.DB, user models.User, focus choices.FocusTypeChoice, post *models.Post, comment *models.Comment, reply *models.Reply, rtype choices.ReactionChoice) models.Reaction

func (ReactionManager) DropData

func (obj ReactionManager) DropData(db *gorm.DB)

func (ReactionManager) GetByID

func (obj ReactionManager) GetByID(db *gorm.DB, id *uuid.UUID) (*models.Reaction, *int, *utils.ErrorResponse)

func (ReactionManager) GetReactionsQueryset

func (obj ReactionManager) GetReactionsQueryset(db *gorm.DB, fiberCtx *fiber.Ctx, focus choices.FocusTypeChoice, slug string) ([]models.Reaction, *int, *utils.ErrorResponse)

func (ReactionManager) Update

func (obj ReactionManager) Update(db *gorm.DB, reaction models.Reaction, focus choices.FocusTypeChoice, post *models.Post, comment *models.Comment, reply *models.Reply, rtype choices.ReactionChoice) models.Reaction

func (ReactionManager) UpdateOrCreate

func (obj ReactionManager) UpdateOrCreate(db *gorm.DB, user models.User, focus choices.FocusTypeChoice, slug string, rtype choices.ReactionChoice) (*models.Reaction, *models.User, *int, *utils.ErrorResponse)

type ReplyManager

type ReplyManager struct {
}

---------------------------------- REPLY MANAGEMENT --------------------------------

func (ReplyManager) Create

func (obj ReplyManager) Create(db *gorm.DB, author models.User, comment models.Comment, text string) models.Reply

func (ReplyManager) DropData

func (obj ReplyManager) DropData(db *gorm.DB)

func (ReplyManager) GetBySlug

func (obj ReplyManager) GetBySlug(db *gorm.DB, slug string, opts ...bool) (*models.Reply, *int, *utils.ErrorResponse)

func (ReplyManager) Update

func (obj ReplyManager) Update(db *gorm.DB, reply models.Reply, author *models.User, text string) models.Reply

Jump to

Keyboard shortcuts

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