Insert and Update Users instead of generic Save function. Check ID != 0

This commit is contained in:
Brad Rydzewski
2015-01-13 21:57:02 -08:00
parent 881dcb153e
commit d0b722cc8b
3 changed files with 27 additions and 8 deletions

View File

@@ -1,5 +1,9 @@
package model
import (
"fmt"
)
type Request struct {
Host string `json:"-"`
User *User `json:"-"`
@@ -7,3 +11,16 @@ type Request struct {
Commit *Commit `json:"commit"`
Prior *Commit `json:"prior_commit"`
}
// URL returns the link to the commit in
// string format.
func (r *Request) URL() string {
return fmt.Sprintf("%s/%s/%s/%s",
r.Host,
r.Repo.Host,
r.Repo.Owner,
r.Repo.Name,
r.Commit.Branch,
r.Commit.Sha,
)
}