forked from forgejo/forgejo
Move createrepository from module to service layer (#26927)
Repository creation depends on many models, so moving it to service layer is better.
This commit is contained in:
parent
b3d88ada01
commit
b9df9fa2e2
26 changed files with 510 additions and 482 deletions
|
@ -13,14 +13,14 @@ import (
|
|||
"code.gitea.io/gitea/modules/options"
|
||||
)
|
||||
|
||||
type licenseValues struct {
|
||||
type LicenseValues struct {
|
||||
Owner string
|
||||
Email string
|
||||
Repo string
|
||||
Year string
|
||||
}
|
||||
|
||||
func getLicense(name string, values *licenseValues) ([]byte, error) {
|
||||
func GetLicense(name string, values *LicenseValues) ([]byte, error) {
|
||||
data, err := options.License(name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("GetRepoInitFile[%s]: %w", name, err)
|
||||
|
@ -28,7 +28,7 @@ func getLicense(name string, values *licenseValues) ([]byte, error) {
|
|||
return fillLicensePlaceholder(name, values, data), nil
|
||||
}
|
||||
|
||||
func fillLicensePlaceholder(name string, values *licenseValues, origin []byte) []byte {
|
||||
func fillLicensePlaceholder(name string, values *LicenseValues, origin []byte) []byte {
|
||||
placeholder := getLicensePlaceholder(name)
|
||||
|
||||
scanner := bufio.NewScanner(bytes.NewReader(origin))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue