(ctx context.Context, project string, id string)
| 199 | } |
| 200 | |
| 201 | func (m *imlReleaseModule) Detail(ctx context.Context, project string, id string) (*dto.Detail, error) { |
| 202 | r, err := m.releaseService.GetRelease(ctx, id) |
| 203 | if err != nil { |
| 204 | return nil, err |
| 205 | } |
| 206 | if r.Service != project { |
| 207 | return nil, errors.New("release not found") |
| 208 | } |
| 209 | running, err := m.releaseService.GetRunning(ctx, project) |
| 210 | if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { |
| 211 | return nil, err |
| 212 | } |
| 213 | runningRelease := "" |
| 214 | if running != nil { |
| 215 | runningRelease = running.UUID |
| 216 | } |
| 217 | diff, err := m.projectDiffModule.Diff(ctx, project, runningRelease, r.UUID) |
| 218 | if err != nil { |
| 219 | return nil, err |
| 220 | } |
| 221 | out, err := m.projectDiffModule.Out(ctx, diff) |
| 222 | if err != nil { |
| 223 | return nil, err |
| 224 | } |
| 225 | return &dto.Detail{ |
| 226 | Id: r.UUID, |
| 227 | Version: r.Version, |
| 228 | Remark: r.Remark, |
| 229 | Service: auto.UUID(r.Service), |
| 230 | CreateTime: auto.TimeLabel(r.CreateAt), |
| 231 | Creator: auto.UUID(r.Creator), |
| 232 | Diffs: out, |
| 233 | }, nil |
| 234 | } |
| 235 | |
| 236 | func (m *imlReleaseModule) List(ctx context.Context, project string) ([]*dto.Release, error) { |
| 237 | _, err := m.projectService.Check(ctx, project, projectRuleMustServer) |
nothing calls this directly
no test coverage detected