service

package
v1.2.0-RC1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 68 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSetService = wire.NewSet(
	comment.NewCommentService,
	comment_common.NewCommentCommonService,
	report.NewReportService,
	NewVoteService,
	tag.NewTagService,
	follow.NewFollowService,
	NewCollectionGroupService,
	NewCollectionService,
	action.NewCaptchaService,
	auth.NewAuthService,
	NewUserService,
	NewQuestionService,
	NewAnswerService,
	export.NewEmailService,
	tagcommon.NewTagCommonService,
	usercommon.NewUserCommon,
	questioncommon.NewQuestionCommon,
	answercommon.NewAnswerCommon,
	uploader.NewUploaderService,
	collectioncommon.NewCollectionCommon,
	revision_common.NewRevisionService,
	NewRevisionService,
	rank.NewRankService,
	search_parser.NewSearchParser,
	NewSearchService,
	meta.NewMetaService,
	object_info.NewObjService,
	report_handle_admin.NewReportHandle,
	report_admin.NewReportAdminService,
	user_admin.NewUserAdminService,
	reason.NewReasonService,
	siteinfo_common.NewSiteInfoCommonService,
	siteinfo.NewSiteInfoService,
	notficationcommon.NewNotificationCommon,
	notification.NewNotificationService,
	activity.NewAnswerActivityService,
	dashboard.NewDashboardService,
	activity_common.NewActivityCommon,
	activity.NewActivityService,
	role.NewRoleService,
	role.NewUserRoleRelService,
	role.NewRolePowerRelService,
	user_external_login.NewUserExternalLoginService,
	user_external_login.NewUserCenterLoginService,
	plugin_common.NewPluginCommonService,
	config.NewConfigService,
	notice_queue.NewNotificationQueueService,
	activity_queue.NewActivityQueueService,
	user_notification_config.NewUserNotificationConfigService,
	notification.NewExternalNotificationService,
	notice_queue.NewNewQuestionNotificationQueueService,
)

ProviderSetService is providers.

Functions

This section is empty.

Types

type AnswerService

type AnswerService struct {
	AnswerCommon *answercommon.AnswerCommon
	// contains filtered or unexported fields
}

AnswerService user service

func NewAnswerService

func NewAnswerService(
	answerRepo answercommon.AnswerRepo,
	questionRepo questioncommon.QuestionRepo,
	questionCommon *questioncommon.QuestionCommon,
	userCommon *usercommon.UserCommon,
	collectionCommon *collectioncommon.CollectionCommon,
	userRepo usercommon.UserRepo,
	revisionService *revision_common.RevisionService,
	answerAcceptActivityRepo *activity.AnswerActivityService,
	answerCommon *answercommon.AnswerCommon,
	voteRepo activity_common.VoteRepo,
	emailService *export.EmailService,
	roleService *role.UserRoleRelService,
	notificationQueueService notice_queue.NotificationQueueService,
	externalNotificationQueueService notice_queue.ExternalNotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
) *AnswerService

func (*AnswerService) AcceptAnswer

func (as *AnswerService) AcceptAnswer(ctx context.Context, req *schema.AcceptAnswerReq) (err error)

AcceptAnswer accept answer

func (*AnswerService) AdminSetAnswerStatus

func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.AdminUpdateAnswerStatusReq) error

func (*AnswerService) Get

func (as *AnswerService) Get(ctx context.Context, answerID, loginUserID string) (*schema.AnswerInfo, *schema.QuestionInfo, bool, error)

func (*AnswerService) Insert

func (as *AnswerService) Insert(ctx context.Context, req *schema.AnswerAddReq) (string, error)

func (*AnswerService) RecoverAnswer

func (as *AnswerService) RecoverAnswer(ctx context.Context, req *schema.RecoverAnswerReq) (err error)

RecoverAnswer recover deleted answer

func (*AnswerService) RemoveAnswer

func (as *AnswerService) RemoveAnswer(ctx context.Context, req *schema.RemoveAnswerReq) (err error)

RemoveAnswer delete answer

func (*AnswerService) SearchFormatInfo

func (as *AnswerService) SearchFormatInfo(ctx context.Context, answers []*entity.Answer, req *schema.AnswerListReq) (
	[]*schema.AnswerInfo, error)

func (*AnswerService) SearchList

func (as *AnswerService) SearchList(ctx context.Context, req *schema.AnswerListReq) ([]*schema.AnswerInfo, int64, error)

func (*AnswerService) ShowFormat

func (as *AnswerService) ShowFormat(ctx context.Context, data *entity.Answer) *schema.AnswerInfo

func (*AnswerService) Update

func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReq) (string, error)

type CollectionGroupRepo

type CollectionGroupRepo interface {
	AddCollectionGroup(ctx context.Context, collectionGroup *entity.CollectionGroup) (err error)
	AddCollectionDefaultGroup(ctx context.Context, userID string) (collectionGroup *entity.CollectionGroup, err error)
	UpdateCollectionGroup(ctx context.Context, collectionGroup *entity.CollectionGroup, cols []string) (err error)
	GetCollectionGroup(ctx context.Context, id string) (collectionGroup *entity.CollectionGroup, exist bool, err error)
	GetCollectionGroupPage(ctx context.Context, page, pageSize int, collectionGroup *entity.CollectionGroup) (collectionGroupList []*entity.CollectionGroup, total int64, err error)
	GetDefaultID(ctx context.Context, userID string) (collectionGroup *entity.CollectionGroup, has bool, err error)
}

CollectionGroupRepo collectionGroup repository

type CollectionGroupService

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

CollectionGroupService user service

func NewCollectionGroupService

func NewCollectionGroupService(collectionGroupRepo CollectionGroupRepo) *CollectionGroupService

func (*CollectionGroupService) AddCollectionGroup

func (cs *CollectionGroupService) AddCollectionGroup(ctx context.Context, req *schema.AddCollectionGroupReq) (err error)

AddCollectionGroup add collection group

func (*CollectionGroupService) GetCollectionGroup

func (cs *CollectionGroupService) GetCollectionGroup(ctx context.Context, id string) (resp *schema.GetCollectionGroupResp, err error)

GetCollectionGroup get collection group one

func (*CollectionGroupService) UpdateCollectionGroup

func (cs *CollectionGroupService) UpdateCollectionGroup(ctx context.Context, req *schema.UpdateCollectionGroupReq, cols []string) (err error)

UpdateCollectionGroup update collection group

type CollectionService

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

CollectionService user service

func NewCollectionService

func NewCollectionService(
	collectionRepo collectioncommon.CollectionRepo,
	collectionGroupRepo CollectionGroupRepo,
	questionCommon *questioncommon.QuestionCommon,
) *CollectionService

func (*CollectionService) CollectionSwitch

func (cs *CollectionService) CollectionSwitch(ctx context.Context, dto *schema.CollectionSwitchDTO) (resp *schema.CollectionSwitchResp, err error)

type QuestionService

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

QuestionService user service

func NewQuestionService

func NewQuestionService(
	questionRepo questioncommon.QuestionRepo,
	tagCommon *tagcommon.TagCommonService,
	questioncommon *questioncommon.QuestionCommon,
	userCommon *usercommon.UserCommon,
	userRepo usercommon.UserRepo,
	revisionService *revision_common.RevisionService,
	metaService *meta.MetaService,
	collectionCommon *collectioncommon.CollectionCommon,
	answerActivityService *activity.AnswerActivityService,
	emailService *export.EmailService,
	notificationQueueService notice_queue.NotificationQueueService,
	externalNotificationQueueService notice_queue.ExternalNotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
	siteInfoService siteinfo_common.SiteInfoCommonService,
	newQuestionNotificationService *notification.ExternalNotificationService,
) *QuestionService

func (*QuestionService) AddQuestion

func (qs *QuestionService) AddQuestion(ctx context.Context, req *schema.QuestionAdd) (questionInfo any, err error)

AddQuestion add question

func (*QuestionService) AddQuestionCheckTags

func (qs *QuestionService) AddQuestionCheckTags(ctx context.Context, Tags []*entity.Tag) ([]string, error)

func (*QuestionService) AdminAnswerPage

func (qs *QuestionService) AdminAnswerPage(ctx context.Context, req *schema.AdminAnswerPageReq) (
	resp *pager.PageModel, err error)

AdminAnswerPage search answer list

func (*QuestionService) AdminQuestionPage

func (qs *QuestionService) AdminQuestionPage(
	ctx context.Context, req *schema.AdminQuestionPageReq) (
	resp *pager.PageModel, err error)

func (*QuestionService) AdminSetQuestionStatus

func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, req *schema.AdminUpdateQuestionStatusReq) error

func (*QuestionService) ChangeTag

func (qs *QuestionService) ChangeTag(ctx context.Context, objectTagData *schema.TagChange) error

func (*QuestionService) CheckAddQuestion

func (qs *QuestionService) CheckAddQuestion(ctx context.Context, req *schema.QuestionAdd) (errorlist any, err error)

func (*QuestionService) CheckChangeReservedTag

func (qs *QuestionService) CheckChangeReservedTag(ctx context.Context, oldobjectTagData, objectTagData []*entity.Tag) (bool, bool, []string, []string)

func (*QuestionService) CloseQuestion

func (qs *QuestionService) CloseQuestion(ctx context.Context, req *schema.CloseQuestionReq) error

func (*QuestionService) GetQuestion

func (qs *QuestionService) GetQuestion(ctx context.Context, questionID, userID string,
	per schema.QuestionPermission) (resp *schema.QuestionInfo, err error)

GetQuestion get question one

func (*QuestionService) GetQuestionAndAddPV

func (qs *QuestionService) GetQuestionAndAddPV(ctx context.Context, questionID, loginUserID string,
	per schema.QuestionPermission) (
	resp *schema.QuestionInfo, err error)

GetQuestionAndAddPV get question one

func (*QuestionService) GetQuestionPage

func (qs *QuestionService) GetQuestionPage(ctx context.Context, req *schema.QuestionPageReq) (
	questions []*schema.QuestionPageResp, total int64, err error)

GetQuestionPage query questions page

func (*QuestionService) GetQuestionsByTitle

func (qs *QuestionService) GetQuestionsByTitle(ctx context.Context, title string) (
	resp []*schema.QuestionBaseInfo, err error)

GetQuestionsByTitle get questions by title

func (*QuestionService) HasNewTag

func (qs *QuestionService) HasNewTag(ctx context.Context, tags []*schema.TagItem) (bool, error)

HasNewTag

func (*QuestionService) InviteUserInfo

func (qs *QuestionService) InviteUserInfo(ctx context.Context, questionID string) (inviteList []*schema.UserBasicInfo, err error)

func (*QuestionService) OperationQuestion

func (qs *QuestionService) OperationQuestion(ctx context.Context, req *schema.OperationQuestionReq) (err error)

OperationQuestion

func (*QuestionService) PersonalAnswerPage

func (qs *QuestionService) PersonalAnswerPage(ctx context.Context, req *schema.PersonalAnswerPageReq) (
	pageModel *pager.PageModel, err error)

func (*QuestionService) PersonalCollectionPage

func (qs *QuestionService) PersonalCollectionPage(ctx context.Context, req *schema.PersonalCollectionPageReq) (
	pageModel *pager.PageModel, err error)

PersonalCollectionPage get collection list by user

func (*QuestionService) PersonalQuestionPage

func (qs *QuestionService) PersonalQuestionPage(ctx context.Context, req *schema.PersonalQuestionPageReq) (
	pageModel *pager.PageModel, err error)

PersonalQuestionPage get question list by user

func (*QuestionService) RecoverQuestion

func (qs *QuestionService) RecoverQuestion(ctx context.Context, req *schema.QuestionRecoverReq) (err error)

func (*QuestionService) RemoveQuestion

func (qs *QuestionService) RemoveQuestion(ctx context.Context, req *schema.RemoveQuestionReq) (err error)

RemoveQuestion delete question

func (*QuestionService) ReopenQuestion

func (qs *QuestionService) ReopenQuestion(ctx context.Context, req *schema.ReopenQuestionReq) error

ReopenQuestion reopen question

func (*QuestionService) SearchUserTopList

func (qs *QuestionService) SearchUserTopList(ctx context.Context, userName string, loginUserID string) ([]*schema.UserQuestionInfo, []*schema.UserAnswerInfo, error)

func (*QuestionService) SimilarQuestion

func (qs *QuestionService) SimilarQuestion(ctx context.Context, questionID string, loginUserID string) ([]*schema.QuestionPageResp, int64, error)

SimilarQuestion

func (*QuestionService) SitemapCron

func (qs *QuestionService) SitemapCron(ctx context.Context)

func (*QuestionService) UpdateQuestion

func (qs *QuestionService) UpdateQuestion(ctx context.Context, req *schema.QuestionUpdate) (questionInfo any, err error)

UpdateQuestion update question

func (*QuestionService) UpdateQuestionCheckTags

func (qs *QuestionService) UpdateQuestionCheckTags(ctx context.Context, req *schema.QuestionUpdate) (errorlist []*validator.FormErrorField, err error)

func (*QuestionService) UpdateQuestionInviteUser

func (qs *QuestionService) UpdateQuestionInviteUser(ctx context.Context, req *schema.QuestionUpdateInviteUser) (err error)

type RevisionService

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

RevisionService user service

func NewRevisionService

func NewRevisionService(
	revisionRepo revision.RevisionRepo,
	userCommon *usercommon.UserCommon,
	questionCommon *questioncommon.QuestionCommon,
	answerService *AnswerService,
	objectInfoService *object_info.ObjService,
	questionRepo questioncommon.QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	tagRepo tag_common.TagRepo,
	tagCommon *tagcommon.TagCommonService,
	notificationQueueService notice_queue.NotificationQueueService,
	activityQueueService activity_queue.ActivityQueueService,
) *RevisionService

func (*RevisionService) CheckCanUpdateRevision

func (rs *RevisionService) CheckCanUpdateRevision(ctx context.Context, req *schema.CheckCanQuestionUpdate) (
	resp *schema.ErrTypeData, err error)

CheckCanUpdateRevision can check revision

func (*RevisionService) GetRevisionList

func (rs *RevisionService) GetRevisionList(ctx context.Context, req *schema.GetRevisionListReq) (resp []schema.GetRevisionResp, err error)

GetRevisionList get revision list all

func (*RevisionService) GetUnreviewedRevisionPage

func (rs *RevisionService) GetUnreviewedRevisionPage(ctx context.Context, req *schema.RevisionSearch) (
	resp *pager.PageModel, err error)

GetUnreviewedRevisionPage get unreviewed list

func (*RevisionService) RevisionAudit

func (rs *RevisionService) RevisionAudit(ctx context.Context, req *schema.RevisionAuditReq) (err error)

type SearchService

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

func NewSearchService

func NewSearchService(
	searchParser *search_parser.SearchParser,
	searchRepo search_common.SearchRepo,
) *SearchService

func (*SearchService) Search

func (ss *SearchService) Search(ctx context.Context, dto *schema.SearchDTO) (resp *schema.SearchResp, err error)

Search search contents

type UserService

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

UserService user service

func NewUserService

func NewUserService(userRepo usercommon.UserRepo,
	userActivity activity.UserActiveActivityRepo,
	activityRepo activity_common.ActivityRepo,
	emailService *export.EmailService,
	authService *auth.AuthService,
	siteInfoService siteinfo_common.SiteInfoCommonService,
	userRoleService *role.UserRoleRelService,
	userCommonService *usercommon.UserCommon,
	userExternalLoginService *user_external_login.UserExternalLoginService,
	userNotificationConfigRepo user_notification_config.UserNotificationConfigRepo,
	userNotificationConfigService *user_notification_config.UserNotificationConfigService,
) *UserService

func (*UserService) EmailLogin

func (us *UserService) EmailLogin(ctx context.Context, req *schema.UserEmailLoginReq) (resp *schema.UserLoginResp, err error)

EmailLogin email login

func (*UserService) GetOtherUserInfoByUsername

func (us *UserService) GetOtherUserInfoByUsername(ctx context.Context, username string) (
	resp *schema.GetOtherUserInfoByUsernameResp, err error)

func (*UserService) GetUserInfoByUserID

func (us *UserService) GetUserInfoByUserID(ctx context.Context, token, userID string) (
	resp *schema.GetCurrentLoginUserInfoResp, err error)

GetUserInfoByUserID get user info by user id

func (*UserService) RetrievePassWord

func (us *UserService) RetrievePassWord(ctx context.Context, req *schema.UserRetrievePassWordRequest) error

RetrievePassWord .

func (*UserService) SearchUserListByName

func (us *UserService) SearchUserListByName(ctx context.Context, req *schema.GetOtherUserInfoByUsernameReq) (
	resp []*schema.UserBasicInfo, err error)

func (*UserService) UpdateInfo

func (us *UserService) UpdateInfo(ctx context.Context, req *schema.UpdateInfoRequest) (
	errFields []*validator.FormErrorField, err error)

UpdateInfo update user info

func (*UserService) UpdatePasswordWhenForgot

func (us *UserService) UpdatePasswordWhenForgot(ctx context.Context, req *schema.UserRePassWordRequest) (err error)

UpdatePasswordWhenForgot update user password when user forgot password

func (*UserService) UserChangeEmailSendCode

func (us *UserService) UserChangeEmailSendCode(ctx context.Context, req *schema.UserChangeEmailSendCodeReq) (
	resp []*validator.FormErrorField, err error)

UserChangeEmailSendCode user change email verification

func (*UserService) UserChangeEmailVerify

func (us *UserService) UserChangeEmailVerify(ctx context.Context, content string) (resp *schema.UserLoginResp, err error)

UserChangeEmailVerify user change email verify code

func (*UserService) UserModifyPassWordVerification

func (us *UserService) UserModifyPassWordVerification(ctx context.Context, req *schema.UserModifyPasswordReq) (bool, error)

func (*UserService) UserModifyPassword

func (us *UserService) UserModifyPassword(ctx context.Context, req *schema.UserModifyPasswordReq) error

UserModifyPassword user modify password

func (*UserService) UserRanking

func (us *UserService) UserRanking(ctx context.Context) (resp *schema.UserRankingResp, err error)

UserRanking get user ranking

func (*UserService) UserRegisterByEmail

func (us *UserService) UserRegisterByEmail(ctx context.Context, registerUserInfo *schema.UserRegisterReq) (
	resp *schema.UserLoginResp, errFields []*validator.FormErrorField, err error,
)

UserRegisterByEmail user register

func (*UserService) UserUnsubscribeNotification

func (us *UserService) UserUnsubscribeNotification(
	ctx context.Context, req *schema.UserUnsubscribeNotificationReq) (err error)

UserUnsubscribeNotification user unsubscribe email notification

func (*UserService) UserUpdateInterface

func (us *UserService) UserUpdateInterface(ctx context.Context, req *schema.UpdateUserInterfaceRequest) (err error)

UserUpdateInterface update user interface

func (*UserService) UserVerifyEmail

func (us *UserService) UserVerifyEmail(ctx context.Context, req *schema.UserVerifyEmailReq) (resp *schema.UserLoginResp, err error)

func (*UserService) UserVerifyEmailSend

func (us *UserService) UserVerifyEmailSend(ctx context.Context, userID string) error

type VoteRepo

type VoteRepo interface {
	Vote(ctx context.Context, op *schema.VoteOperationInfo) (err error)
	CancelVote(ctx context.Context, op *schema.VoteOperationInfo) (err error)
	GetAndSaveVoteResult(ctx context.Context, objectID, objectType string) (up, down int64, err error)
	ListUserVotes(ctx context.Context, userID string, page int, pageSize int, activityTypes []int) (
		voteList []*entity.Activity, total int64, err error)
}

VoteRepo activity repository

type VoteService

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

VoteService user service

func NewVoteService

func NewVoteService(
	voteRepo VoteRepo,
	configService *config.ConfigService,
	questionRepo questioncommon.QuestionRepo,
	answerRepo answercommon.AnswerRepo,
	commentCommonRepo comment_common.CommentCommonRepo,
	objectService *object_info.ObjService,
) *VoteService

func (*VoteService) ListUserVotes

func (vs *VoteService) ListUserVotes(ctx context.Context, req schema.GetVoteWithPageReq) (resp *pager.PageModel, err error)

ListUserVotes list user's votes

func (*VoteService) VoteDown

func (vs *VoteService) VoteDown(ctx context.Context, req *schema.VoteReq) (resp *schema.VoteResp, err error)

VoteDown vote down

func (*VoteService) VoteUp

func (vs *VoteService) VoteUp(ctx context.Context, req *schema.VoteReq) (resp *schema.VoteResp, err error)

VoteUp vote up

Jump to

Keyboard shortcuts

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