Documentation ¶
Index ¶
- func ToUserResponse(user *models.User) *dto.UserResponse
- type AccessService
- func (s *AccessService) CreateVoteVisibility(c context.Context, surveyID uint, viewerID uint, ...) (dto.VoteVisibilityResponse, error)
- func (s *AccessService) DeleteUserSurveyRole(c context.Context, surveyID uint, userID uint, roleID uint) error
- func (s *AccessService) DeleteVoteVisibilityById(c context.Context, id uint) error
- func (s *AccessService) GetAllPermissions(c context.Context) ([]models.Permission, error)
- func (s *AccessService) GetUserRolesForSomeSurvey(c context.Context, userID uint, surveyID uint) (*dto.GetUserRolesForSomeSurveyResponse, error)
- func (s *AccessService) SetRole(c context.Context, req dto.SurveyRoleAssignRequest) (*dto.SurveyRoleAssignResponse, error)
- type IAccessService
- type IUserService
- type UserService
- func (s *UserService) BuyVote(ctx context.Context, buyerID, sellerID uint, voteID uint, amount float64) error
- func (s *UserService) Deposit(ctx context.Context, userID uint, amount float64) error
- func (s *UserService) GetBalance(ctx context.Context, userID uint) (float64, error)
- func (s *UserService) GetUser(c context.Context, id uint) (*dto.UserResponse, error)
- func (s *UserService) GetUsers(c context.Context, r dto.UserGetRequest) ([]*dto.UserResponse, error)
- func (s *UserService) GetVoterID(ctx context.Context, voteID uint) (uint, error)
- func (s *UserService) Login(c context.Context, req dto.LoginRequest) (string, time.Time, error)
- func (s *UserService) SellVote(ctx context.Context, sellerID, buyerID uint, voteID uint, amount float64) error
- func (s *UserService) SetMaxSurveys(ctx context.Context, userID string, maxSurveys int) error
- func (s *UserService) Transfer(ctx context.Context, senderID, receiverID uint, amount float64) error
- func (s *UserService) UpdateUserProfile(c context.Context, userID uint, req dto.UpdateUserRequest) (*dto.UserResponse, error)
- func (s *UserService) Withdraw(ctx context.Context, userID uint, amount float64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToUserResponse ¶
func ToUserResponse(user *models.User) *dto.UserResponse
Types ¶
type AccessService ¶
type AccessService struct {
// contains filtered or unexported fields
}
func NewAccessService ¶
func NewAccessService(conf *config.Config, repo repository.IAccessRepository, logger logging.Logger, notificationService notification.INotificationService) *AccessService
func (*AccessService) CreateVoteVisibility ¶
func (s *AccessService) CreateVoteVisibility(c context.Context, surveyID uint, viewerID uint, req dto.VoteVisibilityCreateRequest) (dto.VoteVisibilityResponse, error)
func (*AccessService) DeleteUserSurveyRole ¶
func (*AccessService) DeleteVoteVisibilityById ¶
func (s *AccessService) DeleteVoteVisibilityById(c context.Context, id uint) error
func (s *AccessService) GetVoteVisibilityById(c context.Context, id uint) (dto.VoteVisibilityResponse, error) { res, err := s.repo.GetVoteVisibilityById(c, id) if err != nil { return dto.VoteVisibilityResponse{}, err } return dto.VoteVisibilityResponse{ ID: res.ID, SurveyID: res.SurveyID, ViewerID: res.ViewerID, RespondentID: res.RespondentID, }, err }
func (s *AccessService) GetVoteVisibilityBySurveyId(ctx context.Context, surveyId uint) ([]dto.VoteVisibilityResponse, error) { res, err := s.repo.GetVoteVisibilityBySurveyId(ctx, surveyId) if err != nil { return nil, err } var response []dto.VoteVisibilityResponse for _, vv := range res { response = append(response, dto.VoteVisibilityResponse{ ID: vv.ID, SurveyID: vv.SurveyID, ViewerID: vv.ViewerID, RespondentID: vv.RespondentID, }) } return response, nil }
func (*AccessService) GetAllPermissions ¶
func (s *AccessService) GetAllPermissions(c context.Context) ([]models.Permission, error)
func (*AccessService) GetUserRolesForSomeSurvey ¶
func (s *AccessService) GetUserRolesForSomeSurvey(c context.Context, userID uint, surveyID uint) (*dto.GetUserRolesForSomeSurveyResponse, error)
func (*AccessService) SetRole ¶
func (s *AccessService) SetRole(c context.Context, req dto.SurveyRoleAssignRequest) (*dto.SurveyRoleAssignResponse, error)
type IAccessService ¶
type IAccessService interface { SetRole(c context.Context, req dto.SurveyRoleAssignRequest) (*dto.SurveyRoleAssignResponse, error) GetUserRolesForSomeSurvey(c context.Context, userID uint, surveyID uint) (*dto.GetUserRolesForSomeSurveyResponse, error) GetAllPermissions(c context.Context) ([]models.Permission, error) DeleteUserSurveyRole(c context.Context, surveyID uint, userID uint, roleID uint) error CreateVoteVisibility(c context.Context, surveyID uint, viewerID uint, request dto.VoteVisibilityCreateRequest) (dto.VoteVisibilityResponse, error) }
type IUserService ¶
type IUserService interface { GetUsers(context.Context, dto.UserGetRequest) ([]*dto.UserResponse, error) SetMaxSurveys(ctx context.Context, userID string, maxSurveys int) error Login(c context.Context, req dto.LoginRequest) (string, time.Time, error) UpdateUserProfile(c context.Context, userID uint, req dto.UpdateUserRequest) (*dto.UserResponse, error) GetUser(c context.Context, id uint) (*dto.UserResponse, error) Deposit(ctx context.Context, userID uint, amount float64) error Transfer(ctx context.Context, senderID, receiverID uint, amount float64) error Withdraw(ctx context.Context, userID uint, amount float64) error BuyVote(ctx context.Context, buyerID, sellerID uint, voteID uint, amount float64) error SellVote(ctx context.Context, sellerID, buyerID uint, voteID uint, amount float64) error GetVoterID(ctx context.Context, voteID uint) (uint, error) GetBalance(ctx context.Context, userID uint) (float64, error) }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func New ¶
func New(conf *config.Config, repo repository.IUserRepository, logger logging.Logger) *UserService
func (*UserService) GetBalance ¶
func (*UserService) GetUser ¶
func (s *UserService) GetUser(c context.Context, id uint) (*dto.UserResponse, error)
func (*UserService) GetUsers ¶
func (s *UserService) GetUsers(c context.Context, r dto.UserGetRequest) ([]*dto.UserResponse, error)
func (*UserService) GetVoterID ¶
func (*UserService) Login ¶
func (s *UserService) Login(c context.Context, req dto.LoginRequest) (string, time.Time, error)
func (*UserService) SetMaxSurveys ¶
func (*UserService) UpdateUserProfile ¶
func (s *UserService) UpdateUserProfile(c context.Context, userID uint, req dto.UpdateUserRequest) (*dto.UserResponse, error)
Click to show internal directories.
Click to hide internal directories.