Skip to content

Commit 584f9f9

Browse files
committed
Fix push mirror, wrong timestamp format
1 parent 9336286 commit 584f9f9

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

modules/structs/mirror.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
package structs
55

6+
import "time"
7+
68
// CreatePushMirrorOption represents need information to create a push mirror of a repository.
79
type CreatePushMirrorOption struct {
810
RemoteAddress string `json:"remote_address"`
@@ -15,12 +17,12 @@ type CreatePushMirrorOption struct {
1517
// PushMirror represents information of a push mirror
1618
// swagger:model
1719
type PushMirror struct {
18-
RepoName string `json:"repo_name"`
19-
RemoteName string `json:"remote_name"`
20-
RemoteAddress string `json:"remote_address"`
21-
CreatedUnix string `json:"created"`
22-
LastUpdateUnix string `json:"last_update"`
23-
LastError string `json:"last_error"`
24-
Interval string `json:"interval"`
25-
SyncOnCommit bool `json:"sync_on_commit"`
20+
RepoName string `json:"repo_name"`
21+
RemoteName string `json:"remote_name"`
22+
RemoteAddress string `json:"remote_address"`
23+
CreatedUnix time.Time `json:"created"`
24+
LastUpdateUnix time.Time `json:"last_update"`
25+
LastError string `json:"last_error"`
26+
Interval string `json:"interval"`
27+
SyncOnCommit bool `json:"sync_on_commit"`
2628
}

services/convert/mirror.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ func ToPushMirror(pm *repo_model.PushMirror) (*api.PushMirror, error) {
1515
RepoName: repo.Name,
1616
RemoteName: pm.RemoteName,
1717
RemoteAddress: pm.RemoteAddress,
18-
CreatedUnix: pm.CreatedUnix.FormatLong(),
19-
LastUpdateUnix: pm.LastUpdateUnix.FormatLong(),
18+
CreatedUnix: pm.CreatedUnix.AsTime(),
19+
LastUpdateUnix: pm.LastUpdateUnix.AsTime(),
2020
LastError: pm.LastError,
2121
Interval: pm.Interval.String(),
2222
SyncOnCommit: pm.SyncOnCommit,

templates/swagger/v1_json.tmpl

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)