From 111a74e0d6a6678bf94792645014822e5dac3e21 Mon Sep 17 00:00:00 2001 From: Ethan Date: Wed, 1 Feb 2023 18:01:53 +0800 Subject: [PATCH] fix: ci broken (#338) Co-authored-by: fusikai --- .github/workflows/release.yml | 8 ++++---- internal/pkg/service/user/user.go | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15989dfef..fa13f77d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,8 @@ on: jobs: goreleaser: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout uses: actions/checkout@v3 @@ -26,6 +28,7 @@ jobs: cd assets yarn install yarn build + git checkout -- ./assets/yarn.lock - name: Set up Go 1.18 uses: actions/setup-go@v3 with: @@ -38,12 +41,10 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - name: Get dependencies run: | go env go get -v -t -d ./... - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: @@ -73,7 +74,6 @@ jobs: id: vars run: | echo "::set-output name=file_name::$(ls dist/juno_*linux* |cut -c 6-)" - - name: Build and push Docker image uses: mr-smithers-excellent/docker-build-push@v5.9 with: @@ -84,4 +84,4 @@ jobs: directory: dist dockerfile: ./cmd/juno-admin/Dockerfile username: ${{ secrets.GHCR_USERNAME }} - password: ${{ secrets.GHCR_TOKEN }} + password: ${{ secrets.GHCR_TOKEN }} \ No newline at end of file diff --git a/internal/pkg/service/user/user.go b/internal/pkg/service/user/user.go index f86793ae1..b7d340d2b 100644 --- a/internal/pkg/service/user/user.go +++ b/internal/pkg/service/user/user.go @@ -183,14 +183,11 @@ func (u *user) Delete(item db.User) (err error) { func (u *user) GetAppViewHistory(uid uint32) (resp []db.AppViewHistory, err error) { resp = make([]db.AppViewHistory, 0) - ids := make([]uint32, 0) - if err = u.DB.Table("app_view_history").Select("max(id) as id").Where("uid = ?", uid).Group("aid").Pluck("id", &ids).Error; err != nil { return } - - if err = u.DB.Table("app_view_history").Select("*").Where("id in (?)", ids).Limit(10).Find(&resp).Error; err != nil { + if err = u.DB.Table("app_view_history").Select("*").Where("id in (?)", ids).Order("created_at desc").Limit(10).Find(&resp).Error; err != nil { return }