category

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDefaultCategory

func EnsureDefaultCategory(ctx *config.Context, uid, spaceID string) error

EnsureDefaultCategory 为 (uid, spaceID) 组合幂等地确保默认分类存在。

背景(GH octo-server#1228):Phase 1 遗漏 — 创建 space / 加入 space 时未自动创建默认 分类,导致新建空间 GET /v1/spaces/{id}/categories 返回 [],前端无法渲染会话列表。

并发安全:依赖表 group_category 上的唯一索引 uk_uid_space_is_default,insertDefaultCategory 使用 INSERT IGNORE,多次调用 / 并发调用均安全。

调用方应将其视为非关键路径(catch error 后以 warn 记录、不中断业务),list 端还有 兜底补偿;因此本函数不包装 transaction,直接调用 db 层。

func EnsureProjectSidebarSection added in v1.19.0

func EnsureProjectSidebarSection(ctx *config.Context, uid, spaceID, projectID string) error

EnsureProjectSidebarSection is the best-effort hook registered into modules/project. It only creates a personal ordering entry; the sidebar read predicate remains the authority for visibility and requires an active Project seat. A pin hook must not be used to widen that authorization boundary.

func HideProjectSidebarSection added in v1.19.0

func HideProjectSidebarSection(ctx *config.Context, uid, spaceID, projectID string) error

HideProjectSidebarSection records an explicit unpin without deleting the ordering row. Re-pinning can therefore restore the Project at its previous position, while status=2 keeps it out of the shared section order.

Types

type Category

type Category struct {
	log.Log
	// contains filtered or unexported fields
}

Category 群组类别 API

func New

func New(ctx *config.Context) *Category

New 创建 Category 实例

func (*Category) Route

func (c *Category) Route(r *wkhttp.WKHttp)

Route 路由配置

type CategoryModel

type CategoryModel struct {
	CategoryID string
	SpaceID    string
	UID        string
	Name       string
	Sort       int
	Status     int
	IsDefault  *int
	db.BaseModel
}

CategoryModel 群组类别(用户个人视图)

type SidebarSectionModel added in v1.19.0

type SidebarSectionModel struct {
	ID          int64
	UID         string
	SpaceID     string
	SectionType int
	RefID       string
	Sort        int
	Status      int
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

SidebarSectionModel is the single per-user order for category and Project entries in one Space. The timestamps deliberately stay application-written UTC values; see the migration for why MySQL timestamp defaults are forbidden here.

Jump to

Keyboard shortcuts

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