瀏覽代碼

Use DOIRequestData struct instead of map[string]string

Achilleas Koutsou 5 年之前
父節點
當前提交
3abbf21e38
共有 2 個文件被更改,包括 14 次插入5 次删除
  1. 5 5
      routes/doi.go
  2. 9 0
      vendor/github.com/G-Node/libgin/libgin/doi.go

+ 5 - 5
routes/doi.go

@@ -23,11 +23,11 @@ func RequestDOI(c *context.Context) {
 	repo := c.Repo.Repository.FullName()
 	email := c.User.Email
 
-	data := map[string]string{
-		"username":   username,
-		"realname":   realname,
-		"repository": repo,
-		"email":      email,
+	data := libgin.DOIRequestData{
+		Username:   username,
+		Realname:   realname,
+		Repository: repo,
+		Email:      email,
 	}
 
 	log.Trace("Encrypting data for DOI: %+v", data)

+ 9 - 0
vendor/github.com/G-Node/libgin/libgin/doi.go

@@ -34,6 +34,15 @@ func RepoPathToUUID(URI string) string {
 	return hex.EncodeToString(currMd5[:])
 }
 
+// DOIRequestData is used to transmit data from GIN to DOI when a registration
+// request is triggered.
+type DOIRequestData struct {
+	Username   string
+	Realname   string
+	Repository string
+	Email      string
+}
+
 // DOIRegInfo holds all the metadata and information necessary for a DOI registration request.
 type DOIRegInfo struct {
 	Missing      []string