Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: feishu app setting (#3288)

p0ny8abeff761286
diff --git a/api/setting.go b/api/setting.go
index b50dd94c1e..b13f27b48a 100644
--- a/api/setting.go
+++ b/api/setting.go
@@ -18,8 +18,16 @@ const (
SettingEnterpriseLicense SettingName = "bb.enterprise.license"
// SettingEnterpriseTrial is the setting name for free trial.
SettingEnterpriseTrial SettingName = "bb.enterprise.trial"
+ // SettingAppIM is the setting name for IM applications.
+ SettingAppIM SettingName = "bb.app.im"
)
+// IMType is the type of IM.
+type IMType string
+
+// IMTypeFeishu is IM feishu.
+const IMTypeFeishu IMType = "im.feishu"
+
// Setting is the API message for a setting.
type Setting struct {
ID int `jsonapi:"primary,setting"`
@@ -68,3 +76,14 @@ func (find *SettingFind) String() string {
}
return string(str)
}
+
+// SettingAppIMValue is the setting value of SettingAppIM type setting.
+type SettingAppIMValue struct {
+ IMType string `json:"imType"`
+ AppID string `json:"appId"`
+ AppSecret string `json:"appSecret"`
+ ExternalApproval struct {
+ Enabled bool `json:"enabled"`
+ ApprovalCode string `json:"approvalCode"`
+ } `json:"externalApproval"`
+}
diff --git a/server/server.go b/server/server.go
index ffcb6c625a..9c63a25852 100644
--- a/server/server.go
+++ b/server/server.go
@@ -461,6 +461,16 @@ func getInitSetting(ctx context.Context, store *store.Store) (*config, error) {
return nil, err
}
+ // initial feishu app
+ if _, err := store.CreateSettingIfNotExist(ctx, &api.SettingCreate{
+ CreatorID: api.SystemBotID,
+ Name: api.SettingAppIM,
+ Value: "",
+ Description: "",
+ }); err != nil {
+ return nil, err
+ }
+
return conf, nil
}