feat(plugins): WIP on new apps concept

This commit is contained in:
Torkel Ödegaard
2015-12-21 23:09:27 +01:00
parent 0903d5541b
commit eacc46da6d
10 changed files with 141 additions and 146 deletions
+10 -9
View File
@@ -25,23 +25,24 @@ func UpdateAppPlugin(cmd *m.UpdateAppPluginCmd) error {
exists, err := sess.Where("org_id=? and type=?", cmd.OrgId, cmd.Type).Get(&app)
sess.UseBool("enabled")
sess.UseBool("pin_nav_links")
sess.UseBool("pinned")
if !exists {
app = m.AppPlugin{
Type: cmd.Type,
OrgId: cmd.OrgId,
Enabled: cmd.Enabled,
PinNavLinks: cmd.PinNavLinks,
JsonData: cmd.JsonData,
Created: time.Now(),
Updated: time.Now(),
Type: cmd.Type,
OrgId: cmd.OrgId,
Enabled: cmd.Enabled,
Pinned: cmd.Pinned,
JsonData: cmd.JsonData,
Created: time.Now(),
Updated: time.Now(),
}
_, err = sess.Insert(&app)
return err
} else {
app.Updated = time.Now()
app.Enabled = cmd.Enabled
app.JsonData = cmd.JsonData
app.PinNavLinks = cmd.PinNavLinks
app.Pinned = cmd.Pinned
_, err = sess.Id(app.Id).Update(&app)
return err
}
@@ -11,7 +11,7 @@ func addAppPluginMigration(mg *Migrator) {
{Name: "org_id", Type: DB_BigInt, Nullable: true},
{Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "enabled", Type: DB_Bool, Nullable: false},
{Name: "pin_nav_links", Type: DB_Bool, Nullable: false},
{Name: "pinned", Type: DB_Bool, Nullable: false},
{Name: "json_data", Type: DB_Text, Nullable: true},
{Name: "created", Type: DB_DateTime, Nullable: false},
{Name: "updated", Type: DB_DateTime, Nullable: false},