update synonym error

This commit is contained in:
aichy126 2022-11-17 19:23:02 +08:00
parent 30039173c0
commit 6742c5d707
4 changed files with 32 additions and 27 deletions

View File

@ -6257,6 +6257,10 @@ const docTemplate = `{
}, },
"schema.UserEmailLogin": { "schema.UserEmailLogin": {
"type": "object", "type": "object",
"required": [
"e_mail",
"pass"
],
"properties": { "properties": {
"captcha_code": { "captcha_code": {
"description": "captcha_code", "description": "captcha_code",
@ -6268,11 +6272,14 @@ const docTemplate = `{
}, },
"e_mail": { "e_mail": {
"description": "e_mail", "description": "e_mail",
"type": "string" "type": "string",
"maxLength": 500
}, },
"pass": { "pass": {
"description": "password", "description": "password",
"type": "string" "type": "string",
"maxLength": 32,
"minLength": 8
} }
} }
}, },

View File

@ -6245,6 +6245,10 @@
}, },
"schema.UserEmailLogin": { "schema.UserEmailLogin": {
"type": "object", "type": "object",
"required": [
"e_mail",
"pass"
],
"properties": { "properties": {
"captcha_code": { "captcha_code": {
"description": "captcha_code", "description": "captcha_code",
@ -6256,11 +6260,14 @@
}, },
"e_mail": { "e_mail": {
"description": "e_mail", "description": "e_mail",
"type": "string" "type": "string",
"maxLength": 500
}, },
"pass": { "pass": {
"description": "password", "description": "password",
"type": "string" "type": "string",
"maxLength": 32,
"minLength": 8
} }
} }
}, },

View File

@ -1449,10 +1449,16 @@ definitions:
type: string type: string
e_mail: e_mail:
description: e_mail description: e_mail
maxLength: 500
type: string type: string
pass: pass:
description: password description: password
maxLength: 32
minLength: 8
type: string type: string
required:
- e_mail
- pass
type: object type: object
schema.UserModifyPassWordRequest: schema.UserModifyPassWordRequest:
properties: properties:

View File

@ -291,7 +291,6 @@ func (ts *TagCommonService) CheckTag(ctx context.Context, tags []string, userID
} }
thisTagNameList := make([]string, 0) thisTagNameList := make([]string, 0)
thisTagIDList := make([]string, 0)
for _, t := range tags { for _, t := range tags {
t = strings.ToLower(t) t = strings.ToLower(t)
thisTagNameList = append(thisTagNameList, 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) tagInDbMapping := make(map[string]*entity.Tag)
checktags := make([]string, 0)
for _, tag := range tagListInDb { for _, tag := range tagListInDb {
if tag.MainTagID != 0 { if tag.MainTagID != 0 {
err = errors.BadRequest(reason.TagNotContainSynonym).WithMsg(fmt.Sprintf("tag name:%s", tag.SlugName)) checktags = append(checktags, fmt.Sprintf("\"%s\"", tag.SlugName))
return err
} }
tagInDbMapping[tag.SlugName] = tag 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) 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", err = errors.BadRequest(reason.TagNotFound).WithMsg(fmt.Sprintf("tag [%s] does not exist",
strings.Join(addTagMsgList, ","))) strings.Join(addTagMsgList, ",")))
return err 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 return nil