Skip to content

Commit

Permalink
## 0.12.0: bm tag + note search
Browse files Browse the repository at this point in the history
  • Loading branch information
glennliao committed Aug 19, 2023
1 parent f211e34 commit 7706193
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 11 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
- [x] 分类新增、编辑、删除
- [x] 书签新增、编辑、删除
- [x] 书签搜索
- [x] 书签tag 过滤
- [x] 首页显示最近访问,常用书签
- [x] html 书签导入
### notes 笔记
- [x] note新增、编辑
- [ ] 删除
- [x] note 新增、编辑、删除
- [x] 历史版本 (暂只存在数据库中)
- [x] note tag 过滤
- [x] markdown 编辑

## 截图
## bookmark
Expand Down
4 changes: 4 additions & 0 deletions app/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
32 changes: 32 additions & 0 deletions app/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion app/inits/_access.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@
"rowKey": "id",
"fieldsGet": {
"default": {
"in": {},
"in": {
"key": ["="]
},
"out": {

}
Expand Down
8 changes: 0 additions & 8 deletions ui/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 7706193

Please sign in to comment.