mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 07:19:20 +01:00
fix(alias): conversation errors
This commit is contained in:
parent
2c05436217
commit
821a4148de
@ -84,7 +84,7 @@ type Integration struct {
|
|||||||
TaskParams MapStringAnyField `db:"task_params" json:"task_params"`
|
TaskParams MapStringAnyField `db:"task_params" json:"task_params"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (alias *IntegrationAlias) ToAlias() Alias {
|
func (alias IntegrationAlias) ToAlias() Alias {
|
||||||
return Alias{
|
return Alias{
|
||||||
ID: alias.ID,
|
ID: alias.ID,
|
||||||
Alias: alias.Alias,
|
Alias: alias.Alias,
|
||||||
|
@ -43,6 +43,16 @@ type BoltDb struct {
|
|||||||
integrationAlias publicAlias
|
integrationAlias publicAlias
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateBoltDB() *BoltDb {
|
||||||
|
res := BoltDb{}
|
||||||
|
res.integrationAlias = publicAlias{
|
||||||
|
aliasProps: db.IntegrationAliasProps,
|
||||||
|
publicAliasProps: integrationAliasProps,
|
||||||
|
db: &res,
|
||||||
|
}
|
||||||
|
return &res
|
||||||
|
}
|
||||||
|
|
||||||
type objectID interface {
|
type objectID interface {
|
||||||
ToBytes() []byte
|
ToBytes() []byte
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ func (d *publicAlias) createAlias(aliasObj interface{}) (newAlias interface{}, e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = d.db.createObject(-1, d.aliasProps, aliasObj)
|
_, err = d.db.createObject(-1, d.publicAliasProps, aliasObj)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = d.deleteIntegrationAlias(alias.ProjectID, alias.ID)
|
_ = d.deleteIntegrationAlias(alias.ProjectID, alias.ID)
|
||||||
@ -58,12 +58,12 @@ func (d *publicAlias) createAlias(aliasObj interface{}) (newAlias interface{}, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *publicAlias) deleteIntegrationAlias(projectID int, aliasID int) (err error) {
|
func (d *publicAlias) deleteIntegrationAlias(projectID int, aliasID int) (err error) {
|
||||||
|
aliasPtr := reflect.New(d.aliasProps.Type)
|
||||||
aliasObj := reflect.New(d.aliasProps.Type).Interface()
|
aliasObj := aliasPtr.Elem().Interface()
|
||||||
|
|
||||||
alias := aliasObj.(db.Aliasable).ToAlias()
|
alias := aliasObj.(db.Aliasable).ToAlias()
|
||||||
|
|
||||||
err = d.db.getObject(projectID, d.aliasProps, intObjectID(aliasID), &aliasObj)
|
err = d.db.getObject(projectID, d.aliasProps, intObjectID(aliasID), aliasPtr.Interface())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ func CreateStore() db.Store {
|
|||||||
case util.DbDriverMySQL:
|
case util.DbDriverMySQL:
|
||||||
return &sql.SqlDb{}
|
return &sql.SqlDb{}
|
||||||
case util.DbDriverBolt:
|
case util.DbDriverBolt:
|
||||||
return &bolt.BoltDb{}
|
return bolt.CreateBoltDB()
|
||||||
case util.DbDriverPostgres:
|
case util.DbDriverPostgres:
|
||||||
return &sql.SqlDb{}
|
return &sql.SqlDb{}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user