Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
王性驊 | efff638ab5 | |
王性驊 | 56145d71af |
|
@ -7,7 +7,7 @@ package comment
|
|||
import (
|
||||
"context"
|
||||
|
||||
"app-cloudep-comment-server/gen_result/pb/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/gen_result/pb/comment"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"app-cloudep-comment-server/gen_result/pb/comment"
|
||||
"app-cloudep-comment-server/internal/config"
|
||||
commentServer "app-cloudep-comment-server/internal/server/comment"
|
||||
"app-cloudep-comment-server/internal/svc"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/gen_result/pb/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/internal/config"
|
||||
commentServer "code.30cm.net/digimon/app-cloudep-comment-server/internal/server/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module app-cloudep-comment-server
|
||||
module code.30cm.net/digimon/app-cloudep-comment-server
|
||||
|
||||
go 1.23.4
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package commentlogic
|
|||
import (
|
||||
"context"
|
||||
|
||||
"app-cloudep-comment-server/gen_result/pb/comment"
|
||||
"app-cloudep-comment-server/internal/svc"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/gen_result/pb/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
|
|
@ -7,9 +7,9 @@ package server
|
|||
import (
|
||||
"context"
|
||||
|
||||
"app-cloudep-comment-server/gen_result/pb/comment"
|
||||
commentlogic "app-cloudep-comment-server/internal/logic/comment"
|
||||
"app-cloudep-comment-server/internal/svc"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/gen_result/pb/comment"
|
||||
commentlogic "code.30cm.net/digimon/app-cloudep-comment-server/internal/logic/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/internal/svc"
|
||||
)
|
||||
|
||||
type CommentServer struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package svc
|
||||
|
||||
import "app-cloudep-comment-server/internal/config"
|
||||
import "code.30cm.net/digimon/app-cloudep-comment-server/internal/config"
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"app-cloudep-comment-server/pkg/domain/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/comment"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"app-cloudep-comment-server/pkg/domain/comment"
|
||||
"app-cloudep-comment-server/pkg/domain/entity"
|
||||
"context"
|
||||
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/entity"
|
||||
)
|
||||
|
||||
type CommentRepository interface {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
package mock
|
||||
|
||||
import (
|
||||
entity "app-cloudep-comment-server/pkg/domain/entity"
|
||||
repository "app-cloudep-comment-server/pkg/domain/repository"
|
||||
entity "code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/entity"
|
||||
repository "code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/repository"
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"app-cloudep-comment-server/pkg/domain"
|
||||
"app-cloudep-comment-server/pkg/domain/entity"
|
||||
"app-cloudep-comment-server/pkg/domain/repository"
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/entity"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/repository"
|
||||
|
||||
mgo "code.30cm.net/digimon/library-go/mongo"
|
||||
"github.com/zeromicro/go-zero/core/stores/cache"
|
||||
"github.com/zeromicro/go-zero/core/stores/mon"
|
||||
|
@ -109,7 +110,12 @@ func (repo *CommentRepository) ListComments(ctx context.Context, req repository.
|
|||
filter := bson.M{}
|
||||
if req.ParentID != nil {
|
||||
filter["parent_comment_id"] = req.ParentID
|
||||
} else {
|
||||
filter["parent_comment_id"] = bson.M{
|
||||
"$in": []interface{}{"", nil},
|
||||
}
|
||||
}
|
||||
|
||||
if req.ReferenceID != nil {
|
||||
filter["reference_id"] = req.ReferenceID
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package repository
|
||||
|
||||
import (
|
||||
"app-cloudep-comment-server/pkg/domain/entity"
|
||||
"app-cloudep-comment-server/pkg/domain/repository"
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/entity"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/repository"
|
||||
|
||||
mgo "code.30cm.net/digimon/library-go/mongo"
|
||||
"github.com/alicebob/miniredis/v2"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package usecase
|
||||
|
||||
import (
|
||||
"app-cloudep-comment-server/pkg/domain"
|
||||
"app-cloudep-comment-server/pkg/domain/comment"
|
||||
"app-cloudep-comment-server/pkg/domain/entity"
|
||||
"app-cloudep-comment-server/pkg/domain/repository"
|
||||
"app-cloudep-comment-server/pkg/domain/usecase"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/entity"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/repository"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/usecase"
|
||||
|
||||
"github.com/golang/snappy"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
package usecase
|
||||
|
||||
import (
|
||||
"app-cloudep-comment-server/pkg/domain/comment"
|
||||
"app-cloudep-comment-server/pkg/domain/entity"
|
||||
"app-cloudep-comment-server/pkg/domain/repository"
|
||||
"app-cloudep-comment-server/pkg/domain/usecase"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/comment"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/entity"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/repository"
|
||||
"code.30cm.net/digimon/app-cloudep-comment-server/pkg/domain/usecase"
|
||||
|
||||
"github.com/golang/snappy"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
mockRepo "app-cloudep-comment-server/pkg/mock/repository"
|
||||
err "app-cloudep-comment-server/pkg/repository"
|
||||
mockRepo "code.30cm.net/digimon/app-cloudep-comment-server/pkg/mock/repository"
|
||||
err "code.30cm.net/digimon/app-cloudep-comment-server/pkg/repository"
|
||||
)
|
||||
|
||||
func TestCommentUseCase_CreateCommentItem(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue