commit
bfdccd7b9c
|
|
@ -15,4 +15,9 @@ public class RoleFilter
|
|||
{
|
||||
return new RoleFilter();
|
||||
}
|
||||
|
||||
public bool IsInit()
|
||||
{
|
||||
return Names.IsNullOrEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
/*****************************************************************************
|
||||
Copyright 2024 Written by Jicheng Lu. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
using BotSharp.Core.Infrastructures;
|
||||
|
||||
namespace BotSharp.Core.SideCar.Services;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
/*****************************************************************************
|
||||
Copyright 2024 Written by Jicheng Lu. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
using BotSharp.Abstraction.Conversations.Enums;
|
||||
|
||||
namespace BotSharp.Core.Conversations.Services;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,15 @@ public class RoleService : IRoleService
|
|||
public async Task<IEnumerable<Role>> GetRoles(RoleFilter filter)
|
||||
{
|
||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||
|
||||
var roles = db.GetRoles(filter);
|
||||
if (filter.IsInit() && roles.IsNullOrEmpty())
|
||||
{
|
||||
await RefreshRoles();
|
||||
await Task.Delay(100);
|
||||
roles = db.GetRoles(filter);
|
||||
}
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
/*****************************************************************************
|
||||
Copyright 2024 Written by Jicheng Lu. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
using BotSharp.Abstraction.Infrastructures.Enums;
|
||||
using BotSharp.Abstraction.MLTasks;
|
||||
using BotSharp.Abstraction.Options;
|
||||
|
|
|
|||
Loading…
Reference in a new issue