1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-26 13:29:12 -05:00
forgejo/models/user/user_repository.go

25 lines
511 B
Go
Raw Normal View History

2024-02-07 10:12:23 -05:00
// Copyright 2024 The Forgejo Authors. All rights reserved.
2024-02-07 10:42:40 -05:00
// SPDX-License-Identifier: MIT
package user
import (
"context"
"fmt"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/validation"
)
func init() {
db.RegisterModel(new(FederatedUser))
}
func CreateFederationUser(ctx context.Context, user *FederatedUser) error {
2024-02-07 10:42:40 -05:00
if res, err := validation.IsValid(user); !res {
return fmt.Errorf("FederatedUser is not valid: %v", err)
}
_, err := db.GetEngine(ctx).Insert(user)
return err
}