Documentation
¶
Index ¶
- type Dialog
- type DialogController
- type DialogControllerConfig
- type DialogCreate
- type DialogList
- type DialogPartner
- type DialogService
- type DialogUpdate
- type Group
- type GroupController
- type GroupControllerConfig
- type GroupCreate
- type GroupList
- type GroupParticipant
- type GroupParticipantController
- type GroupParticipantControllerConfig
- type GroupParticipantList
- type GroupParticipantService
- type GroupParticipantUpdate
- type GroupService
- type GroupUpdate
- type Message
- type MessageController
- type MessageControllerConfig
- type MessageCreate
- type MessageList
- type MessageService
- type User
- type UserController
- type UserControllerConfig
- type UserCreate
- type UserList
- type UserService
- type UserUpdate
- type UserUpdatePassword
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"`
}
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 ¶
func NewDialogList ¶
func NewDialogList(dialogs []entity.Dialog) DialogList
type DialogPartner ¶
type DialogService ¶
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 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 ¶
func NewGroupList ¶
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 NewGroupParticipantController ¶
func NewGroupParticipantController(conf GroupParticipantControllerConfig) *GroupParticipantController
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 ¶
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 ¶
func NewMessageList ¶
func NewMessageList(messages []entity.Message) MessageList
type MessageService ¶
type 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 ¶
func NewUserList ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.