From 7ac1e4285660c85004c81ecb1f7d88867874e81c Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Sun, 19 Dec 2021 21:49:30 +0800 Subject: [PATCH] add hook --- auth/api_grp.go | 4 ++++ auth/group.go | 1 + 2 files changed, 5 insertions(+) diff --git a/auth/api_grp.go b/auth/api_grp.go index ea82b11..c209cc0 100644 --- a/auth/api_grp.go +++ b/auth/api_grp.go @@ -28,6 +28,7 @@ type apiGrpNewReq struct { Name string `json:"name" example:"user" binding:"required"` DisplayName string `json:"display_name"` Description string `json:"description"` + Listeners string GRPF1 string } @@ -44,6 +45,7 @@ func ApiGrpNew(c *gin.Context) { Name: data.Name, Description: data.Description, DisplayName: data.DisplayName, + Listeners: data.Listeners, GRPF1: data.GRPF1, } if err := DB.Create(grp).Error; err != nil { @@ -61,6 +63,7 @@ type apiGrpUpdateReq struct { Name string `json:"name" binding:"required"` DisplayName string `json:"display_name"` Description string `json:"description"` + Listeners string GRPF1 string } @@ -85,6 +88,7 @@ func ApiGrpUpdate(c *gin.Context) { "name": data.Name, "display_name": data.DisplayName, "description": data.Description, + "listeners": data.Listeners, "grpf1": data.GRPF1, }) if result.Error != nil { diff --git a/auth/group.go b/auth/group.go index 7c25fa3..4bc27e0 100644 --- a/auth/group.go +++ b/auth/group.go @@ -15,6 +15,7 @@ type Group struct { Name string `gorm:"unique;not null"` DisplayName string Description string + Listeners string Users []*User `gorm:"many2many:user_groups;"` //extra fields