Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update synonym error

aichy1266742c5d707c3
diff --git a/docs/docs.go b/docs/docs.go
index cf9dd787..fe221fb7 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -6257,6 +6257,10 @@ const docTemplate = `{
},
"schema.UserEmailLogin": {
"type": "object",
+ "required": [
+ "e_mail",
+ "pass"
+ ],
"properties": {
"captcha_code": {
"description": "captcha_code",
@@ -6268,11 +6272,14 @@ const docTemplate = `{
},
"e_mail": {
"description": "e_mail",
- "type": "string"
+ "type": "string",
+ "maxLength": 500
},
"pass": {
"description": "password",
- "type": "string"
+ "type": "string",
+ "maxLength": 32,
+ "minLength": 8
}
}
},
diff --git a/docs/swagger.json b/docs/swagger.json
index a0e0547e..8ac3e0a1 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -6245,6 +6245,10 @@
},
"schema.UserEmailLogin": {
"type": "object",
+ "required": [
+ "e_mail",
+ "pass"
+ ],
"properties": {
"captcha_code": {
"description": "captcha_code",
@@ -6256,11 +6260,14 @@
},
"e_mail": {
"description": "e_mail",
- "type": "string"
+ "type": "string",
+ "maxLength": 500
},
"pass": {
"description": "password",
- "type": "string"
+ "type": "string",
+ "maxLength": 32,
+ "minLength": 8
}
}
},
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 1fe5445a..d1f66631 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1449,10 +1449,16 @@ definitions:
type: string
e_mail:
description: e_mail
+ maxLength: 500
type: string
pass:
description: password
+ maxLength: 32
+ minLength: 8
type: string
+ required:
+ - e_mail
+ - pass
type: object
schema.UserModifyPassWordRequest:
properties:
diff --git a/internal/service/tag_common/tag_common.go b/internal/service/tag_common/tag_common.go
index 1f876202..b37e2a83 100644
--- a/internal/service/tag_common/tag_common.go
+++ b/internal/service/tag_common/tag_common.go
@@ -291,7 +291,6 @@ func (ts *TagCommonService) CheckTag(ctx context.Context, tags []string, userID
}
thisTagNameList := make([]string, 0)
- thisTagIDList := make([]string, 0)
for _, t := range tags {
t = strings.ToLower(t)
thisTagNameList = append(thisTagNameList, t)
@@ -304,13 +303,17 @@ func (ts *TagCommonService) CheckTag(ctx context.Context, tags []string, userID
}
tagInDbMapping := make(map[string]*entity.Tag)
+ checktags := make([]string, 0)
+
for _, tag := range tagListInDb {
if tag.MainTagID != 0 {
- err = errors.BadRequest(reason.TagNotContainSynonym).WithMsg(fmt.Sprintf("tag name:%s", tag.SlugName))
- return err
+ checktags = append(checktags, fmt.Sprintf("\"%s\"", tag.SlugName))
}
tagInDbMapping[tag.SlugName] = tag
- thisTagIDList = append(thisTagIDList, tag.ID)
+ }
+ if len(checktags) > 0 {
+ err = errors.BadRequest(reason.TagNotContainSynonym).WithMsg(fmt.Sprintf("Should not contain synonym tags %s", strings.Join(checktags, ",")))
+ return err
}
addTagList := make([]*entity.Tag, 0)
@@ -334,25 +337,7 @@ func (ts *TagCommonService) CheckTag(ctx context.Context, tags []string, userID
err = errors.BadRequest(reason.TagNotFound).WithMsg(fmt.Sprintf("tag [%s] does not exist",
strings.Join(addTagMsgList, ",")))
return err
- // todo if need add
- // err = ts.tagRepo.AddTagList(ctx, addTagList)
- // if err != nil {
- // return err
- // }
- // for _, tag := range addTagList {
- // thisTagIDList = append(thisTagIDList, tag.ID)
- // revisionDTO := &schema.AddRevisionDTO{
- // UserID: userID,
- // ObjectID: tag.ID,
- // Title: tag.SlugName,
- // }
- // tagInfoJson, _ := json.Marshal(tag)
- // revisionDTO.Content = string(tagInfoJson)
- // err = ts.revisionService.AddRevision(ctx, revisionDTO, true)
- // if err != nil {
- // return err
- // }
- // }
+
}
return nil