2020-10-17 06:23:08 +02:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2022-11-27 19:20:29 +01:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-10-17 06:23:08 +02:00
|
|
|
|
|
|
|
package convert
|
|
|
|
|
|
|
|
import (
|
2021-11-19 14:39:57 +01:00
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
2020-10-17 06:23:08 +02:00
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
|
|
)
|
|
|
|
|
2022-08-25 04:31:57 +02:00
|
|
|
// ToRelease convert a repo_model.Release to api.Release
|
|
|
|
func ToRelease(r *repo_model.Release) *api.Release {
|
2020-10-17 06:23:08 +02:00
|
|
|
return &api.Release{
|
|
|
|
ID: r.ID,
|
|
|
|
TagName: r.TagName,
|
|
|
|
Target: r.Target,
|
|
|
|
Title: r.Title,
|
|
|
|
Note: r.Note,
|
|
|
|
URL: r.APIURL(),
|
|
|
|
HTMLURL: r.HTMLURL(),
|
|
|
|
TarURL: r.TarURL(),
|
|
|
|
ZipURL: r.ZipURL(),
|
|
|
|
IsDraft: r.IsDraft,
|
|
|
|
IsPrerelease: r.IsPrerelease,
|
|
|
|
CreatedAt: r.CreatedUnix.AsTime(),
|
|
|
|
PublishedAt: r.CreatedUnix.AsTime(),
|
2021-03-27 17:45:26 +01:00
|
|
|
Publisher: ToUser(r.Publisher, nil),
|
2022-12-09 07:35:56 +01:00
|
|
|
Attachments: ToAttachments(r.Attachments),
|
2020-10-17 06:23:08 +02:00
|
|
|
}
|
|
|
|
}
|