(ctx context.Context, id string)
| 263 | } |
| 264 | |
| 265 | func (i *imlServiceModule) ServiceOverview(ctx context.Context, id string) (*service_dto.Overview, error) { |
| 266 | info, err := i.serviceService.Get(ctx, id) |
| 267 | if err != nil { |
| 268 | return nil, err |
| 269 | } |
| 270 | |
| 271 | apiCountMap, err := i.apiDocService.APICountByServices(ctx, id) |
| 272 | if err != nil { |
| 273 | return nil, err |
| 274 | } |
| 275 | subscribeMap, err := i.subscribeServer.CountMapByService(ctx, subscribe.ApplyStatusSubscribe, id) |
| 276 | if err != nil { |
| 277 | return nil, err |
| 278 | } |
| 279 | result := &service_dto.Overview{ |
| 280 | Id: info.Id, |
| 281 | Name: info.Name, |
| 282 | Description: info.Description, |
| 283 | EnableMCP: info.EnableMCP, |
| 284 | ServiceKind: info.Kind.String(), |
| 285 | SubscriberNum: subscribeMap[id], |
| 286 | Logo: info.Logo, |
| 287 | Catalogue: auto.UUID(info.Catalogue), |
| 288 | APINum: apiCountMap[id], |
| 289 | } |
| 290 | _, err = i.releaseService.GetRunning(ctx, id) |
| 291 | if err != nil { |
| 292 | if !errors.Is(err, gorm.ErrRecordNotFound) { |
| 293 | return nil, err |
| 294 | } |
| 295 | } else { |
| 296 | result.IsReleased = true |
| 297 | } |
| 298 | |
| 299 | return result, nil |
| 300 | } |
| 301 | |
| 302 | func (i *imlServiceModule) OnInit() { |
| 303 | register.Handle(func(v server.Server) { |
nothing calls this directly
no test coverage detected