Documentation ¶
Index ¶
- func NewAgregator(repo Repository, logger log.Logger) agregator
- func RegisterHandlers(router *fiber.App, agregator Agregator, logger log.Logger)
- type Advert
- type AdvertDisplay
- type Agregator
- type Category
- type CategoryPath
- type DeleteAdvertForm
- type LoginForm
- type Message
- type MessageForm
- type MessageSender
- type ProfileForm
- type QuickAdvertForm
- type QuickSearchForm
- type Repository
- type SignupForm
- type SupportForm
- type User
- type WatchAuthorForm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAgregator ¶
func NewAgregator(repo Repository, logger log.Logger) agregator
NewAgregator creates a new album agregator.
func RegisterHandlers ¶
RegisterHandlers sets up the routing of the HTTP handlers.
Types ¶
type AdvertDisplay ¶
type AdvertDisplay struct {
dto.AdvertDisplay
}
type Agregator ¶
type Agregator interface { GetUsersWithLimitOffset(ctx context.Context, limit, offset int64) ([]User, error) GetUserById(ctx context.Context, id int64) (User, error) GetUserByAdvertId(ctx context.Context, aid int64) (User, error) UpdateUserLastlogin(ctx context.Context, uid int64, dtstring string) error GetUserByEmail(ctx context.Context, email string) (User, error) GetAdvertById(ctx context.Context, id int64) (Advert, error) GetAdvertsDisplayByUserId(ctx context.Context, uid int64) ([]AdvertDisplay, error) GetAdvertsLast(ctx context.Context) ([]Advert, error) GetAdvertsSearch(ctx context.Context, clause string) ([]Advert, error) GetAdvertsByUserId(ctx context.Context, uid int64) ([]Advert, error) DeleteAdvertsData(ctx context.Context, aid int64) error CreateUser(ctx context.Context, fdata *SignupForm, dtstring, roles, notes, avafile string) (int64, error) GetMessagesSendersByUserId(ctx context.Context, uid int64) ([]MessageSender, error) CreateMessage(ctx context.Context, fromId, toId int64, msg, dtstring string) error UpdateUser(ctx context.Context, fdata *ProfileForm, uid int64, avafile string) error UpdateAdvertsPicture(ctx context.Context, aid int64, field, fname string) error CreateAdvert(ctx context.Context, f *QuickAdvertForm, uid int64, dt string) (int64, error) GetCategoriesPath(ctx context.Context) ([]CategoryPath, error) }
Agregator encapsulates usecase logic for albums
type CategoryPath ¶
type CategoryPath struct {
entity.CategoryPath
}
type DeleteAdvertForm ¶
type DeleteAdvertForm struct {
AdvertId int64 `json:"advert_id" form:"advert_id"`
}
type LoginForm ¶
type LoginForm struct { Username string `json:"username" form:"username"` CurrentPassword string `json:"current-password" form:"current-password"` }
LoginForm represents an album update request.
type MessageForm ¶
type MessageForm struct { AdvertId int64 `json:"advert-id" form:"advert-id"` Email string `json:"email" form:"email"` GivenName string `json:"given-name" form:"given-name"` Msg string `json:"msg" form:"msg"` }
MessageForm represents an album update request.
func (MessageForm) Validate ¶
func (m MessageForm) Validate() error
type MessageSender ¶
type MessageSender struct {
dto.MessageSender
}
type ProfileForm ¶
type ProfileForm struct { Tel string `json:"tel" form:"tel"` GivenName string `json:"given-name" form:"given-name"` NewPassword string `json:"new-password" form:"new-password"` NewPasswordRepeat string `json:"new-password-repeat" form:"new-password-repeat"` }
ProfileForm represents an album update request.
func (ProfileForm) Validate ¶
func (m ProfileForm) Validate() error
Validate validates the ProfileForm fields
type QuickAdvertForm ¶
type QuickAdvertForm struct { Email string `json:"email" form:"email"` GivenName string `json:"given-name" form:"given-name"` CategoryId int64 `json:"category_id" form:"category_id"` Price string `json:"price" form:"price"` Nanopost string `json:"nanopost" form:"nanopost"` Tel string `json:"tel" form:"tel"` }
func (QuickAdvertForm) Validate ¶
func (m QuickAdvertForm) Validate() error
Validate validates the QuickAdvertForm fields
type QuickSearchForm ¶
type QuickSearchForm struct { CategoryId int64 `json:"category-id" form:"category-id"` Clause string `json:"q" form:"q"` }
func (QuickSearchForm) Validate ¶
func (m QuickSearchForm) Validate() error
Validate validates the QuickAdvertForm fields
type Repository ¶
type Repository interface { // Get returns the users with follow by specified limit-offset params. GetUsersWithLimitOffset(ctx context.Context, limit, offset int64) ([]entity.User, error) // Get returns the advert with the specified advert ID. GetAdvertById(ctx context.Context, id int64) (entity.Advert, error) // Get returns the advert with the specified advert ID. GetAdvertsLast(ctx context.Context) ([]entity.Advert, error) // Get returns the Messages by specified User_ID. GetMessagesSendersByUserId(ctx context.Context, uid int64) ([]dto.MessageSender, error) // Get returns the advert by word filtered like function. GetAdvertsSearch(ctx context.Context, word string) ([]entity.Advert, error) // Get returns the adverts by user_id. GetAdvertsByUserId(ctx context.Context, uid int64) ([]entity.Advert, error) // Get returns the user with the specified user_id. GetUserById(ctx context.Context, id int64) (entity.User, error) // Get returns the user with the specified advert_id. GetUserByAdvertId(ctx context.Context, aid int64) (entity.User, error) // Get returns the advert with the specified email. GetUserByEmail(ctx context.Context, email string) (entity.User, error) // Count returns the number of adverts. Count(ctx context.Context) (int, error) // Query returns the list of adverts with the given offset and limit. QueryAdverts(ctx context.Context, offset, limit int) ([]entity.Advert, error) // Create saves a new user in the storage. CreateUser(ctx context.Context, user entity.User) (int64, error) // Update user in the storage. UpdateUser(ctx context.Context, user entity.User, uid int64) error // Update User lastlogin field UpdateUserLastlogin(ctx context.Context, uid int64, dtstring string) error // Update User Adverts Picture UpdateAdvertsPicture(ctx context.Context, aid int64, field, fname string) error // Create saves a new advert in the storage. CreateAdvert(ctx context.Context, advert entity.Advert) (int64, error) // Getting advert by user_id. GetAdvertsDisplayByUserId(ctx context.Context, id int64) ([]dto.AdvertDisplay, error) // Create saves a new advert in the storage. CreateMessage(ctx context.Context, message entity.Message) error // Update updates the advert with given ID in the storage. Update(ctx context.Context, advert entity.Advert) error // Delete removes the advert with given ID from the storage. DeleteAdvertById(ctx context.Context, id int64) error // GetCategory(ctx) returns the list of adverts with the given offset and limit. GetCategory(ctx context.Context) ([]entity.Category, error) // GetCategoryPath(ctx) returns the list categories by special tree pathes query. GetCategoryPath(ctx context.Context) ([]entity.CategoryPath, error) }
Repository encapsulates the logic to access adverts from the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new advert repository
type SignupForm ¶
type SignupForm struct { Email string `json:"email" form:"email"` GivenName string `json:"given-name" form:"given-name"` NewPassword string `json:"new-password" form:"new-password"` NewPasswordRepeat string `json:"new-password-repeat" form:"new-password-repeat"` Tel string `json:"tel" form:"tel"` }
SignupForm represents an album update request.
func (SignupForm) Validate ¶
func (m SignupForm) Validate() error
Validate validates the SignupForm fields
type SupportForm ¶
type SupportForm struct { Email string `json:"email" form:"email"` Subject string `json:"subject" form:"subject"` GivenName string `json:"given-name" form:"given-name"` Msg string `json:"msg" form:"msg"` }
SupportForm represents an album update request.
func (SupportForm) Validate ¶
func (m SupportForm) Validate() error
type WatchAuthorForm ¶
type WatchAuthorForm struct { RecaptchaResponse string `json:"g-recaptcha-response" form:"g-recaptcha-response"` AdvertId int64 `json:"advert_id" form:"advert_id"` SignerUA string `json:"signer_ua" form:"signer_ua"` SignerScreen string `json:"signer_screen" form:"signer_screen"` SignerLangs string `json:"signer_langs" form:"signer_langs"` SignerTime string `json:"signer_time" form:"signer_time"` }
func (WatchAuthorForm) Validate ¶
func (m WatchAuthorForm) Validate() error
Validate validates the WatchAuthorForm fields