MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / ServiceOverview

Method ServiceOverview

module/service/iml.go:265–300  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

263}
264
265func (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
302func (i *imlServiceModule) OnInit() {
303 register.Handle(func(v server.Server) {

Callers

nothing calls this directly

Calls 5

GetMethod · 0.65
APICountByServicesMethod · 0.65
CountMapByServiceMethod · 0.65
GetRunningMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected