32 lines
881 B
Go
32 lines
881 B
Go
package mongo
|
|
|
|
import (
|
|
"context"
|
|
"finclip-app-manager/domain/repository"
|
|
|
|
"gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo/bson"
|
|
)
|
|
|
|
var _ repository.IAppOperConfigRepo = new(AppOperConfigRepo)
|
|
|
|
type AppOperConfigRepo struct {
|
|
}
|
|
|
|
func (a *AppOperConfigRepo) Insert(ctx context.Context, item repository.AppOperConfig) error {
|
|
return appOperConfigTable.Insert(ctx, item)
|
|
}
|
|
|
|
func (a *AppOperConfigRepo) Update(ctx context.Context, item repository.AppOperConfig) error {
|
|
upInfo := make(map[string]interface{})
|
|
upInfo["auto_review_app"] = item.AutoReviewApp
|
|
upInfo["update_time"] = item.UpdateTime
|
|
|
|
return appTable.UpdateOne(ctx, bson.M{"_id": item.Id}, bson.M{"$set": upInfo})
|
|
}
|
|
|
|
func (a *AppOperConfigRepo) Find(ctx context.Context) (repository.AppOperConfig, error) {
|
|
item := repository.AppOperConfig{}
|
|
err := appTable.GetOne(ctx, bson.M{}, &item)
|
|
return item, err
|
|
}
|