From 2a36928ee5624dafcf99a3f762e4ac2619512a11 Mon Sep 17 00:00:00 2001 From: tx7do Date: Tue, 23 May 2023 10:54:45 +0800 Subject: [PATCH] feat: refactor. --- .../app/core/service/internal/data/attachment.go | 11 ++++++----- .../app/core/service/internal/data/category.go | 6 +++--- blog-backend/app/core/service/internal/data/tag.go | 2 +- blog-backend/app/core/service/internal/data/user.go | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/blog-backend/app/core/service/internal/data/attachment.go b/blog-backend/app/core/service/internal/data/attachment.go index 91ef9d76..f27b4412 100644 --- a/blog-backend/app/core/service/internal/data/attachment.go +++ b/blog-backend/app/core/service/internal/data/attachment.go @@ -2,18 +2,19 @@ package data import ( "context" + "time" + + "github.com/go-kratos/kratos/v2/log" "github.com/tx7do/kratos-utils/entgo" + paging "github.com/tx7do/kratos-utils/pagination" util "github.com/tx7do/kratos-utils/time" + + "kratos-cms/app/core/service/internal/biz" "kratos-cms/app/core/service/internal/data/ent" "kratos-cms/app/core/service/internal/data/ent/comment" - "time" - "github.com/go-kratos/kratos/v2/log" - "kratos-cms/app/core/service/internal/biz" "kratos-cms/gen/api/go/common/pagination" v1 "kratos-cms/gen/api/go/file/service/v1" - - paging "github.com/tx7do/kratos-utils/pagination" ) var _ biz.AttachmentRepo = (*AttachmentRepo)(nil) diff --git a/blog-backend/app/core/service/internal/data/category.go b/blog-backend/app/core/service/internal/data/category.go index 5925f5e7..b8070e4e 100644 --- a/blog-backend/app/core/service/internal/data/category.go +++ b/blog-backend/app/core/service/internal/data/category.go @@ -6,13 +6,13 @@ import ( "github.com/go-kratos/kratos/v2/log" - "kratos-cms/gen/api/go/common/pagination" - "kratos-cms/gen/api/go/content/service/v1" - "kratos-cms/app/core/service/internal/biz" "kratos-cms/app/core/service/internal/data/ent" "kratos-cms/app/core/service/internal/data/ent/category" + "kratos-cms/gen/api/go/common/pagination" + "kratos-cms/gen/api/go/content/service/v1" + "github.com/tx7do/kratos-utils/entgo" paging "github.com/tx7do/kratos-utils/pagination" util "github.com/tx7do/kratos-utils/time" diff --git a/blog-backend/app/core/service/internal/data/tag.go b/blog-backend/app/core/service/internal/data/tag.go index 99dd7246..a4790660 100644 --- a/blog-backend/app/core/service/internal/data/tag.go +++ b/blog-backend/app/core/service/internal/data/tag.go @@ -147,7 +147,7 @@ func (r *TagRepo) Update(ctx context.Context, req *v1.UpdateTagRequest) (*v1.Tag } func (r *TagRepo) Delete(ctx context.Context, req *v1.DeleteTagRequest) (bool, error) { - err := r.data.db.Link. + err := r.data.db.Tag. DeleteOneID(req.GetId()). Exec(ctx) return err != nil, err diff --git a/blog-backend/app/core/service/internal/data/user.go b/blog-backend/app/core/service/internal/data/user.go index 8662dedd..d9933f03 100644 --- a/blog-backend/app/core/service/internal/data/user.go +++ b/blog-backend/app/core/service/internal/data/user.go @@ -7,13 +7,13 @@ import ( "github.com/go-kratos/kratos/v2/log" "github.com/tx7do/kratos-utils/crypto" "github.com/tx7do/kratos-utils/entgo" + paging "github.com/tx7do/kratos-utils/pagination" util "github.com/tx7do/kratos-utils/time" "kratos-cms/app/core/service/internal/biz" "kratos-cms/app/core/service/internal/data/ent" "kratos-cms/app/core/service/internal/data/ent/user" - paging "github.com/tx7do/kratos-utils/pagination" "kratos-cms/gen/api/go/common/pagination" v1 "kratos-cms/gen/api/go/user/service/v1" )