mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
[REV] update plugin delete api
This commit is contained in:
parent
93027efb09
commit
305c5eb92f
@ -96,7 +96,20 @@ func (p *PluginAction) UpdatePluginAct(pluginID, tenantID string, cps *api_model
|
||||
//DeletePluginAct DeletePluginAct
|
||||
func (p *PluginAction) DeletePluginAct(pluginID, tenantID string) *util.APIHandleError {
|
||||
tx := db.GetManager().Begin()
|
||||
err := db.GetManager().TenantPluginDaoTransactions(tx).DeletePluginByID(pluginID, tenantID)
|
||||
//step1: delete service plugin relation
|
||||
err := db.GetManager().TenantServicePluginRelationDaoTransactions(tx).DeleteALLRelationByPluginID(pluginID)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return util.CreateAPIHandleErrorFromDBError("delete plugin relation", err)
|
||||
}
|
||||
//step2: delete plugin build version
|
||||
err = db.GetManager().TenantPluginBuildVersionDaoTransactions(tx).DeleteBuildVersionByPluginID(pluginID)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return util.CreateAPIHandleErrorFromDBError("delete plugin build version", err)
|
||||
}
|
||||
//step3: delete plugin
|
||||
err = db.GetManager().TenantPluginDaoTransactions(tx).DeletePluginByID(pluginID, tenantID)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return util.CreateAPIHandleErrorFromDBError("delete plugin", err)
|
||||
|
@ -64,10 +64,8 @@ func (t *PluginDaoImpl) GetPluginByID(id, tenantID string) (*model.TenantPlugin,
|
||||
|
||||
//DeletePluginByID DeletePluginByID
|
||||
func (t *PluginDaoImpl) DeletePluginByID(id, tenantID string) error {
|
||||
relation := &model.TenantPlugin{
|
||||
PluginID: id,
|
||||
}
|
||||
if err := t.DB.Where("plugin_id=? and tenant_id=?", id, tenantID).Delete(relation).Error; err != nil {
|
||||
var plugin model.TenantPlugin
|
||||
if err := t.DB.Where("plugin_id=? and tenant_id=?", id, tenantID).Delete(&plugin).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@ -137,6 +137,7 @@ func (n *NodeCluster) UpdateNode(node *model.HostNode) {
|
||||
n.nodes[node.ID] = node
|
||||
n.client.Put(option.Config.NodePath+"/"+node.ID, node.String())
|
||||
}
|
||||
|
||||
func (n *NodeCluster) getNodeFromKV(kv *mvccpb.KeyValue) *model.HostNode {
|
||||
var node model.HostNode
|
||||
if err := ffjson.Unmarshal(kv.Value, &node); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user