Upstream sync
This commit is contained in:
@@ -24,6 +24,11 @@ func (c *organizationRepo) getProfileQuery(user entity.User) (query string, wher
|
||||
if len(user.Profiles) > 0 {
|
||||
for _, p := range user.Profiles {
|
||||
switch p.Key {
|
||||
case "VIRPT":
|
||||
switch p.Organization.Type.Key {
|
||||
case "provider":
|
||||
return
|
||||
}
|
||||
case "AD", "BCBSIAD", "BDCAD", "PLANAD":
|
||||
switch p.Organization.Type.Key {
|
||||
case "techsupport", "bcbsi", "bcbsa":
|
||||
@@ -44,7 +49,7 @@ func (c *organizationRepo) getProfileQuery(user entity.User) (query string, wher
|
||||
where = fmt.Sprintf(` AND (a.organization_uuid = '%s' OR f.organization_uuid = '%s') `, p.Organization.UUID, p.Organization.UUID)
|
||||
return
|
||||
}
|
||||
case "SP", "SPT", "VIRPT":
|
||||
case "SP", "SPT":
|
||||
switch p.Organization.Type.Key {
|
||||
case "techsupport", "bcbsi", "bcbsa":
|
||||
return
|
||||
@@ -341,7 +346,6 @@ func (c *organizationRepo) GetByUUID(organizationUUID string, user entity.User)
|
||||
}
|
||||
|
||||
query = c.getQuery() + query + " WHERE a.organization_uuid = ? " + where
|
||||
|
||||
return c.parseEntity(c.conn.QueryRow(query, organizationUUID))
|
||||
}
|
||||
|
||||
@@ -446,13 +450,16 @@ func (c *organizationRepo) SetOrganizationAddress(address entity.OrganizationAdd
|
||||
return entity.OrganizationAddress{}, errors.NewNotFoundError()
|
||||
}
|
||||
|
||||
organization, err := c.GetByUUID(address.Organization.UUID, user)
|
||||
if err != nil {
|
||||
return entity.OrganizationAddress{}, err
|
||||
if address.Organization.ID == 0 {
|
||||
organization, err := c.GetByUUID(address.Organization.UUID, user)
|
||||
if err != nil {
|
||||
return entity.OrganizationAddress{}, err
|
||||
}
|
||||
address.Organization = &organization
|
||||
}
|
||||
|
||||
UUID, _ := uuid.NewV4()
|
||||
result, err := c.conn.Exec(query, UUID.String(), organization.ID, address.InternalID, address.Name, address.Address, address.Description, address.Latitude, address.Longitude, address.CreatedUser.ID, address.UpdatedUser.ID)
|
||||
result, err := c.conn.Exec(query, UUID.String(), address.Organization.ID, address.InternalID, address.Name, address.Address, address.Description, address.Latitude, address.Longitude, address.CreatedUser.ID, address.UpdatedUser.ID)
|
||||
if err != nil {
|
||||
return entity.OrganizationAddress{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user