Skip to content

Commit

Permalink
Merge branch 'main' of github.com:CloudStriver/cloudmind-content into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
Lansongxx committed Apr 15, 2024
2 parents 80a1475 + d202628 commit 58633d4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 29 deletions.
36 changes: 19 additions & 17 deletions biz/application/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ func (s *UserService) GetUser(ctx context.Context, req *gencontent.GetUserReq) (
return resp, err
}
return &gencontent.GetUserResp{
Name: user.Name,
Sex: user.Sex,
FullName: user.FullName,
IdCard: user.IdCard,
Description: user.Description,
Url: user.Url,
CreateTime: user.CreateAt.UnixMilli(),
UpdateTime: user.UpdateAt.UnixMilli(),
Labels: user.Labels,
Name: user.Name,
Sex: user.Sex,
FullName: user.FullName,
IdCard: user.IdCard,
Description: user.Description,
Url: user.Url,
CreateTime: user.CreateAt.UnixMilli(),
UpdateTime: user.UpdateAt.UnixMilli(),
Labels: user.Labels,
BackgroundUrl: user.BackgroundUrl,
}, nil
}

Expand All @@ -117,14 +118,15 @@ func (s *UserService) CreateUser(ctx context.Context, req *gencontent.CreateUser
func (s *UserService) UpdateUser(ctx context.Context, req *gencontent.UpdateUserReq) (resp *gencontent.UpdateUserResp, err error) {
oid, _ := primitive.ObjectIDFromHex(req.UserId)
if _, err = s.UserMongoMapper.Update(ctx, &usermapper.User{
ID: oid,
Name: req.Name,
Sex: req.Sex,
FullName: req.FullName,
IdCard: req.IdCard,
Description: req.Description,
Url: req.Url,
Labels: req.Labels,
ID: oid,
Name: req.Name,
Sex: req.Sex,
FullName: req.FullName,
IdCard: req.IdCard,
Description: req.Description,
Url: req.Url,
Labels: req.Labels,
BackgroundUrl: req.BackgroundUrl,
}); err != nil {
return resp, err
}
Expand Down
23 changes: 12 additions & 11 deletions biz/infrastructure/mapper/user/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ type (
FindManyByIds(ctx context.Context, ids []string) ([]*User, error)
}
User struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
Sex int64 `bson:"sex,omitempty" json:"sex,omitempty"`
FullName string `bson:"fullName,omitempty" json:"fullName,omitempty"`
IdCard string `bson:"idCard,omitempty" json:"idCard,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
Url string `bson:"url,omitempty" json:"url,omitempty"`
UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`
Labels []string `bson:"labels,omitempty" json:"labels,omitempty"`
Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"`
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Name string `bson:"name,omitempty" json:"name,omitempty"`
Sex int64 `bson:"sex,omitempty" json:"sex,omitempty"`
FullName string `bson:"fullName,omitempty" json:"fullName,omitempty"`
IdCard string `bson:"idCard,omitempty" json:"idCard,omitempty"`
Description string `bson:"description,omitempty" json:"description,omitempty"`
Url string `bson:"url,omitempty" json:"url,omitempty"`
BackgroundUrl string `bson:"backgroundUrl,omitempty" json:"backgroundUrl,omitempty"`
UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`
Labels []string `bson:"labels,omitempty" json:"labels,omitempty"`
Score_ float64 `bson:"_score,omitempty" json:"_score,omitempty"`
}

MongoMapper struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/CloudStriver/cloudmind-mq v1.0.12-0.20240411042341-53be6a32a1ac
github.com/CloudStriver/go-pkg v0.0.0-20240329084540-20ca37a52fea
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412035535-b11df688dcda
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240415063135-d3955d0682e0
github.com/bytedance/sonic v1.10.2
github.com/cloudwego/kitex v0.8.0
github.com/elastic/go-elasticsearch/v8 v8.11.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412033032-028d45340c2f h1
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412033032-028d45340c2f/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412035535-b11df688dcda h1:iHiWtcp1r3bOilaaK2rbARfxPtujVWcDo+UHdkpWB3Q=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240412035535-b11df688dcda/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240415063135-d3955d0682e0 h1:daaQ68hELBrjQW++Sw2ztgqr61FVhtJBjT0UI74CAhk=
github.com/CloudStriver/service-idl-gen-go v0.0.0-20240415063135-d3955d0682e0/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down

0 comments on commit 58633d4

Please sign in to comment.