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"`
|
||||
}
|
||||
|
||||
func (alias *IntegrationAlias) ToAlias() Alias {
|
||||
func (alias IntegrationAlias) ToAlias() Alias {
|
||||
return Alias{
|
||||
ID: alias.ID,
|
||||
Alias: alias.Alias,
|
||||
|
@ -43,6 +43,16 @@ type BoltDb struct {
|
||||
integrationAlias publicAlias
|
||||
}
|
||||
|
||||
func CreateBoltDB() *BoltDb {
|
||||
res := BoltDb{}
|
||||
res.integrationAlias = publicAlias{
|
||||
aliasProps: db.IntegrationAliasProps,
|
||||
publicAliasProps: integrationAliasProps,
|
||||
db: &res,
|
||||
}
|
||||
return &res
|
||||
}
|
||||
|
||||
type objectID interface {
|
||||
ToBytes() []byte
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func (d *publicAlias) createAlias(aliasObj interface{}) (newAlias interface{}, e
|
||||
return
|
||||
}
|
||||
|
||||
_, err = d.db.createObject(-1, d.aliasProps, aliasObj)
|
||||
_, err = d.db.createObject(-1, d.publicAliasProps, aliasObj)
|
||||
|
||||
if err != nil {
|
||||
_ = 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) {
|
||||
|
||||
aliasObj := reflect.New(d.aliasProps.Type).Interface()
|
||||
aliasPtr := reflect.New(d.aliasProps.Type)
|
||||
aliasObj := aliasPtr.Elem().Interface()
|
||||
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ func CreateStore() db.Store {
|
||||
case util.DbDriverMySQL:
|
||||
return &sql.SqlDb{}
|
||||
case util.DbDriverBolt:
|
||||
return &bolt.BoltDb{}
|
||||
return bolt.CreateBoltDB()
|
||||
case util.DbDriverPostgres:
|
||||
return &sql.SqlDb{}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user