Commit 423eca6e by Anthony Woods

add support for fetching appSettings by appId

parent fd523204
package models
import "time"
import (
"errors"
"time"
)
var (
ErrAppSettingNotFound = errors.New("AppSetting not found")
)
type AppSettings struct {
Id int64
......@@ -33,3 +40,9 @@ type GetAppSettingsQuery struct {
OrgId int64
Result []*AppSettings
}
type GetAppSettingByAppIdQuery struct {
AppId string
OrgId int64
Result *AppSettings
}
......@@ -9,6 +9,7 @@ import (
func init() {
bus.AddHandler("sql", GetAppSettings)
bus.AddHandler("sql", GetAppSettingByAppId)
bus.AddHandler("sql", UpdateAppSettings)
}
......@@ -19,6 +20,18 @@ func GetAppSettings(query *m.GetAppSettingsQuery) error {
return sess.Find(&query.Result)
}
func GetAppSettingByAppId(query *m.GetAppSettingByAppIdQuery) error {
appSetting := m.AppSettings{OrgId: query.OrgId, AppId: query.AppId}
has, err := x.Get(&appSetting)
if err != nil {
return err
} else if has == false {
return m.ErrAppSettingNotFound
}
query.Result = &appSetting
return nil
}
func UpdateAppSettings(cmd *m.UpdateAppSettingsCmd) error {
return inTransaction2(func(sess *session) error {
var app m.AppSettings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment