2022-07-30 10:45:59 -06:00
|
|
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
2022-11-27 11:20:29 -07:00
|
|
|
// SPDX-License-Identifier: MIT
|
2022-07-30 10:45:59 -06:00
|
|
|
|
|
|
|
package convert
|
|
|
|
|
|
|
|
import (
|
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ToPushMirror convert from repo_model.PushMirror and remoteAddress to api.TopicResponse
|
|
|
|
func ToPushMirror(pm *repo_model.PushMirror) (*api.PushMirror, error) {
|
|
|
|
repo := pm.GetRepository()
|
|
|
|
return &api.PushMirror{
|
|
|
|
RepoName: repo.Name,
|
|
|
|
RemoteName: pm.RemoteName,
|
2023-09-16 10:03:02 -06:00
|
|
|
RemoteAddress: pm.RemoteAddress,
|
2023-09-23 06:15:05 -06:00
|
|
|
CreatedUnix: pm.CreatedUnix.AsTime(),
|
|
|
|
LastUpdateUnix: pm.LastUpdateUnix.AsTimePtr(),
|
2022-07-30 10:45:59 -06:00
|
|
|
LastError: pm.LastError,
|
|
|
|
Interval: pm.Interval.String(),
|
2023-02-23 14:50:33 -07:00
|
|
|
SyncOnCommit: pm.SyncOnCommit,
|
2022-07-30 10:45:59 -06:00
|
|
|
}, nil
|
|
|
|
}
|