Upstream sync
This commit is contained in:
@@ -214,7 +214,11 @@ func (c *organizationRepo) parseEntity(row scanner) (retVal entity.Organization,
|
||||
err = row.Scan(
|
||||
&retVal.ID, &retVal.UUID, &retVal.Type.ID, &retVal.Type.Name, &retVal.Type.Key, &retVal.Name, &retVal.Description, &retVal.ReferenceID, &retVal.ParentID, &retVal.Main, &retVal.Created, &retVal.Updated, &retVal.Active, &retVal.Suspended, &retVal.Blocked, &retVal.Author.ID, &retVal.Author.UUID, &retVal.Author.Name, &retVal.LastEditor.ID, &retVal.LastEditor.UUID, &retVal.LastEditor.Name)
|
||||
|
||||
return retVal, errors.Wrap(err)
|
||||
if err == sql.ErrNoRows {
|
||||
return retVal, nil
|
||||
} else {
|
||||
return retVal, errors.Wrap(err)
|
||||
}
|
||||
}
|
||||
|
||||
// parseSet parses a result set result to an entity array
|
||||
@@ -352,6 +356,17 @@ func (c *organizationRepo) GetByID(organizationID int64, user entity.User) (enti
|
||||
return c.parseEntity(c.conn.QueryRow(query, organizationID))
|
||||
}
|
||||
|
||||
func (c *organizationRepo) GetByTypeAndReferenceID(typeKey string, referenceID int64, user entity.User) (entity.Organization, error) {
|
||||
query, where, err := c.getProfileQuery(user)
|
||||
if err != nil {
|
||||
return entity.Organization{}, err
|
||||
}
|
||||
|
||||
query = c.getQuery() + query + " WHERE b.organization_type_key = ? AND a.organization_reference_id = ? " + where
|
||||
|
||||
return c.parseEntity(c.conn.QueryRow(query, typeKey, referenceID))
|
||||
}
|
||||
|
||||
func (c *organizationRepo) GetChildsByID(organizationID int64, user entity.User) ([]entity.Organization, error) {
|
||||
query, where, err := c.getProfileQuery(user)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user