services

package
v0.0.0-...-6a6bf98 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountService

type AccountService interface {
	GetAccounts(ctx context.Context) ([]types.Account, error)
	GetAccountById(ctx context.Context, accountId uuid.UUID) (*types.Account, error)

	SetActive(ctx context.Context, accountId uuid.UUID) error
	SetInactive(ctx context.Context, accountId uuid.UUID) error

	CreateAccount(ctx context.Context, username, password string, defaultRole *types.Role) error
	ChangePassword(ctx context.Context, accountId uuid.UUID, oldPassword, newPassword string) error
	DeleteAccount(ctx context.Context, accountId uuid.UUID) error
}

func NewAccountService

func NewAccountService(
	accountRepo repos.AccountRepo,
	roleRepo repos.RoleRepo,
	logger logging.Logger,
) AccountService

type ChannelService

type ChannelService interface {
	GetChannels(ctx context.Context) ([]types.Channel, error)
	GetChannelById(ctx context.Context, channelId uuid.UUID) (*types.Channel, error)

	AddWritePermission(ctx context.Context, channelId uuid.UUID, role string) error
	AddReadPermission(ctx context.Context, channelId uuid.UUID, role string) error
	RemoveWritePermission(ctx context.Context, channelId uuid.UUID, role string) error
	RemoveReadPermission(ctx context.Context, channelId uuid.UUID, role string) error

	CreateChannel(ctx context.Context, name string) error
	UpdateChannel(ctx context.Context, channelId uuid.UUID, name string) error
	DeleteChannel(ctx context.Context, channelId uuid.UUID) error
}

func NewChannelService

func NewChannelService(
	channelRepo repos.ChannelRepo,
	logger logging.Logger,
) ChannelService

type MessageService

type MessageService interface {
	GetMessages(
		ctx context.Context,
		channelId uuid.UUID,
		page, limit int,
	) ([]types.Message, error)

	GetMessageById(ctx context.Context, messageId uuid.UUID) (*types.Message, error)
	GetMessageReplies(ctx context.Context, messageId uuid.UUID) ([]types.Message, error)

	CreateMessage(
		ctx context.Context,
		accountId, channelId uuid.UUID,
		message string,
	) error
	CreateReply(
		ctx context.Context,
		accountId,
		channelId,
		parentId uuid.UUID,
		content string,
	) error
	UpdateMessage(
		ctx context.Context,
		accountId,
		messageId uuid.UUID,
		content string,
	) error
	DeleteMessage(
		ctx context.Context,
		accountId,
		messageId uuid.UUID,
	) error
}

func NewMessageService

func NewMessageService(
	messageRepo repos.MessageRepo,
	logger logging.Logger,
) MessageService

type RoleService

type RoleService interface {
	GetRoles(ctx context.Context) ([]types.Role, error)
	GetRoleByName(ctx context.Context, name string) (*types.Role, error)

	CreateRole(ctx context.Context, name string) error
	UpdateRole(ctx context.Context, oldName string, newName string) error
	DeleteRole(ctx context.Context, role string) error
}

func NewRoleService

func NewRoleService(
	roleRepo repos.RoleRepo,
	logger logging.Logger,
) RoleService

Jump to

Keyboard shortcuts

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