|
@@ -57,7 +57,8 @@ func (l *CreateDepartmentLogic) CreateDepartment(req *types.DepartmentInfo) (res
|
|
|
PromotionRate: int32(15),
|
|
|
Timezone: "Asia/Shanghai",
|
|
|
}
|
|
|
- err = l.svcCtx.MongoModel.UsersModel.Insert(context.TODO(), user_info)
|
|
|
+ usersModel := users.NewUsersModel(l.svcCtx.Config.FastgptMongoConf.Url, l.svcCtx.Config.FastgptMongoConf.DBName, "users")
|
|
|
+ err = usersModel.Insert(context.TODO(), user_info)
|
|
|
if err != nil {
|
|
|
return nil, errorx.NewInvalidArgumentError("fastgpt create failed " + err.Error())
|
|
|
}
|
|
@@ -71,8 +72,8 @@ func (l *CreateDepartmentLogic) CreateDepartment(req *types.DepartmentInfo) (res
|
|
|
CreateTime: time.Date(2024, 7, 10, 12, 0, 18, 197000000, time.UTC),
|
|
|
Balance: int32(999900000),
|
|
|
}
|
|
|
-
|
|
|
- err = l.svcCtx.MongoModel.TeamsModel.Insert(context.TODO(), teams_info)
|
|
|
+ teamsModel := teams.NewTeamsModel(l.svcCtx.Config.FastgptMongoConf.Url, l.svcCtx.Config.FastgptMongoConf.DBName, "teams")
|
|
|
+ err = teamsModel.Insert(context.TODO(), teams_info)
|
|
|
if err != nil {
|
|
|
return nil, errorx.NewInvalidArgumentError("fastgpt create failed " + err.Error())
|
|
|
}
|
|
@@ -88,8 +89,8 @@ func (l *CreateDepartmentLogic) CreateDepartment(req *types.DepartmentInfo) (res
|
|
|
DefaultTeam: true,
|
|
|
Version: int32(0),
|
|
|
}
|
|
|
-
|
|
|
- err = l.svcCtx.MongoModel.TeamMembersModel.Insert(context.TODO(), team_members_info)
|
|
|
+ teamMembersModel := team_members.NewTeamMembersModel(l.svcCtx.Config.FastgptMongoConf.Url, l.svcCtx.Config.FastgptMongoConf.DBName, "team_members")
|
|
|
+ err = teamMembersModel.Insert(context.TODO(), team_members_info)
|
|
|
if err != nil {
|
|
|
return nil, errorx.NewInvalidArgumentError("fastgpt create failed " + err.Error())
|
|
|
}
|
|
@@ -331,8 +332,9 @@ func (l *CreateDepartmentLogic) CreateDepartment(req *types.DepartmentInfo) (res
|
|
|
ScheduledTriggerConfig: nil,
|
|
|
ScheduledTriggerNextTime: nil,
|
|
|
}
|
|
|
+ appsModel := apps.NewAppsModel(l.svcCtx.Config.FastgptMongoConf.Url, l.svcCtx.Config.FastgptMongoConf.DBName, "apps")
|
|
|
|
|
|
- err = l.svcCtx.MongoModel.AppsModel.Insert(context.TODO(), apps_info)
|
|
|
+ err = appsModel.Insert(context.TODO(), apps_info)
|
|
|
if err != nil {
|
|
|
return nil, errorx.NewInvalidArgumentError("fastgpt create failed " + err.Error())
|
|
|
}
|