Skip to content

Commit

Permalink
feat: vn page sort by updated
Browse files Browse the repository at this point in the history
  • Loading branch information
KUN1007 committed Oct 25, 2024
1 parent 881911d commit 731f139
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion components/galgame/card/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ watch(

<KunSelect
:styles="{ width: '150px' }"
:options="['views', 'time']"
:options="['time', 'created', 'views']"
:default-value="sortField"
i18n="galgame.resource.sort"
@set="(value) => (sortField = value as 'time' | 'views')"
Expand Down
3 changes: 2 additions & 1 deletion language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@
},
"sort": {
"views": "Views",
"time": "Time"
"time": "Update",
"created": "Created"
},
"create": "Create resource link",
"cancelRewrite": "Cancel Rewrite",
Expand Down
3 changes: 2 additions & 1 deletion language/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@
},
"sort": {
"views": "閲覧順",
"time": "時間順"
"time": "更新順",
"created": "作成順"
},
"create": "リソースリンクを作成",
"cancelRewrite": "書き換えをキャンセル",
Expand Down
3 changes: 2 additions & 1 deletion language/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@
},
"sort": {
"views": "浏览顺序",
"time": "时间顺序"
"time": "更新顺序",
"created": "创建顺序"
},
"create": "创建资源链接",
"cancelRewrite": "取消 Rewrite",
Expand Down
3 changes: 2 additions & 1 deletion language/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@
},
"sort": {
"views": "瀏覽順序",
"time": "時間順序"
"time": "更新順序",
"created": "創建順序"
},
"create": "創建資源鏈接",
"cancelRewrite": "取消 Rewrite",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kun-galgame-nuxt3",
"version": "2.19.14",
"version": "2.19.15",
"packageManager": "[email protected]",
"private": true,
"scripts": {
Expand All @@ -20,6 +20,7 @@
},
"devDependencies": {
"@iconify-json/ci": "^1.2.1",
"@iconify-json/iconoir": "^1.2.2",
"@iconify-json/line-md": "^1.2.2",
"@iconify-json/lucide": "^1.2.9",
"@iconify-json/mdi": "^1.2.1",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion server/api/galgame/[gid]/link/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default defineEventHandler(async (event) => {

await GalgameModel.updateOne(
{ gid: result.gid },
{ $addToSet: { contributor: result.uid } }
{
$set: { time: Date.now() },
$addToSet: { contributor: result.uid }
}
)

await session.commitTransaction()
Expand Down
5 changes: 5 additions & 0 deletions server/api/galgame/[gid]/pr/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export default defineEventHandler(async (event) => {
galgame: diffGalgame
})

await GalgameModel.updateOne(
{ gid: galgame.gid },
{ $set: { time: Date.now() } }
)

await createGalgameHistory({
gid,
uid: userInfo.uid,
Expand Down
1 change: 1 addition & 0 deletions server/api/galgame/[gid]/resource/index.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default defineEventHandler(async (event) => {
await GalgameModel.updateOne(
{ gid: result.gid },
{
$set: { time: Date.now() },
$addToSet: {
contributor: result.uid,
resources: resource.grid,
Expand Down
4 changes: 2 additions & 2 deletions server/api/galgame/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getGalgames = async (
type: TypeOptions,
language: LanguageOptions,
platform: PlatformOptions,
sortField: 'time' | 'views',
sortField: 'time' | 'created' | 'views',
sortOrder: KunOrder
) => {
const skip = (page - 1) * limit
Expand Down Expand Up @@ -80,7 +80,7 @@ export default defineEventHandler(async (event) => {
type,
language,
platform,
sortField as 'time' | 'views',
sortField as 'time' | 'created' | 'views',
sortOrder as KunOrder
)

Expand Down
2 changes: 1 addition & 1 deletion store/types/galgame/galgame.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export interface GalgameStoreTemp {
type: TypeOptions
language: LanguageOptions
platform: PlatformOptions
sortField: 'time' | 'views'
sortField: 'time' | 'created' | 'views'
sortOrder: KunOrder
}

0 comments on commit 731f139

Please sign in to comment.