Skip to content

Commit

Permalink
feat:更新cloudmind-content (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Love-YeLin authored Jan 15, 2024
1 parent 6826017 commit f56c8ea
Show file tree
Hide file tree
Showing 30 changed files with 991 additions and 883 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
tags: [ "v*.*.*" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
29 changes: 29 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI
on:
push:
branches: [ "main" ]
tags: [ "v*.*.*" ]
pull_request:
branches: [ "main" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- linux-amd64-fmt
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
44 changes: 32 additions & 12 deletions .github/workflows/buidl.yaml → .github/workflows/upgrade.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Upgrade

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
Expand All @@ -14,29 +14,31 @@ on:
branches: [ "main" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: cloudmind-content
REGISTRY: docker.io
USERNAME: lansongxx
# github.repository as <account>/<repo>
IMAGE_NAME: CloudStriver/cloudmind-content
IMAGE_NAME: cloudmind-sts

jobs:
build:

runs-on: ubuntu-latest

outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Bump Version
id: version
run: curl -s https://raw.githubusercontent.com/xh-polaris/chore/main/bump_version.sh | bash -s -- ${{ env.USERNAME }}/${{ env.IMAGE_NAME }}

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
if: github.event_name == 'push'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
Expand All @@ -49,16 +51,34 @@ jobs:
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name == 'push' }}
tags: ${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha,mode=max

deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
steps:
- name: Setup Kubectl
uses: azure/setup-kubectl@v3
with:
version: ${{ vars.KUBE_VERSION }}

- name: Deploy
run: |
mkdir .kube
echo "${{ vars.KUBE_CONFIG }}" > .kube/config
kubectl get deployment ${{ env.IMAGE_NAME }} -n ${{ vars.BASE_TEST_NAMESPACE }} -o yaml |\
sed 's/^\( - image: cloudmind\/${{ env.IMAGE_NAME }}:\).*$/\1${{ needs.build.outputs.version }}/' |\
kubectl apply -f -
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/.idea
/data
/output
<<<<<<< HEAD
etc
=======
>>>>>>> 1614d94c8a1344a30c74ad9847dc271f8381a8a4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WORKDIR /build

ADD go.mod .
ADD go.sum .
RUN go mod tidy
RUN go mod download
COPY . .
RUN sh ./build.sh

Expand Down
85 changes: 50 additions & 35 deletions biz/adaptor/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (

type ContentServerImpl struct {
*config.Config
FileService service.IFileService
PostService service.IPostService
CommentService service.ICommentService
LabelService service.ILabelService
UserService service.UserService
FileService service.IFileService
PostService service.IPostService
LabelService service.ILabelService
UserService service.UserService
}

func (s *ContentServerImpl) DeleteUser(ctx context.Context, req *content.DeleteUserReq) (resp *content.DeleteUserResp, err error) {
Expand Down Expand Up @@ -50,78 +49,94 @@ func (s *ContentServerImpl) GetFolderSize(ctx context.Context, req *content.GetF
return resp, nil
}

func (s *ContentServerImpl) GetFileIsExist(ctx context.Context, req *content.GetFileIsExistReq) (res *content.GetFileIsExistResp, err error) {
func (s *ContentServerImpl) GetFileIsExist(ctx context.Context, req *content.GetFileIsExistReq) (*content.GetFileIsExistResp, error) {
return s.FileService.GetFileIsExist(ctx, req)
}

func (s *ContentServerImpl) GetFile(ctx context.Context, req *content.GetFileReq) (res *content.GetFileResp, err error) {
func (s *ContentServerImpl) GetFile(ctx context.Context, req *content.GetFileReq) (*content.GetFileResp, error) {
return s.FileService.GetFile(ctx, req)
}

func (s *ContentServerImpl) GetFileList(ctx context.Context, req *content.GetFileListReq) (res *content.GetFileListResp, err error) {
func (s *ContentServerImpl) GetFileList(ctx context.Context, req *content.GetFileListReq) (*content.GetFileListResp, error) {
return s.FileService.GetFileList(ctx, req)
}

func (s *ContentServerImpl) GetFileCount(ctx context.Context, req *content.GetFileCountReq) (res *content.GetFileCountResp, err error) {
func (s *ContentServerImpl) GetFileCount(ctx context.Context, req *content.GetFileCountReq) (*content.GetFileCountResp, error) {
return s.FileService.GetFileCount(ctx, req)
}

func (s *ContentServerImpl) UpdateFile(ctx context.Context, req *content.UpdateFileReq) (res *content.UpdateFileResp, err error) {
func (s *ContentServerImpl) UpdateFile(ctx context.Context, req *content.UpdateFileReq) (*content.UpdateFileResp, error) {
return s.FileService.UpdateFile(ctx, req)
}

func (s *ContentServerImpl) MoveFile(ctx context.Context, req *content.MoveFileReq) (res *content.MoveFileResp, err error) {
func (s *ContentServerImpl) MoveFile(ctx context.Context, req *content.MoveFileReq) (*content.MoveFileResp, error) {
return s.FileService.MoveFile(ctx, req)
}

func (s *ContentServerImpl) GetFileBySharingCode(ctx context.Context, req *content.GetFileBySharingCodeReq) (res *content.GetFileBySharingCodeResp, err error) {
func (s *ContentServerImpl) GetFileBySharingCode(ctx context.Context, req *content.GetFileBySharingCodeReq) (*content.GetFileBySharingCodeResp, error) {
return s.FileService.GetFileBySharingCode(ctx, req)
}

func (s *ContentServerImpl) CreateFolder(ctx context.Context, req *content.CreateFolderReq) (*content.CreateFolderResp, error) {
return s.FileService.CreateFolder(ctx, req)
}

//func (s *ContentServerImpl) UploadFile(ctx context.Context, req *content.UploadFileReq) (res *content.UploadFileResp, err error) {
// return s.FileService.UploadFile(ctx, req)
//}

func (s *ContentServerImpl) AskUploadFile(ctx context.Context, req *content.AskUploadFileReq) (res *content.AskUploadFileResp, err error) {
return s.FileService.AskUploadFile(ctx, req)
}

func (s *ContentServerImpl) AskUploadFileRollback(ctx context.Context, req *content.AskUploadFileReq) (res *content.AskUploadFileResp, err error) {
return s.FileService.AskUploadFileRollback(ctx, req)
}

func (s *ContentServerImpl) DeleteFile(ctx context.Context, req *content.DeleteFileReq) (res *content.DeleteFileResp, err error) {
func (s *ContentServerImpl) DeleteFile(ctx context.Context, req *content.DeleteFileReq) (*content.DeleteFileResp, error) {
return s.FileService.DeleteFile(ctx, req)
}

func (s *ContentServerImpl) DeleteShareFile(ctx context.Context, req *content.DeleteShareFileReq) (res *content.DeleteShareFileResp, err error) {
return s.FileService.DeleteShareFile(ctx, req)
}

func (s *ContentServerImpl) DeleteExpiredFiles(ctx context.Context, req *content.DeleteExpiredFilesReq) (res *content.DeleteExpiredFilesResp, err error) {
func (s *ContentServerImpl) DeleteExpiredFiles(ctx context.Context, req *content.DeleteExpiredFilesReq) (*content.DeleteExpiredFilesResp, error) {
return s.FileService.DeleteExpiredFiles(ctx, req)
}

func (s *ContentServerImpl) DeleteExpiredShareCodes(ctx context.Context, req *content.DeleteExpiredShareCodesReq) (res *content.DeleteExpiredShareCodesResp, err error) {
func (s *ContentServerImpl) DeleteExpiredShareCodes(ctx context.Context, req *content.DeleteExpiredShareCodesReq) (*content.DeleteExpiredShareCodesResp, error) {
return s.FileService.DeleteExpiredShareCodes(ctx, req)
}

func (s *ContentServerImpl) GetLabel(ctx context.Context, req *content.GetLabelReq) (res *content.GetLabelResp, err error) {
func (s *ContentServerImpl) GetLabel(ctx context.Context, req *content.GetLabelReq) (*content.GetLabelResp, error) {
return s.LabelService.GetLabel(ctx, req)
}

func (s *ContentServerImpl) CreateLabel(ctx context.Context, req *content.CreateLabelReq) (res *content.CreateLabelResp, err error) {
func (s *ContentServerImpl) CreateLabel(ctx context.Context, req *content.CreateLabelReq) (*content.CreateLabelResp, error) {
return s.LabelService.CreateLabel(ctx, req)
}

func (s *ContentServerImpl) UpdateLabel(ctx context.Context, req *content.UpdateLabelReq) (res *content.UpdateLabelResp, err error) {
func (s *ContentServerImpl) UpdateLabel(ctx context.Context, req *content.UpdateLabelReq) (*content.UpdateLabelResp, error) {
return s.LabelService.UpdateLabel(ctx, req)
}

func (s *ContentServerImpl) DeleteLabel(ctx context.Context, req *content.DeleteLabelReq) (res *content.DeleteLabelResp, err error) {
func (s *ContentServerImpl) DeleteLabel(ctx context.Context, req *content.DeleteLabelReq) (*content.DeleteLabelResp, error) {
return s.LabelService.DeleteLabel(ctx, req)
}

func (s *ContentServerImpl) GetShareList(ctx context.Context, req *content.GetShareListReq) (*content.GetShareListResp, error) {
return s.FileService.GetShareList(ctx, req)
}

func (s *ContentServerImpl) CreateShareCode(ctx context.Context, req *content.CreateShareCodeReq) (*content.CreateShareCodeResp, error) {
return s.FileService.CreateShareCode(ctx, req)
}

func (s *ContentServerImpl) UpdateShareCode(ctx context.Context, req *content.UpdateShareCodeReq) (*content.UpdateShareCodeResp, error) {
return s.FileService.UpdateShareCode(ctx, req)
}

func (s *ContentServerImpl) DeleteShareCode(ctx context.Context, req *content.DeleteShareCodeReq) (*content.DeleteShareCodeResp, error) {
return s.FileService.DeleteShareCode(ctx, req)
}

func (s *ContentServerImpl) ParsingShareCode(ctx context.Context, req *content.ParsingShareCodeReq) (*content.ParsingShareCodeResp, error) {
return s.FileService.ParsingShareCode(ctx, req)
}

func (s *ContentServerImpl) SaveFileToPrivateSpace(ctx context.Context, req *content.SaveFileToPrivateSpaceReq) (res *content.SaveFileToPrivateSpaceResp, err error) {
return s.FileService.SaveFileToPrivateSpace(ctx, req)
}

func (s *ContentServerImpl) AddFileToPublicSpace(ctx context.Context, req *content.AddFileToPublicSpaceReq) (*content.AddFileToPublicSpaceResp, error) {
return s.FileService.AddFileToPublicSpace(ctx, req)
}

func (s *ContentServerImpl) RecoverRecycleBinFile(ctx context.Context, req *content.RecoverRecycleBinFileReq) (*content.RecoverRecycleBinFileResp, error) {
return s.FileService.RecoverRecycleBinFile(ctx, req)
}
19 changes: 0 additions & 19 deletions biz/application/service/comment.go

This file was deleted.

Loading

0 comments on commit f56c8ea

Please sign in to comment.