v1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialog

type Dialog struct {
	ID        int           `json:"id"`
	IsBlocked bool          `json:"is_blocked"`
	Partner   DialogPartner `json:"partner"`
	CreatedAt time.Time     `json:"created_at"`
}

func NewDialog

func NewDialog(dialog entity.Dialog) Dialog

type DialogController

type DialogController struct {
	// contains filtered or unexported fields
}

func NewDialogController

func NewDialogController(conf DialogControllerConfig) *DialogController

func (*DialogController) Register

func (dc *DialogController) Register(mux *httprouter.Router)

type DialogControllerConfig

type DialogControllerConfig struct {
	Service   DialogService
	Authorize middleware.Middleware
	Validator validator.Validator
}

type DialogCreate

type DialogCreate struct {
	Partner struct {
		UserID int `json:"user_id" validate:"required"`
	} `json:"partner"`
}

func (DialogCreate) DTO

func (d DialogCreate) DTO() dto.DialogCreate

type DialogList

type DialogList struct {
	Total int      `json:"total"`
	Data  []Dialog `json:"data"`
}

func NewDialogList

func NewDialogList(dialogs []entity.Dialog) DialogList

type DialogPartner

type DialogPartner struct {
	UserID    int  `json:"user_id"`
	IsBlocked bool `json:"is_blocked"`
}

type DialogService

type DialogService interface {
	List(ctx context.Context) ([]entity.Dialog, error)
	Create(ctx context.Context, obj dto.DialogCreate) (entity.Dialog, error)
	GetByID(ctx context.Context, id int) (entity.Dialog, error)
	Update(ctx context.Context, obj dto.DialogUpdate) error
}

type DialogUpdate

type DialogUpdate struct {
	Partner struct {
		IsBlocked *bool `json:"is_blocked"`
	} `json:"partner"`
}

func (DialogUpdate) DTO

func (d DialogUpdate) DTO() dto.DialogUpdate

type Group

type Group struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
}

func NewGroup

func NewGroup(group entity.Group) Group

type GroupController

type GroupController struct {
	// contains filtered or unexported fields
}

func NewGroupController

func NewGroupController(conf GroupControllerConfig) *GroupController

func (*GroupController) Register

func (gc *GroupController) Register(mux *httprouter.Router)

type GroupControllerConfig

type GroupControllerConfig struct {
	Service   GroupService
	Authorize middleware.Middleware
	Validator validator.Validator
}

type GroupCreate

type GroupCreate struct {
	Name        string `json:"name"        validate:"required,max=255"`
	Description string `json:"description" validate:"max=10000"`
}

func (GroupCreate) DTO

func (g GroupCreate) DTO() dto.GroupCreate

type GroupList

type GroupList struct {
	Total int     `json:"total"`
	Data  []Group `json:"data"`
}

func NewGroupList

func NewGroupList(groups []entity.Group) GroupList

type GroupParticipant

type GroupParticipant struct {
	UserID  int                           `json:"user_id"`
	Status  entity.GroupParticipantStatus `json:"status"`
	IsAdmin bool                          `json:"is_admin"`
}

func NewGroupParticipant

func NewGroupParticipant(participant entity.GroupParticipant) GroupParticipant

type GroupParticipantController

type GroupParticipantController struct {
	// contains filtered or unexported fields
}

func (*GroupParticipantController) Register

func (pc *GroupParticipantController) Register(mux *httprouter.Router)

type GroupParticipantControllerConfig

type GroupParticipantControllerConfig struct {
	Service   GroupParticipantService
	Authorize middleware.Middleware
	Validator validator.Validator
}

type GroupParticipantList

type GroupParticipantList struct {
	Total int                `json:"total"`
	Data  []GroupParticipant `json:"data"`
}

func NewGroupParticipantList

func NewGroupParticipantList(participants []entity.GroupParticipant) GroupParticipantList

type GroupParticipantService

type GroupParticipantService interface {
	List(ctx context.Context, groupID int) ([]entity.GroupParticipant, error)
	Get(ctx context.Context, groupID, userID int) (entity.GroupParticipant, error)
	Invite(ctx context.Context, groupID, userID int) (entity.GroupParticipant, error)
	UpdateStatus(ctx context.Context, groupID, userID int, status entity.GroupParticipantStatus) error
}

type GroupParticipantUpdate

type GroupParticipantUpdate struct {
	Status *string `json:"status" validate:"omitempty,oneof=joined left kicked"`
}

type GroupService

type GroupService interface {
	List(ctx context.Context) ([]entity.Group, error)
	Create(ctx context.Context, obj dto.GroupCreate) (entity.Group, error)
	GetByID(ctx context.Context, id int) (entity.Group, error)
	Update(ctx context.Context, obj dto.GroupUpdate) (entity.Group, error)
	Delete(ctx context.Context, id int) error
}

type GroupUpdate

type GroupUpdate struct {
	Name        string `json:"name"        validate:"required,max=255"`
	Description string `json:"description" validate:"max=10000"`
}

func (GroupUpdate) DTO

func (g GroupUpdate) DTO() dto.GroupUpdate

type Message

type Message struct {
	ID          int                `json:"id"`
	SenderID    int                `json:"sender_id"`
	Content     string             `json:"content"`
	ContentType entity.ContentType `json:"content_type"`
	IsService   bool               `json:"is_service"`
	SentAt      time.Time          `json:"sent_at"`
	DeliveredAt *time.Time         `json:"delivered_at,omitempty"`
}

func NewMessage

func NewMessage(message entity.Message) Message

type MessageController

type MessageController struct {
	// contains filtered or unexported fields
}

func NewMessageController

func NewMessageController(conf MessageControllerConfig) *MessageController

func (*MessageController) Register

func (mc *MessageController) Register(mux *httprouter.Router)

type MessageControllerConfig

type MessageControllerConfig struct {
	Service   MessageService
	Authorize middleware.Middleware
	Validator validator.Validator
}

type MessageCreate

type MessageCreate struct {
	Content     string             `json:"content"      validate:"required,max=2000"`
	ContentType entity.ContentType `json:"content_type" validate:"required,oneof=text image"`
}

func (MessageCreate) DTO

func (mc MessageCreate) DTO() dto.MessageCreate

type MessageList

type MessageList struct {
	Total int       `json:"total"`
	Data  []Message `json:"data"`
}

func NewMessageList

func NewMessageList(messages []entity.Message) MessageList

type MessageService

type MessageService interface {
	List(ctx context.Context, obj dto.MessageList) ([]entity.Message, error)
	Create(ctx context.Context, obj dto.MessageCreate) (entity.Message, error)
}

type User

type User struct {
	ID        int    `json:"id"`
	Username  string `json:"username"`
	Email     string `json:"email"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	BirthDate string `json:"birth_date,omitempty"`
	Bio       string `json:"bio,omitempty"`
}

func NewUser

func NewUser(user entity.User) User

type UserController

type UserController struct {
	// contains filtered or unexported fields
}

func NewUserController

func NewUserController(conf UserControllerConfig) *UserController

func (*UserController) Register

func (uc *UserController) Register(mux *httprouter.Router)

type UserControllerConfig

type UserControllerConfig struct {
	Service   UserService
	Authorize middleware.Middleware
	Validator validator.Validator
}

type UserCreate

type UserCreate struct {
	UserUpdate
	Password string `json:"password" validate:"required,min=8,max=27"`
}

func (UserCreate) DTO

func (u UserCreate) DTO() dto.UserCreate

type UserList

type UserList struct {
	Total int    `json:"total"`
	Data  []User `json:"data"`
}

func NewUserList

func NewUserList(users []entity.User) UserList

type UserService

type UserService interface {
	List(ctx context.Context) ([]entity.User, error)
	Create(ctx context.Context, obj dto.UserCreate) (entity.User, error)
	GetByID(ctx context.Context, id int) (entity.User, error)
	Update(ctx context.Context, obj dto.UserUpdate) (entity.User, error)
	UpdatePassword(ctx context.Context, obj dto.UserUpdatePassword) error
	Delete(ctx context.Context, id int) error
}

type UserUpdate

type UserUpdate struct {
	Username  string `json:"username"   validate:"required,max=50"`
	Email     string `json:"email"      validate:"required,email,max=255"`
	FirstName string `json:"first_name" validate:"max=50"`
	LastName  string `json:"last_name"  validate:"max=50"`
	BirthDate string `json:"birth_date" validate:"omitempty,datetime=2006-01-02"`
	Bio       string `json:"bio"        validate:"max=10000"`
}

func (UserUpdate) DTO

func (u UserUpdate) DTO() dto.UserUpdate

type UserUpdatePassword

type UserUpdatePassword struct {
	New     string `json:"new_password"     validate:"required,min=8,max=27"`
	Current string `json:"current_password" validate:"required,min=8,max=27"`
}

Jump to

Keyboard shortcuts

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