36 lines
795 B
Go
36 lines
795 B
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"code.gitea.io/sdk/gitea"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type GetCommentProxy struct {
|
||
|
Id int64 `json:"id"`
|
||
|
Body string `json:"body"`
|
||
|
OriginalAuthor string `json:"original_author"`
|
||
|
CreatedAt time.Time `json:"created_at"`
|
||
|
}
|
||
|
|
||
|
type PostCommentProxy struct {
|
||
|
Body string `json:"body"`
|
||
|
}
|
||
|
|
||
|
func (c PostCommentProxy) TransformToGiteaComment() (gitea.CreateIssueCommentOption, error) {
|
||
|
giteaObject := gitea.CreateIssueCommentOption{
|
||
|
Body: c.Body,
|
||
|
}
|
||
|
return giteaObject, nil
|
||
|
}
|
||
|
|
||
|
func CommentTransformFromGitea(comment *gitea.Comment) (GetCommentProxy) {
|
||
|
|
||
|
giteaComment := GetCommentProxy{
|
||
|
Id: comment.ID,
|
||
|
Body: comment.Body,
|
||
|
OriginalAuthor: comment.OriginalAuthor,
|
||
|
CreatedAt: comment.Created,
|
||
|
}
|
||
|
return giteaComment
|
||
|
}
|