forked from kevadesu/forgejo
add test & fix compile
This commit is contained in:
parent
4938d38e39
commit
508b4deac8
3 changed files with 35 additions and 5 deletions
|
@ -10,14 +10,14 @@ import (
|
|||
// FederatedRepo represents a federated Repository Actor connected with a local Repo
|
||||
type FederatedRepo struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepositoryID int64 `xorm:"NOT NULL"`
|
||||
RepoID int64 `xorm:"NOT NULL"`
|
||||
ExternalID string `xorm:"TEXT UNIQUE(federation_repo_mapping) NOT NULL"`
|
||||
FederationHostID int64 `xorm:"UNIQUE(federation_repo_mapping) NOT NULL"`
|
||||
}
|
||||
|
||||
func NewFederatedRepo(repositoryID int64, externalID string, federationHostID int64) (FederatedRepo, error) {
|
||||
func NewFederatedRepo(repoID int64, externalID string, federationHostID int64) (FederatedRepo, error) {
|
||||
result := FederatedRepo{
|
||||
RepositoryID: repositoryID,
|
||||
RepoID: repoID,
|
||||
ExternalID: externalID,
|
||||
FederationHostID: federationHostID,
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ func NewFederatedRepo(repositoryID int64, externalID string, federationHostID in
|
|||
|
||||
func (user FederatedRepo) Validate() []string {
|
||||
var result []string
|
||||
result = append(result, validation.ValidateNotEmpty(user.RepositoryID, "UserID")...)
|
||||
result = append(result, validation.ValidateNotEmpty(user.RepoID, "UserID")...)
|
||||
result = append(result, validation.ValidateNotEmpty(user.ExternalID, "ExternalID")...)
|
||||
result = append(result, validation.ValidateNotEmpty(user.FederationHostID, "FederationHostID")...)
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue