services

package
v0.0.0-...-501be23 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatService

type ChatService struct {
	ChatStorer         models.IChatStorer
	ParticipantStorer  models.IParticipantStorer
	MessageStorer      models.IMessageStorer
	ParticipantService IParticipantService
}

func NewChatService

func NewChatService(chatStorer models.IChatStorer, participantStorer models.IParticipantStorer, messageStorer models.IMessageStorer, participantService ParticipantService) ChatService

func (ChatService) Create

func (cs ChatService) Create(userId int, chatWithTitle models.ChatFromRequest) (*models.Chat, utils.HttpError)

func (ChatService) Delete

func (cs ChatService) Delete(userId, chatId int) (*models.Chat, utils.HttpError)

func (ChatService) GetOne

func (cs ChatService) GetOne(userId, chatId int) (*models.Chat, utils.HttpError)

func (ChatService) GetUserChats

func (cs ChatService) GetUserChats(userId int) ([]models.Chat, utils.HttpError)

func (ChatService) Update

func (cs ChatService) Update(userId int, chat models.Chat) (*models.Chat, utils.HttpError)

type IChatService

type IChatService interface {
	Create(userId int, chat models.ChatFromRequest) (*models.Chat, utils.HttpError)
	GetOne(userId, chatId int) (*models.Chat, utils.HttpError)
	GetUserChats(userId int) ([]models.Chat, utils.HttpError)
	Update(userId int, chat models.Chat) (*models.Chat, utils.HttpError)
	Delete(userId, chatId int) (*models.Chat, utils.HttpError)
}

type IMessageService

type IMessageService interface {
	Create(userId int, MessageTDO models.MessageFromRequest) (*models.Message, utils.HttpError)
	GetOne(userId, messageId int) (*models.Message, utils.HttpError)
	GetChatMessages(userId, chatId, page int) ([]models.Message, utils.HttpError)
	Update(userId int, message models.Message) (*models.Message, utils.HttpError)
	Delete(userId int, message models.Message) (*models.Message, utils.HttpError)
}

type IParticipantService

type IParticipantService interface {
	Create(userId int, participant models.Participant) (*models.Participant, utils.HttpError)
	GetChatUsers(userId, chatId int) ([]models.ChatUser, utils.HttpError)
	Update(userId int, participant models.Participant) (*models.Participant, utils.HttpError)
	Delete(userId int, participant models.Participant) (*models.Participant, utils.HttpError)
	UserInChat(userId, chatId int) (bool, error)
}

type IUserService

type IUserService interface {
	GetOne(userId int) (*models.User, utils.HttpError)
	Update(userId int, user models.User) (*models.User, utils.HttpError)
	Delete(userId int, user models.User) (*models.User, utils.HttpError)
}

type MessageService

type MessageService struct {
	MessageStorer      models.IMessageStorer
	ParticipantService IParticipantService
}

func NewMessageService

func NewMessageService(messageStorer models.IMessageStorer, participantService IParticipantService) MessageService

func (MessageService) Create

func (ms MessageService) Create(userId int, fromRequest models.MessageFromRequest) (*models.Message, utils.HttpError)

func (MessageService) Delete

func (ms MessageService) Delete(userId int, message models.Message) (*models.Message, utils.HttpError)

func (MessageService) GetChatMessages

func (ms MessageService) GetChatMessages(userId, chatId, page int) ([]models.Message, utils.HttpError)

func (MessageService) GetOne

func (ms MessageService) GetOne(userId, messageId int) (*models.Message, utils.HttpError)

func (MessageService) Update

func (ms MessageService) Update(userId int, message models.Message) (*models.Message, utils.HttpError)

type ParticipantService

type ParticipantService struct {
	ParticipantStorer models.IParticipantStorer
}

func NewParticipantService

func NewParticipantService(participantStorer models.IParticipantStorer) ParticipantService

func (ParticipantService) Create

func (ps ParticipantService) Create(userId int, participant models.Participant) (*models.Participant, utils.HttpError)

func (ParticipantService) Delete

func (ps ParticipantService) Delete(userId int, participant models.Participant) (*models.Participant, utils.HttpError)

func (ParticipantService) GetChatUsers

func (ps ParticipantService) GetChatUsers(userId, chatId int) ([]models.ChatUser, utils.HttpError)

func (ParticipantService) Update

func (ps ParticipantService) Update(userId int, participant models.Participant) (*models.Participant, utils.HttpError)

func (ParticipantService) UserInChat

func (ps ParticipantService) UserInChat(userId, chatId int) (bool, error)

type UserService

type UserService struct {
	UserStorer models.IUserStorer
}

func NewUserService

func NewUserService(userStorer models.IUserStorer) UserService

func (UserService) Delete

func (us UserService) Delete(userId int, user models.User) (*models.User, utils.HttpError)

func (UserService) GetOne

func (us UserService) GetOne(userId int) (*models.User, utils.HttpError)

func (UserService) Update

func (us UserService) Update(userId int, user models.User) (*models.User, utils.HttpError)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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