biz

package
v0.0.0-...-d80f745 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnDoLike = 0 // 取消点赞
	DoLike   = 1 // 点赞
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Biz

type Biz struct {
	Note     NoteBiz
	Interact NoteInteractBiz
	Creator  NoteCreatorBiz
}

func New

func New() Biz

type NoteBiz

type NoteBiz interface {
	// 获取笔记基础信息
	GetNote(ctx context.Context, noteId uint64) (*model.Note, error)
	// 获取公开的笔记基础信息
	GetPublicNote(ctx context.Context, noteId uint64) (*model.Note, error)
	// 判断笔记是否存在
	IsNoteExist(ctx context.Context, noteId uint64) (bool, error)
	// 获取笔记作者
	GetNoteOwner(ctx context.Context, noteId uint64) (uint64, error)
	// 组装笔记信息,主要是填充asset
	AssembleNotes(ctx context.Context, notes []*model.Note) (*model.Notes, error)
}

NoteBiz作为最基础的biz可以被其它biz依赖,其它biz之间不能相互依赖

func NewNoteBiz

func NewNoteBiz() NoteBiz

type NoteCreatorBiz

type NoteCreatorBiz interface {
	// 创作者相关
	CreatorCreateNote(ctx context.Context, note *model.CreateNoteRequest) (uint64, error)
	CreatorUpdateNote(ctx context.Context, note *model.UpdateNoteRequest) error
	CreatorDeleteNote(ctx context.Context, note *model.DeleteNoteRequest) error
	CreatorGetNote(ctx context.Context, noteId uint64) (*model.Note, error)
	CreatorListNote(ctx context.Context) (*model.Notes, error)
	CreatorGetUploadAuth(ctx context.Context, req *model.UploadAuthRequest) (*model.UploadAuthResponse, error)
}

笔记相关

func NewNoteCreatorBiz

func NewNoteCreatorBiz() NoteCreatorBiz

type NoteInteractBiz

type NoteInteractBiz interface {
	// 点赞笔记
	LikeNote(ctx context.Context, uid, noteId uint64, operation int) error
	// 用户是否点赞笔记
	CheckUserLikeStatus(ctx context.Context, uid, noteId uint64) (bool, error)
	// 批量检查用户是否点赞笔记
	BatchCheckUserLikeStatus(ctx context.Context, uidNoteIds map[uint64][]uint64) (
		map[uint64][]*model.LikeStatus, error)
	// 获取笔记点赞信息并填充
	AssignNoteLikes(ctx context.Context, batch *model.Notes) (*model.Notes, error)
	// 获取笔记点赞数量
	GetNoteLikes(ctx context.Context, noteId uint64) (uint64, error)
	// 获取笔记评论数量
	GetNoteReplyCount(ctx context.Context, noteId uint64) (uint64, error)
	// 获取笔记的评论信息并填充
	AssignNoteReplies(ctx context.Context, batch *model.Notes) (*model.Notes, error)
}

笔记互动

func NewNoteInteractBiz

func NewNoteInteractBiz() NoteInteractBiz

Jump to

Keyboard shortcuts

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