You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mirror.go 767B

1234567891011121314151617181920212223242526
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package convert
  4. import (
  5. "context"
  6. repo_model "code.gitea.io/gitea/models/repo"
  7. api "code.gitea.io/gitea/modules/structs"
  8. )
  9. // ToPushMirror convert from repo_model.PushMirror and remoteAddress to api.TopicResponse
  10. func ToPushMirror(ctx context.Context, pm *repo_model.PushMirror) (*api.PushMirror, error) {
  11. repo := pm.GetRepository(ctx)
  12. return &api.PushMirror{
  13. RepoName: repo.Name,
  14. RemoteName: pm.RemoteName,
  15. RemoteAddress: pm.RemoteAddress,
  16. CreatedUnix: pm.CreatedUnix.AsTime(),
  17. LastUpdateUnix: pm.LastUpdateUnix.AsTimePtr(),
  18. LastError: pm.LastError,
  19. Interval: pm.Interval.String(),
  20. SyncOnCommit: pm.SyncOnCommit,
  21. }, nil
  22. }