(ctx context.Context, orgID string)
| 234 | } |
| 235 | |
| 236 | func (s *sqlDatabase) GetOrganizationByID(ctx context.Context, orgID string) (params.Organization, error) { |
| 237 | preloadList := []string{ |
| 238 | "Pools", |
| 239 | "Credentials", |
| 240 | "Endpoint", |
| 241 | "Credentials.Endpoint", |
| 242 | "GiteaCredentials", |
| 243 | "GiteaCredentials.Endpoint", |
| 244 | "Events", |
| 245 | } |
| 246 | org, err := s.getOrgByID(ctx, s.conn, orgID, preloadList...) |
| 247 | if err != nil { |
| 248 | return params.Organization{}, fmt.Errorf("error fetching org: %w", err) |
| 249 | } |
| 250 | |
| 251 | param, err := s.sqlToCommonOrganization(org, true) |
| 252 | if err != nil { |
| 253 | return params.Organization{}, fmt.Errorf("error fetching org: %w", err) |
| 254 | } |
| 255 | return param, nil |
| 256 | } |
| 257 | |
| 258 | func (s *sqlDatabase) getOrgByID(_ context.Context, db *gorm.DB, id string, preload ...string) (Organization, error) { |
| 259 | u, err := uuid.Parse(id) |
no test coverage detected