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

Method checkPublish

module/publish/iml.go:449–469  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, releaseId string)

Source from the content-addressed store, hash-verified

447
448}
449func (i *imlPublishModule) checkPublish(ctx context.Context, serviceId string, releaseId string) error {
450 flows, err := i.publishService.ListForStatus(ctx, serviceId, publish.StatusApply, publish.StatusAccept)
451 if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
452 return err
453 }
454 if len(flows) > 0 {
455 return errors.New("正在发布中")
456 }
457 running, err := i.releaseService.GetRunning(ctx, serviceId)
458 if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
459 return err
460 }
461
462 if running == nil {
463 return nil
464 }
465 if running.UUID == releaseId {
466 return errors.New("不能申请发布当前版本")
467 }
468 return nil
469}
470func (i *imlPublishModule) Close(ctx context.Context, serviceId, id string) error {
471 err := i.publishService.SetStatus(ctx, serviceId, id, publish.StatusClose)
472 if err != nil {

Callers 2

ApplyMethod · 0.95
CheckPublishMethod · 0.95

Calls 2

ListForStatusMethod · 0.65
GetRunningMethod · 0.65

Tested by

no test coverage detected