chore(badge): delete not used func
This commit is contained in:
@@ -62,36 +62,6 @@ func (r *badgeRepo) GetByIDs(ctx context.Context, ids []string) (badges []*entit
|
||||
return
|
||||
}
|
||||
|
||||
// ListByLevel returns a list of badges by level
|
||||
func (r *badgeRepo) ListByLevel(ctx context.Context, level entity.BadgeLevel) (badges []*entity.Badge, err error) {
|
||||
badges = make([]*entity.Badge, 0)
|
||||
err = r.data.DB.Context(ctx).Where("level = ?", level).Find(&badges)
|
||||
if err != nil {
|
||||
err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByGroup returns a list of badges by group
|
||||
func (r *badgeRepo) ListByGroup(ctx context.Context, groupID int64) (badges []*entity.Badge, err error) {
|
||||
badges = make([]*entity.Badge, 0)
|
||||
err = r.data.DB.Context(ctx).Where("group_id = ?", groupID).Find(&badges)
|
||||
if err != nil {
|
||||
err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByLevelAndGroup returns a list of badges by level and group
|
||||
func (r *badgeRepo) ListByLevelAndGroup(ctx context.Context, level entity.BadgeLevel, groupID int64) (badges []*entity.Badge, err error) {
|
||||
badges = make([]*entity.Badge, 0)
|
||||
err = r.data.DB.Context(ctx).Where("level = ? AND group_id = ?", level, groupID).Find(&badges)
|
||||
if err != nil {
|
||||
err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ListPaged returns a list of activated badges
|
||||
func (r *badgeRepo) ListPaged(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error) {
|
||||
badges = make([]*entity.Badge, 0)
|
||||
@@ -146,12 +116,6 @@ func (r *badgeRepo) ListInactivated(ctx context.Context, page int, pageSize int)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateAwardCount updates the award count of a badge
|
||||
func (r *badgeRepo) UpdateAwardCount(ctx context.Context, id string, count int64) (err error) {
|
||||
_, err = r.data.DB.Context(ctx).Where("id = ?", id).Incr("award_count", count).Update(&entity.Badge{})
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus updates the award count of a badge
|
||||
func (r *badgeRepo) UpdateStatus(ctx context.Context, id string, status int8) (err error) {
|
||||
_, err = r.data.DB.Transaction(func(session *xorm.Session) (result any, err error) {
|
||||
|
||||
@@ -100,12 +100,6 @@ func (r *badgeAwardRepo) CheckIsAward(ctx context.Context, badgeID, userID, awar
|
||||
return isAward, err
|
||||
}
|
||||
|
||||
func (r *badgeAwardRepo) CountByUserIdAndBadgeLevel(ctx context.Context, userID string, badgeLevel entity.BadgeLevel) (awardCount int64) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) CountByUserId(ctx context.Context, userID string) (awardCount int64) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) CountByUserIdAndBadgeId(ctx context.Context, userID string, badgeID string) (awardCount int64) {
|
||||
awardCount, err := r.data.DB.Context(ctx).Where("user_id = ? AND badge_id = ?", userID, badgeID).Count(&entity.BadgeAward{})
|
||||
if err != nil {
|
||||
@@ -113,22 +107,11 @@ func (r *badgeAwardRepo) CountByUserIdAndBadgeId(ctx context.Context, userID str
|
||||
}
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) CountByObjectId(ctx context.Context, awardKey string) (awardCount int64) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) CountByObjectIdAndBadgeId(ctx context.Context, awardKey string, badgeID string) (awardCount int64) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) CountBadgesByUserIdAndObjectId(ctx context.Context, userID string, awardKey string, badgeID string) (awardCount int64) {
|
||||
return
|
||||
}
|
||||
|
||||
func (r *badgeAwardRepo) SumUserEarnedGroupByBadgeID(ctx context.Context, userID string) (earnedCounts []*entity.BadgeEarnedCount, err error) {
|
||||
err = r.data.DB.Context(ctx).Select("badge_id, count(`id`) AS earned_count").Where("user_id = ?", userID).GroupBy("badge_id").Find(&earnedCounts)
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListAllByUserId(ctx context.Context, userID string) (badgeAwards []*entity.BadgeAward) {
|
||||
return
|
||||
}
|
||||
|
||||
// ListPagedByBadgeId list badge awards by badge id
|
||||
func (r *badgeAwardRepo) ListPagedByBadgeId(ctx context.Context, badgeID string, page int, pageSize int) (badgeAwardList []*entity.BadgeAward, total int64, err error) {
|
||||
@@ -151,21 +134,6 @@ func (r *badgeAwardRepo) ListPagedByBadgeIdAndUserId(ctx context.Context, badgeI
|
||||
}
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListPagedByObjectId(ctx context.Context, badgeID string, awardKey string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListPagedByObjectIdAndUserId(ctx context.Context, badgeID string, awardKey string, userID string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListTagPagedByBadgeId(ctx context.Context, badgeIDs []string, page int, pageSize int, filterUserID string) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListTagPagedByBadgeIdAndUserId(ctx context.Context, badgeIDs []string, userID string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListPagedLatest(ctx context.Context, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// ListNewestEarned list newest earned badge awards
|
||||
func (r *badgeAwardRepo) ListNewestEarned(ctx context.Context, userID string, limit int) (badgeAwards []*entity.BadgeAwardRecent, err error) {
|
||||
@@ -179,13 +147,6 @@ func (r *badgeAwardRepo) ListNewestEarned(ctx context.Context, userID string, li
|
||||
return
|
||||
}
|
||||
|
||||
func (r *badgeAwardRepo) ListNewestEarnedByLevel(ctx context.Context, userID string, level entity.BadgeLevel, num int) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
func (r *badgeAwardRepo) ListNewestByUserIdAndLevel(ctx context.Context, userID string, level int, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetByUserIdAndBadgeId get badge award by user id and badge id
|
||||
func (r *badgeAwardRepo) GetByUserIdAndBadgeId(ctx context.Context, userID string, badgeID string) (
|
||||
badgeAward *entity.BadgeAward, exists bool, err error) {
|
||||
|
||||
@@ -41,26 +41,13 @@ type BadgeAwardRepo interface {
|
||||
CheckIsAward(ctx context.Context, badgeID string, userID string, awardKey string, singleOrMulti int8) (isAward bool, err error)
|
||||
AwardBadgeForUser(ctx context.Context, badgeAward *entity.BadgeAward) (err error)
|
||||
|
||||
CountByUserIdAndBadgeLevel(ctx context.Context, userID string, badgeLevel entity.BadgeLevel) (awardCount int64)
|
||||
CountByUserId(ctx context.Context, userID string) (awardCount int64)
|
||||
CountByUserIdAndBadgeId(ctx context.Context, userID string, badgeID string) (awardCount int64)
|
||||
CountByObjectId(ctx context.Context, awardKey string) (awardCount int64)
|
||||
CountByObjectIdAndBadgeId(ctx context.Context, awardKey string, badgeID string) (awardCount int64)
|
||||
CountBadgesByUserIdAndObjectId(ctx context.Context, userID string, awardKey string, badgeID string) (awardCount int64)
|
||||
|
||||
SumUserEarnedGroupByBadgeID(ctx context.Context, userID string) (earnedCounts []*entity.BadgeEarnedCount, err error)
|
||||
|
||||
ListAllByUserId(ctx context.Context, userID string) (badgeAwards []*entity.BadgeAward)
|
||||
ListPagedByBadgeId(ctx context.Context, badgeID string, page int, pageSize int) (badgeAwardList []*entity.BadgeAward, total int64, err error)
|
||||
ListPagedByBadgeIdAndUserId(ctx context.Context, badgeID string, userID string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListPagedByObjectId(ctx context.Context, badgeID string, awardKey string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListPagedByObjectIdAndUserId(ctx context.Context, badgeID string, awardKey string, userID string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListTagPagedByBadgeId(ctx context.Context, badgeIDs []string, page int, pageSize int, filterUserID string) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListTagPagedByBadgeIdAndUserId(ctx context.Context, badgeIDs []string, userID string, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListPagedLatest(ctx context.Context, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListNewestEarned(ctx context.Context, userID string, limit int) (badgeAwards []*entity.BadgeAwardRecent, err error)
|
||||
ListNewestEarnedByLevel(ctx context.Context, userID string, level entity.BadgeLevel, num int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
ListNewestByUserIdAndLevel(ctx context.Context, userID string, level int, page int, pageSize int) (badgeAwards []*entity.BadgeAward, total int64, err error)
|
||||
|
||||
GetByUserIdAndBadgeId(ctx context.Context, userID string, badgeID string) (badgeAward *entity.BadgeAward, exists bool, err error)
|
||||
GetByUserIdAndBadgeIdAndAwardKey(ctx context.Context, userID string, badgeID string, awardKey string) (badgeAward *entity.BadgeAward, exists bool, err error)
|
||||
|
||||
@@ -37,14 +37,10 @@ type BadgeRepo interface {
|
||||
GetByID(ctx context.Context, id string) (badge *entity.Badge, exists bool, err error)
|
||||
GetByIDs(ctx context.Context, ids []string) (badges []*entity.Badge, err error)
|
||||
|
||||
ListByLevel(ctx context.Context, level entity.BadgeLevel) ([]*entity.Badge, error)
|
||||
ListByGroup(ctx context.Context, groupID int64) ([]*entity.Badge, error)
|
||||
ListByLevelAndGroup(ctx context.Context, level entity.BadgeLevel, groupID int64) ([]*entity.Badge, error)
|
||||
ListPaged(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error)
|
||||
ListActivated(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error)
|
||||
ListInactivated(ctx context.Context, page int, pageSize int) (badges []*entity.Badge, total int64, err error)
|
||||
|
||||
UpdateAwardCount(ctx context.Context, id string, count int64) (err error)
|
||||
UpdateStatus(ctx context.Context, id string, status int8) (err error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user