From dcbd45c87632095e42905f8d1c562fb1fd522626 Mon Sep 17 00:00:00 2001 From: Lansong <2095621390@qq.com> Date: Fri, 26 Jan 2024 20:29:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E8=BD=AE=E6=92=AD?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E5=9F=BA=E7=A1=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biz/adaptor/server.go | 16 ++ biz/application/service/system.go | 62 +++++- biz/infrastructure/consts/field.go | 17 +- biz/infrastructure/convertor/convertor.go | 34 +++ .../mapper/notification/filter.go | 2 +- biz/infrastructure/mapper/slider/filter.go | 41 ++++ biz/infrastructure/mapper/slider/mongo.go | 201 ++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- provider/provider.go | 2 + provider/wire_gen.go | 5 +- 11 files changed, 367 insertions(+), 19 deletions(-) create mode 100644 biz/infrastructure/mapper/slider/filter.go create mode 100644 biz/infrastructure/mapper/slider/mongo.go diff --git a/biz/adaptor/server.go b/biz/adaptor/server.go index a9c69ec..7333396 100644 --- a/biz/adaptor/server.go +++ b/biz/adaptor/server.go @@ -13,6 +13,22 @@ type SystemServerImpl struct { SystemService service.SystemService } +func (s *SystemServerImpl) GetSliders(ctx context.Context, req *system.GetSlidersReq) (resp *system.GetSlidersResp, err error) { + return s.SystemService.GetSliders(ctx, req) +} + +func (s *SystemServerImpl) CreateSlider(ctx context.Context, req *system.CreateSliderReq) (resp *system.CreateSliderResp, err error) { + return s.SystemService.CreateSlider(ctx, req) +} + +func (s *SystemServerImpl) UpdateSlider(ctx context.Context, req *system.UpdateSliderReq) (resp *system.UpdateSliderResp, err error) { + return s.SystemService.UpdateSlider(ctx, req) +} + +func (s *SystemServerImpl) DeleteSlider(ctx context.Context, req *system.DeleteSliderReq) (resp *system.DeleteSliderResp, err error) { + return s.SystemService.DeleteSlider(ctx, req) +} + func (s *SystemServerImpl) ReadNotifications(ctx context.Context, req *system.ReadNotificationsReq) (res *system.ReadNotificationsResp, err error) { return s.SystemService.ReadNotifications(ctx, req) } diff --git a/biz/application/service/system.go b/biz/application/service/system.go index bd03716..9295e11 100644 --- a/biz/application/service/system.go +++ b/biz/application/service/system.go @@ -4,6 +4,7 @@ import ( "context" "github.com/CloudStriver/cloudmind-system/biz/infrastructure/convertor" notificationmapper "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/notification" + slidermapper "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/slider" "github.com/CloudStriver/go-pkg/utils/pagination/mongop" "github.com/CloudStriver/go-pkg/utils/pconvertor" gensystem "github.com/CloudStriver/service-idl-gen-go/kitex_gen/cloudmind/system" @@ -18,15 +19,62 @@ type SystemService interface { CreateNotification(ctx context.Context, req *gensystem.CreateNotificationReq) (resp *gensystem.CreateNotificationResp, err error) ReadNotifications(ctx context.Context, req *gensystem.ReadNotificationsReq) (resp *gensystem.ReadNotificationsResp, err error) CleanNotification(ctx context.Context, req *gensystem.CleanNotificationReq) (resp *gensystem.CleanNotificationResp, err error) + DeleteSlider(ctx context.Context, req *gensystem.DeleteSliderReq) (resp *gensystem.DeleteSliderResp, err error) + UpdateSlider(ctx context.Context, req *gensystem.UpdateSliderReq) (resp *gensystem.UpdateSliderResp, err error) + CreateSlider(ctx context.Context, req *gensystem.CreateSliderReq) (resp *gensystem.CreateSliderResp, err error) + GetSliders(ctx context.Context, req *gensystem.GetSlidersReq) (resp *gensystem.GetSlidersResp, err error) } type SystemServiceImpl struct { - MongoMapper notificationmapper.INotificationMongoMapper + NotificationMongoMapper notificationmapper.INotificationMongoMapper + SliderMongoMapper slidermapper.ISliderMongoMapper +} + +func (s *SystemServiceImpl) DeleteSlider(ctx context.Context, req *gensystem.DeleteSliderReq) (resp *gensystem.DeleteSliderResp, err error) { + resp = new(gensystem.DeleteSliderResp) + if err = s.SliderMongoMapper.DeleteOne(ctx, req.SliderId); err != nil { + return resp, err + } + return resp, nil +} + +func (s *SystemServiceImpl) UpdateSlider(ctx context.Context, req *gensystem.UpdateSliderReq) (resp *gensystem.UpdateSliderResp, err error) { + resp = new(gensystem.UpdateSliderResp) + if err = s.SliderMongoMapper.UpdateOne(ctx, convertor.SliderToSliderMapper(req.Slider)); err != nil { + return resp, err + } + return resp, nil +} + +func (s *SystemServiceImpl) CreateSlider(ctx context.Context, req *gensystem.CreateSliderReq) (resp *gensystem.CreateSliderResp, err error) { + resp = new(gensystem.CreateSliderResp) + if err = s.SliderMongoMapper.InsertOne(ctx, convertor.SliderToSliderMapper(req.Slider)); err != nil { + return resp, err + } + return resp, nil +} + +func (s *SystemServiceImpl) GetSliders(ctx context.Context, req *gensystem.GetSlidersReq) (resp *gensystem.GetSlidersResp, err error) { + resp = new(gensystem.GetSlidersResp) + p := pconvertor.PaginationOptionsToModelPaginationOptions(req.PaginationOptions) + sliders, total, err := s.SliderMongoMapper.GetSlidersAndCount(ctx, convertor.SliderFilterOptionsToMapper(req.FilterOptions), p, mongop.IdCursorType) + if err != nil { + return resp, err + } + if p.LastToken != nil { + resp.Token = *p.LastToken + } + resp.Sliders = lo.Map[*slidermapper.Slider, *gensystem.Slider](sliders, + func(item *slidermapper.Slider, _ int) *gensystem.Slider { + return convertor.SliderMapperToSlider(item) + }) + resp.Total = total + return resp, nil } func (s *SystemServiceImpl) ReadNotification(ctx context.Context, req *gensystem.ReadNotificationReq) (resp *gensystem.ReadNotificationResp, err error) { resp = new(gensystem.ReadNotificationResp) - if err = s.MongoMapper.ReadNotification(ctx, req.NotificationId); err != nil { + if err = s.NotificationMongoMapper.ReadNotification(ctx, req.NotificationId); err != nil { return resp, err } return resp, nil @@ -35,7 +83,7 @@ func (s *SystemServiceImpl) ReadNotification(ctx context.Context, req *gensystem func (s *SystemServiceImpl) GetNotifications(ctx context.Context, req *gensystem.GetNotificationsReq) (resp *gensystem.GetNotificationsResp, err error) { resp = new(gensystem.GetNotificationsResp) p := pconvertor.PaginationOptionsToModelPaginationOptions(req.PaginationOptions) - notifications, total, err := s.MongoMapper.GetNotificationsAndCount(ctx, convertor.NotificationFilterOptionsToMapper(req.FilterOptions), p, mongop.IdCursorType) + notifications, total, err := s.NotificationMongoMapper.GetNotificationsAndCount(ctx, convertor.NotificationFilterOptionsToMapper(req.FilterOptions), p, mongop.IdCursorType) if err != nil { return resp, err } @@ -52,7 +100,7 @@ func (s *SystemServiceImpl) GetNotifications(ctx context.Context, req *gensystem func (s *SystemServiceImpl) CleanNotification(ctx context.Context, req *gensystem.CleanNotificationReq) (resp *gensystem.CleanNotificationResp, err error) { resp = new(gensystem.CleanNotificationResp) - if err = s.MongoMapper.CleanNotification(ctx, req.UserId); err != nil { + if err = s.NotificationMongoMapper.CleanNotification(ctx, req.UserId); err != nil { return resp, err } return resp, nil @@ -60,7 +108,7 @@ func (s *SystemServiceImpl) CleanNotification(ctx context.Context, req *gensyste func (s *SystemServiceImpl) GetNotificationCount(ctx context.Context, req *gensystem.GetNotificationCountReq) (resp *gensystem.GetNotificationCountResp, err error) { resp = new(gensystem.GetNotificationCountResp) - if resp.Total, err = s.MongoMapper.Count(ctx, convertor.NotificationFilterOptionsToMapper(req.FilterOptions)); err != nil { + if resp.Total, err = s.NotificationMongoMapper.Count(ctx, convertor.NotificationFilterOptionsToMapper(req.FilterOptions)); err != nil { return resp, err } return resp, nil @@ -68,7 +116,7 @@ func (s *SystemServiceImpl) GetNotificationCount(ctx context.Context, req *gensy func (s *SystemServiceImpl) CreateNotification(ctx context.Context, req *gensystem.CreateNotificationReq) (resp *gensystem.CreateNotificationResp, err error) { resp = new(gensystem.CreateNotificationResp) - if err = s.MongoMapper.InsertOne(ctx, convertor.NotificationToNotificationMapper(req.Notification)); err != nil { + if err = s.NotificationMongoMapper.InsertOne(ctx, convertor.NotificationToNotificationMapper(req.Notification)); err != nil { return resp, err } return resp, nil @@ -76,7 +124,7 @@ func (s *SystemServiceImpl) CreateNotification(ctx context.Context, req *gensyst func (s *SystemServiceImpl) ReadNotifications(ctx context.Context, req *gensystem.ReadNotificationsReq) (resp *gensystem.ReadNotificationsResp, err error) { resp = new(gensystem.ReadNotificationsResp) - if err = s.MongoMapper.ReadNotifications(ctx, convertor.NotificationFilterOptionsToMapper(req.FilterOptions)); err != nil { + if err = s.NotificationMongoMapper.ReadNotifications(ctx, convertor.NotificationFilterOptionsToMapper(req.FilterOptions)); err != nil { return resp, err } return resp, nil diff --git a/biz/infrastructure/consts/field.go b/biz/infrastructure/consts/field.go index c6f7ca8..9199a36 100644 --- a/biz/infrastructure/consts/field.go +++ b/biz/infrastructure/consts/field.go @@ -1,11 +1,14 @@ package consts const ( - NotificationId = "_id" - CreateAt = "createAt" - TargetUserId = "targetUserId" - IsRead = "isRead" - UpdateAt = "updateAt" - Type = "type" - TargetType = "targetType" + ID = "_id" + CreateAt = "createAt" + TargetUserId = "targetUserId" + IsRead = "isRead" + UpdateAt = "updateAt" + Type = "type" + TargetType = "targetType" + ImageUrl = "imageUrl" + LinkUrl = "linkUrl" + IsPublic = "isPublic" ) diff --git a/biz/infrastructure/convertor/convertor.go b/biz/infrastructure/convertor/convertor.go index f29374c..1498bbd 100644 --- a/biz/infrastructure/convertor/convertor.go +++ b/biz/infrastructure/convertor/convertor.go @@ -2,6 +2,7 @@ package convertor import ( notificationmapper "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/notification" + slidermapper "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/slider" gensystem "github.com/CloudStriver/service-idl-gen-go/kitex_gen/cloudmind/system" "go.mongodb.org/mongo-driver/bson/primitive" ) @@ -47,3 +48,36 @@ func NotificationFilterOptionsToMapper(in *gensystem.NotificationFilterOptions) OnlyIsRead: in.OnlyIsRead, } } + +func SliderToSliderMapper(in *gensystem.Slider) *slidermapper.Slider { + oid, _ := primitive.ObjectIDFromHex(in.SliderId) + return &slidermapper.Slider{ + ID: oid, + ImageUrl: in.ImageUrl, + LinkUrl: in.LinkUrl, + Type: in.Type, + IsPublic: in.IsPublic, + } +} + +func SliderMapperToSlider(in *slidermapper.Slider) *gensystem.Slider { + return &gensystem.Slider{ + SliderId: in.ID.Hex(), + ImageUrl: in.ImageUrl, + LinkUrl: in.LinkUrl, + Type: in.Type, + IsPublic: in.IsPublic, + CreateTime: in.CreateAt.UnixMilli(), + UpdateTime: in.UpdateAt.UnixMilli(), + } +} + +func SliderFilterOptionsToMapper(in *gensystem.SliderFilterOptions) *slidermapper.FilterOptions { + if in == nil { + return &slidermapper.FilterOptions{} + } + return &slidermapper.FilterOptions{ + OnlyType: in.OnlyType, + OnlyIsPublic: in.OnlyIsPublic, + } +} diff --git a/biz/infrastructure/mapper/notification/filter.go b/biz/infrastructure/mapper/notification/filter.go index 4f67712..154e110 100644 --- a/biz/infrastructure/mapper/notification/filter.go +++ b/biz/infrastructure/mapper/notification/filter.go @@ -58,7 +58,7 @@ func (f *MongoFilter) CheckRange() { if f.OnlyLastId != nil && f.OnlyFirstId != nil { firstId, _ := primitive.ObjectIDFromHex(*f.OnlyFirstId) lastId, _ := primitive.ObjectIDFromHex(*f.OnlyLastId) - f.m[consts.NotificationId] = bson.M{"$gte": firstId, "$lte": lastId} + f.m[consts.ID] = bson.M{"$gte": firstId, "$lte": lastId} } } diff --git a/biz/infrastructure/mapper/slider/filter.go b/biz/infrastructure/mapper/slider/filter.go new file mode 100644 index 0000000..799a810 --- /dev/null +++ b/biz/infrastructure/mapper/slider/filter.go @@ -0,0 +1,41 @@ +package slider + +import ( + "github.com/CloudStriver/cloudmind-system/biz/infrastructure/consts" + "go.mongodb.org/mongo-driver/bson" +) + +type FilterOptions struct { + OnlyType *int64 + OnlyIsPublic *int64 +} + +type MongoFilter struct { + m bson.M + *FilterOptions +} + +func MakeBsonFilter(options *FilterOptions) bson.M { + return (&MongoFilter{ + m: bson.M{}, + FilterOptions: options, + }).toBson() +} + +func (f *MongoFilter) toBson() bson.M { + f.CheckOnlyType() + f.CheckOnlyIsPublic() + return f.m +} + +func (f *MongoFilter) CheckOnlyType() { + if f.OnlyType != nil { + f.m[consts.Type] = *f.OnlyType + } +} + +func (f *MongoFilter) CheckOnlyIsPublic() { + if f.OnlyIsPublic != nil { + f.m[consts.IsPublic] = *f.OnlyIsPublic + } +} diff --git a/biz/infrastructure/mapper/slider/mongo.go b/biz/infrastructure/mapper/slider/mongo.go new file mode 100644 index 0000000..0abbd49 --- /dev/null +++ b/biz/infrastructure/mapper/slider/mongo.go @@ -0,0 +1,201 @@ +package slider + +import ( + "context" + "github.com/CloudStriver/go-pkg/utils/pagination" + "github.com/CloudStriver/go-pkg/utils/pagination/mongop" + "github.com/samber/lo" + "github.com/zeromicro/go-zero/core/mr" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo/options" + "time" + + "github.com/zeromicro/go-zero/core/stores/monc" + + "github.com/CloudStriver/cloudmind-system/biz/infrastructure/config" + "github.com/CloudStriver/cloudmind-system/biz/infrastructure/consts" +) + +const ( + CollectionName = "slider" +) + +const prefixSliderCacheKey = "cache:slider:" + +var _ ISliderMongoMapper = (*MongoMapper)(nil) + +type ( + ISliderMongoMapper interface { + GetSliders(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Slider, int64, error) + CleanSlider(ctx context.Context, userId string) error + Count(ctx context.Context, fopts *FilterOptions) (int64, error) + InsertOne(ctx context.Context, data *Slider) error + GetSlidersAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Slider, int64, error) + UpdateOne(ctx context.Context, data *Slider) error + DeleteOne(ctx context.Context, id string) error + } + Slider struct { + ID primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"` + ImageUrl string `bson:"imageUrl,omitempty" json:"imageUrl,omitempty"` + LinkUrl string `bson:"linkUrl,omitempty" json:"linkUrl,omitempty"` + Type int64 `bson:"type,omitempty" json:"type,omitempty"` + IsPublic int64 `bson:"isPublic,omitempty" json:"isPublic,omitempty"` + UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"` + CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"` + } + MongoMapper struct { + conn *monc.Model + } +) + +func (m *MongoMapper) UpdateOne(ctx context.Context, data *Slider) error { + data.UpdateAt = time.Now() + key := prefixSliderCacheKey + data.ID.Hex() + _, err := m.conn.UpdateByID(ctx, key, data.ID, bson.M{"$set": data}) + return err +} + +func (m *MongoMapper) DeleteOne(ctx context.Context, id string) error { + oid, err := primitive.ObjectIDFromHex(id) + if err != nil { + return consts.ErrInvalidObjectId + } + key := prefixSliderCacheKey + id + _, err = m.conn.DeleteOne(ctx, key, bson.M{consts.ID: oid}) + return err +} +func (m *MongoMapper) GetSlidersAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Slider, int64, error) { + var ( + data []*Slider + count int64 + err1, err2 error + ) + p := mongop.NewMongoPaginator(pagination.NewRawStore(sorter), popts) + + filter := MakeBsonFilter(fopts) + sort, err := p.MakeSortOptions(ctx, filter) + if err != nil { + return nil, 0, err + } + + if err = mr.Finish(func() error { + count, err1 = m.conn.CountDocuments(ctx, filter) + if err1 != nil { + return err1 + } + return nil + }, func() error { + if err2 = m.conn.Find(ctx, &data, filter, &options.FindOptions{ + Sort: sort, + Limit: popts.Limit, + Skip: popts.Offset, + }); err2 != nil { + return err2 + } + // 如果是反向查询,反转数据 + if *popts.Backward { + lo.Reverse(data) + } + if len(data) > 0 { + err2 = p.StoreCursor(ctx, data[0], data[len(data)-1]) + if err2 != nil { + return err2 + } + } + return nil + }); err != nil { + return nil, 0, err + } + + return data, count, nil +} +func (m *MongoMapper) InsertOne(ctx context.Context, data *Slider) error { + if data.ID.IsZero() { + data.ID = primitive.NewObjectID() + } + data.CreateAt = time.Now() + data.UpdateAt = time.Now() + key := prefixSliderCacheKey + data.ID.Hex() + _, err := m.conn.InsertOne(ctx, key, data) + return err +} +func (m *MongoMapper) GetSliders(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Slider, int64, error) { + var data []*Slider + p := mongop.NewMongoPaginator(pagination.NewRawStore(sorter), popts) + + filter := MakeBsonFilter(fopts) + sort, err := p.MakeSortOptions(ctx, filter) + if err != nil { + return nil, 0, err + } + + if err = m.conn.Find(ctx, &data, filter, &options.FindOptions{ + Sort: sort, + Limit: popts.Limit, + Skip: popts.Offset, + }); err != nil { + return nil, 0, err + } + + // 如果是反向查询,反转数据 + if *popts.Backward { + for i := 0; i < len(data)/2; i++ { + data[i], data[len(data)-i-1] = data[len(data)-i-1], data[i] + } + } + if len(data) > 0 { + err = p.StoreCursor(ctx, data[0], data[len(data)-1]) + if err != nil { + return nil, 0, err + } + } + + count, err := m.conn.CountDocuments(ctx, filter) + if err != nil { + return nil, 0, err + } + + return data, count, nil +} + +func (m *MongoMapper) ReadSliders(ctx context.Context, fopts *FilterOptions) error { + filter := MakeBsonFilter(fopts) + if _, err := m.conn.UpdateManyNoCache(ctx, filter, bson.M{"$set": bson.M{consts.IsRead: true, consts.UpdateAt: time.Now()}}); err != nil { + return err + } + return nil +} + +// CleanSlider 清除未读消息 +func (m *MongoMapper) CleanSlider(ctx context.Context, userId string) error { + filter := bson.M{ + consts.TargetUserId: userId, + consts.IsRead: bson.M{"$exists": false}, + } + _, err := m.conn.UpdateManyNoCache(ctx, filter, bson.M{"$set": bson.M{consts.IsRead: true, consts.UpdateAt: time.Now()}}) + return err +} + +func (m *MongoMapper) ReadSlider(ctx context.Context, id string) error { + oid, err := primitive.ObjectIDFromHex(id) + if err != nil { + return consts.ErrInvalidObjectId + } + + key := prefixSliderCacheKey + id + _, err = m.conn.UpdateByID(ctx, key, oid, bson.M{"$set": bson.M{consts.IsRead: true, consts.UpdateAt: time.Now()}}) + return err +} + +func (m *MongoMapper) Count(ctx context.Context, fopts *FilterOptions) (int64, error) { + f := MakeBsonFilter(fopts) + return m.conn.CountDocuments(ctx, f) +} + +func NewSliderModel(config *config.Config) ISliderMongoMapper { + conn := monc.MustNewModel(config.Mongo.URL, config.Mongo.DB, CollectionName, config.CacheConf) + return &MongoMapper{ + conn: conn, + } +} diff --git a/go.mod b/go.mod index 3855fcd..a32c5c2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/CloudStriver/go-pkg v0.0.0-20240117111745-b4ba57a38f44 - github.com/CloudStriver/service-idl-gen-go v0.0.0-20240126111700-aedb548981a5 + github.com/CloudStriver/service-idl-gen-go v0.0.0-20240126122141-e60927663187 github.com/cloudwego/kitex v0.8.0 github.com/google/wire v0.5.0 github.com/kitex-contrib/obs-opentelemetry v0.2.5 diff --git a/go.sum b/go.sum index c4b428f..079c4f3 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CloudStriver/go-pkg v0.0.0-20240117111745-b4ba57a38f44 h1:7exnHSz2LCeghuVDVD8IS+JaPB/bxDJWFEL7xH5L2Tg= github.com/CloudStriver/go-pkg v0.0.0-20240117111745-b4ba57a38f44/go.mod h1:SsAxWs5EIcaDE/0e5buoFOWsM4lTvFZhySkV68+RT3g= -github.com/CloudStriver/service-idl-gen-go v0.0.0-20240126111700-aedb548981a5 h1:efPYIofQwothGJlr+YduBEAgDcsj4oeSg03xZwOLYYY= -github.com/CloudStriver/service-idl-gen-go v0.0.0-20240126111700-aedb548981a5/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= +github.com/CloudStriver/service-idl-gen-go v0.0.0-20240126122141-e60927663187 h1:x4nwoY+7PbBe7GpMeY4svfiz1YepvjIcB6N5L2oyvjg= +github.com/CloudStriver/service-idl-gen-go v0.0.0-20240126122141-e60927663187/go.mod h1:chtR82RvfrjUujTGWROSCNAwF9Lh/U959k34bXIDvBI= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= diff --git a/provider/provider.go b/provider/provider.go index 119c39c..4d71df1 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -1,6 +1,7 @@ package provider import ( + slidermapper "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/slider" "github.com/google/wire" "github.com/CloudStriver/cloudmind-system/biz/application/service" @@ -24,4 +25,5 @@ var InfrastructureSet = wire.NewSet( var MapperSet = wire.NewSet( notificationmapper.NewNotificationModel, + slidermapper.NewSliderModel, ) diff --git a/provider/wire_gen.go b/provider/wire_gen.go index 19143b0..fb3b27f 100644 --- a/provider/wire_gen.go +++ b/provider/wire_gen.go @@ -11,6 +11,7 @@ import ( "github.com/CloudStriver/cloudmind-system/biz/application/service" "github.com/CloudStriver/cloudmind-system/biz/infrastructure/config" "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/notification" + "github.com/CloudStriver/cloudmind-system/biz/infrastructure/mapper/slider" ) // Injectors from wire.go: @@ -21,8 +22,10 @@ func NewSystemServerImpl() (*adaptor.SystemServerImpl, error) { return nil, err } iNotificationMongoMapper := notification.NewNotificationModel(configConfig) + iSliderMongoMapper := slider.NewSliderModel(configConfig) systemServiceImpl := &service.SystemServiceImpl{ - MongoMapper: iNotificationMongoMapper, + NotificationMongoMapper: iNotificationMongoMapper, + SliderMongoMapper: iSliderMongoMapper, } systemServerImpl := &adaptor.SystemServerImpl{ Config: configConfig,