diff --git a/README.md b/README.md index b167bb3..a519e3b 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,14 @@ - [x] 分类新增、编辑、删除 - [x] 书签新增、编辑、删除 - [x] 书签搜索 +- [x] 书签tag 过滤 +- [x] 首页显示最近访问,常用书签 - [x] html 书签导入 ### notes 笔记 -- [x] note新增、编辑 - - [ ] 删除 +- [x] note 新增、编辑、删除 + - [x] 历史版本 (暂只存在数据库中) - [x] note tag 过滤 +- [x] markdown 编辑 ## 截图 ## bookmark diff --git a/app/access.go b/app/access.go index 15e3c13..b9773f7 100644 --- a/app/access.go +++ b/app/access.go @@ -144,6 +144,10 @@ func AccessCondition(ctx context.Context, req config.ConditionReq, where *config } } + case "Config": + where.Add("for_id", user.UserId) + where.Add("for", "user") + case TableGroups: if req.Method == http.MethodGet { where.AddRaw("group_id in (select group_id from group_user where user_id = ? )", []string{user.UserId}) diff --git a/app/hook.go b/app/hook.go index 779e5aa..091f873 100644 --- a/app/hook.go +++ b/app/hook.go @@ -47,6 +47,38 @@ func initHook(a *apijson.ApiJson) { }, }) + a.RegActionHook(action.Hook{ + For: []string{"Config"}, + HandlerInTransaction: func(ctx context.Context, req *action.HookReq) error { + user, _ := ctx.Value(UserIdKey).(*CurrentUser) + + for i, _ := range req.Node.Data { + + key := req.Node.Data[i]["key"] + + one, err := g.Model("config").Ctx(ctx).One(g.Map{ + "for_id": user.UserId, + "key": key, + "for": "user", + }) + if err != nil { + return err + } + + if one.IsEmpty() { + g.Model("config").Ctx(ctx).Insert(g.Map{ + "for": "user", + "for_id": user.UserId, + "key": key, + }) + } + } + + err := req.Next() + return err + }, + }) + a.RegActionHook(action.Hook{ For: []string{"*"}, Handler: nil, diff --git a/app/inits/_access.json b/app/inits/_access.json index d13bcff..3fae361 100644 --- a/app/inits/_access.json +++ b/app/inits/_access.json @@ -217,7 +217,9 @@ "rowKey": "id", "fieldsGet": { "default": { - "in": {}, + "in": { + "key": ["="] + }, "out": { } diff --git a/ui/components.d.ts b/ui/components.d.ts index 6bdf8c7..6d4ed03 100644 --- a/ui/components.d.ts +++ b/ui/components.d.ts @@ -7,14 +7,6 @@ export {} declare module 'vue' { export interface GlobalComponents { - ABadge: typeof import('ant-design-vue/es')['Badge'] - ALayout: typeof import('ant-design-vue/es')['Layout'] - ALayoutContent: typeof import('ant-design-vue/es')['LayoutContent'] - ALayoutFooter: typeof import('ant-design-vue/es')['LayoutFooter'] - ALayoutSider: typeof import('ant-design-vue/es')['LayoutSider'] - AMenu: typeof import('ant-design-vue/es')['Menu'] - AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] - ASubMenu: typeof import('ant-design-vue/es')['SubMenu'] GroupPanel: typeof import('./src/components/GroupPanel/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView']