forked from kevadesu/forgejo
Fix error handling & add timestamp check
This commit is contained in:
parent
40ec049013
commit
dabd773f6b
5 changed files with 56 additions and 27 deletions
|
@ -50,3 +50,11 @@ func CreateFederationInfo(ctx context.Context, info FederationInfo) error {
|
|||
_, err := db.GetEngine(ctx).Insert(info)
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateFederationInfo(ctx context.Context, info FederationInfo) error {
|
||||
if res, err := validation.IsValid(info); !res {
|
||||
return fmt.Errorf("FederationInfo is not valid: %v", err)
|
||||
}
|
||||
_, err := db.GetEngine(ctx).ID(info.ID).Update(info)
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue