Skip to content

Commit

Permalink
feat: add alias for types & tags
Browse files Browse the repository at this point in the history
  • Loading branch information
MarleneJiang committed Jan 31, 2023
1 parent 63e5867 commit 285a392
Show file tree
Hide file tree
Showing 10 changed files with 4,629 additions and 3,540 deletions.
Binary file modified backend/.tmp/data.db
Binary file not shown.
11 changes: 11 additions & 0 deletions backend/src/api/tag/content-types/tag/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
"relation": "manyToMany",
"target": "api::article.article",
"mappedBy": "tagIds"
},
"type": {
"type": "relation",
"relation": "manyToOne",
"target": "api::type.type",
"inversedBy": "tags"
},
"alias": {
"type": "string",
"required": true,
"unique": true
}
}
}
12 changes: 11 additions & 1 deletion backend/src/api/type/content-types/type/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"info": {
"singularName": "type",
"pluralName": "types",
"displayName": "type"
"displayName": "type",
"description": ""
},
"options": {
"draftAndPublish": true
Expand All @@ -21,6 +22,15 @@
"relation": "oneToMany",
"target": "api::article.article",
"mappedBy": "typeId"
},
"tags": {
"type": "relation",
"relation": "oneToMany",
"target": "api::tag.tag",
"mappedBy": "type"
},
"alias": {
"type": "string"
}
}
}
8,136 changes: 4,600 additions & 3,536 deletions backend/src/extensions/documentation/documentation/1.0.0/full_documentation.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/components/ArticlesContent/End.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const props = defineProps({
<div class="tag-list-title">
分类:
</div>
<a href="/frontend" target="_blank" rel="" class="item category-item"><span class="tag-title">{{ props.type.type }}</span></a>
<a href="/frontend" target="_blank" rel="" class="item category-item"><span class="tag-title">{{ props.type.alias }}</span></a>
</div>
<div class="tag-list">
<div class="tag-list-title">
标签:
</div>
<div class="tag-list-container">
<a href="/tag/%E5%89%8D%E7%AB%AF" target="_blank" rel="" class="item tag-item"><span v-for="(item, index) in props.tag.data" :key="index" class="tag-title">{{ item.tag }}</span></a>
<a href="/tag/%E5%89%8D%E7%AB%AF" target="_blank" rel="" class="item tag-item"><span v-for="(item, index) in props.tag.data" :key="index" class="tag-title">{{ item.alias }}</span></a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/ArticlesList/Items/Topbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defineProps({
<span class="text-jj_thirdly px-3 border-r-1">{{ duration }}</span>
<div class="flex px-3">
<div v-for="(item, index) of tags" :key="item.tag" class="items-center flex">
<span class="px-0 text-jj_thirdly">{{ item.tag }}</span>
<span class="px-0 text-jj_thirdly">{{ item.alias }}</span>
<div v-if="index !== tags.length - 1" class="i-carbon-circle-solid px-2 text-[0.15rem]" />
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/server/api/articles/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default defineEventHandler(async (event): Promise<IArticle> => {
data{
attributes{
tag
alias
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/server/api/articles/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default defineEventHandler(async (event): Promise<IArticleItem[]> => {
data{
attributes{
tag
alias
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/types/IArticle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface IAuthor {

interface ITagItem {
tag: string
alias: string
}

interface IType {
Expand Down
1 change: 1 addition & 0 deletions frontend/types/IArticleItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ interface IAuthor {
}
interface ITagItem {
tag: string
alias: string
}
interface IArticleItem {
id: string
Expand Down

0 comments on commit 285a392

Please sign in to comment.