fix: upload tag error

This commit is contained in:
Damillora 2021-09-11 02:11:10 +07:00
parent 63b19dcf0f
commit 16c9f998d5
3 changed files with 4 additions and 5 deletions

View File

@ -21,14 +21,14 @@ func GetTagAll() []models.TagListItem {
return tags return tags
} }
func GetTagAutocomplete() []models.TagAutocompleteListItem { func GetTagAutocomplete() []string {
var tags []models.TagAutocompleteListItem var tags []string
result := database.DB.Model(&database.Tag{}). result := database.DB.Model(&database.Tag{}).
Joins("join tag_types on tag_types.id = tags.tag_type_id"). Joins("join tag_types on tag_types.id = tags.tag_type_id").
Select("concat(tag_types.name,':',tags.name) as name"). Select("concat(tag_types.name,':',tags.name) as name").
Find(&tags) Find(&tags)
if result.Error != nil { if result.Error != nil {
return []models.TagAutocompleteListItem{} return []string{}
} }
return tags return tags
} }

View File

@ -94,7 +94,6 @@
addKeys={[9, 32]} addKeys={[9, 32]}
on:tags={onTagChange} on:tags={onTagChange}
autoComplete={onAutocomplete} autoComplete={onAutocomplete}
autoCompleteKey={"name"}
/> />
</div> </div>
</div> </div>

View File

@ -112,7 +112,7 @@
<div class="field"> <div class="field">
<label for="tags" class="label">Tags</label> <label for="tags" class="label">Tags</label>
<div class="control" id="tags"> <div class="control" id="tags">
<Tags addKeys={[9, 32]} on:tags={onTagChange} autoComplete={onAutocomplete} autoCompleteKey={"name"} /> <Tags addKeys={[9, 32]} on:tags={onTagChange} autoComplete={onAutocomplete} />
</div> </div>
</div> </div>
<div class="control"> <div class="control">