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

Method Preview

module/release/iml.go:337–367  ·  view source on GitHub ↗
(ctx context.Context, project string)

Source from the content-addressed store, hash-verified

335}
336
337func (m *imlReleaseModule) Preview(ctx context.Context, project string) (*dto.Release, *service_diff.Diff, bool, error) {
338 _, err := m.projectService.Check(ctx, project, projectRuleMustServer)
339 if err != nil {
340 return nil, nil, false, err
341 }
342 running, err := m.releaseService.GetRunning(ctx, project)
343 if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
344 return nil, nil, false, err
345 }
346
347 if running == nil {
348 running = new(release.Release)
349 }
350
351 diff, completeness, err := m.projectDiffModule.DiffForLatest(ctx, project, running.UUID)
352 if err != nil {
353 return nil, nil, false, err
354 }
355 return &dto.Release{
356 Id: running.UUID,
357 Version: running.Version,
358 Service: auto.UUID(project),
359 CreateTime: auto.TimeLabel(running.CreateAt),
360 Creator: auto.UUID(running.Creator),
361 Status: dto.StatusNone,
362 Remark: running.Remark,
363 CanDelete: false,
364 CanRollback: false,
365 }, diff, completeness, nil
366
367}

Callers

nothing calls this directly

Calls 3

CheckMethod · 0.65
GetRunningMethod · 0.65
DiffForLatestMethod · 0.65

Tested by

no test coverage detected