Skip to content

Commit bc661a9

Browse files
committed
refactor: Update list initialization syntax and improve code formatting in various services
1 parent f2d5ac3 commit bc661a9

File tree

7 files changed

+46
-46
lines changed

7 files changed

+46
-46
lines changed

build/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ internal static class Program
1616
private const string nugetSource = "https://api.nuget.org/v3/index.json";
1717
private const string envVarMissing = " environment variable is missing. Aborting.";
1818

19-
private static readonly IList<string> packableProjects = new List<string>{
19+
private static readonly IList<string> packableProjects = [
2020
"OpenIddict.UI.Suite.Core",
2121
"OpenIddict.UI.Suite.Api",
2222
"OpenIddict.UI.Infrastructure",
2323
"OpenIddict.UI.Api",
2424
"OpenIddict.UI.Identity.Core",
2525
"OpenIddict.UI.Identity.Infrastructure",
2626
"OpenIddict.UI.Identity.Api"
27-
};
27+
];
2828

2929
private static class Targets
3030
{

samples/Server/ConfigureServices.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ string environmentName
7474
});
7575
}
7676

77-
services.AddOpenIddict()
78-
// Register the OpenIddict core components.
77+
services.AddOpenIddict()
78+
// Register the OpenIddict core components.
7979
.AddCore(options =>
8080
{
8181
options.UseEntityFrameworkCore();
8282
if (!Helpers.Constants.IsTestingEnvironment(environmentName))
8383
{
8484
options.UseQuartz();
8585
}
86-
})
87-
// Register the OpenIddict server components.
86+
})
87+
// Register the OpenIddict server components.
8888
.AddServer(options =>
8989
{
9090
options.SetIssuer(new Uri("https://localhost:5001/"));
@@ -139,17 +139,17 @@ string environmentName
139139
{
140140
options.DisableAccessTokenEncryption();
141141
}
142-
})
143-
// Register the OpenIddict validation components.
142+
})
143+
// Register the OpenIddict validation components.
144144
.AddValidation(options =>
145145
{
146146
// Import the configuration from the local OpenIddict server instance.
147147
options.UseLocalServer();
148148

149149
// Register the ASP.NET Core host.
150150
options.UseAspNetCore();
151-
})
152-
// Register the EF based UI Store for OpenIddict related entities.
151+
})
152+
// Register the EF based UI Store for OpenIddict related entities.
153153
.AddUIStore(options =>
154154
{
155155
options.OpenIddictUIContext = builder =>
@@ -164,8 +164,8 @@ string environmentName
164164
.Name);
165165
});
166166
};
167-
})
168-
// Register the APIs for the EF based UI Store based on OpenIddict.
167+
})
168+
// Register the APIs for the EF based UI Store based on OpenIddict.
169169
.AddUIApis(options =>
170170
{
171171
// Tell the system about the allowed Permissions it is built/configured for.
@@ -185,8 +185,8 @@ string environmentName
185185
Permissions.Prefixes.Scope + "server_scope",
186186
Permissions.Prefixes.Scope + "api_scope"
187187
];
188-
})
189-
// Register the EF based UI Store for the ASP.NET Identity related entities.
188+
})
189+
// Register the EF based UI Store for the ASP.NET Identity related entities.
190190
.AddUIIdentityStore<ApplicationUser>(options =>
191191
{
192192
options.OpenIddictUIIdentityContext = builder =>
@@ -201,8 +201,8 @@ string environmentName
201201
.Name);
202202
});
203203
};
204-
})
205-
// Register the APIs for the EF based UI Store based on ASP.NET Identity.
204+
})
205+
// Register the APIs for the EF based UI Store based on ASP.NET Identity.
206206
.AddUIIdentityApis<ApplicationUser>();
207207

208208
if (!Helpers.Constants.IsTestingEnvironment(environmentName))
@@ -231,12 +231,12 @@ string environmentName
231231
{
232232
if (api.GroupName != null)
233233
{
234-
return new[] { api.GroupName };
234+
return [api.GroupName];
235235
}
236236

237237
if (api.ActionDescriptor is ControllerActionDescriptor controllerActionDescriptor)
238238
{
239-
return new[] { controllerActionDescriptor.ControllerName };
239+
return [controllerActionDescriptor.ControllerName];
240240
}
241241

242242
throw new InvalidOperationException("Unable to determine tag for endpoint.");

src/identity/OpenIddict.UI.Identity.Api/Account/AccountApiService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace tomware.OpenIddict.UI.Identity.Api;
1010

1111
public interface IAccountApiService
1212
{
13-
Task<IdentityResult> RegisterAsync(RegisterUserViewModel model);
14-
Task<IdentityResult> ChangePasswordAsync(ChangePasswordViewModel model);
15-
Task<IEnumerable<UserViewModel>> GetUsersAsync();
16-
Task<UserViewModel> GetUserAsync(string id);
17-
Task<IdentityResult> UpdateAsync(UserViewModel model);
18-
Task<IdentityResult> DeleteAsync(string id);
13+
public Task<IdentityResult> RegisterAsync(RegisterUserViewModel model);
14+
public Task<IdentityResult> ChangePasswordAsync(ChangePasswordViewModel model);
15+
public Task<IEnumerable<UserViewModel>> GetUsersAsync();
16+
public Task<UserViewModel> GetUserAsync(string id);
17+
public Task<IdentityResult> UpdateAsync(UserViewModel model);
18+
public Task<IdentityResult> DeleteAsync(string id);
1919
}
2020

2121
public class AccountApiService<TIdentityUser, TKey> : IAccountApiService

src/identity/OpenIddict.UI.Identity.Api/ClaimType/ClaimTypeApiService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace tomware.OpenIddict.UI.Identity.Api;
99

1010
public interface IClaimTypeApiService
1111
{
12-
Task<IEnumerable<ClaimTypeViewModel>> GetClaimTypesAsync();
12+
public Task<IEnumerable<ClaimTypeViewModel>> GetClaimTypesAsync();
1313

14-
Task<ClaimTypeViewModel> GetAsync(Guid id);
14+
public Task<ClaimTypeViewModel> GetAsync(Guid id);
1515

16-
Task<Guid> CreateAsync(ClaimTypeViewModel model);
16+
public Task<Guid> CreateAsync(ClaimTypeViewModel model);
1717

18-
Task UpdateAsync(ClaimTypeViewModel model);
18+
public Task UpdateAsync(ClaimTypeViewModel model);
1919

20-
Task DeleteAsync(Guid id);
20+
public Task DeleteAsync(Guid id);
2121
}
2222

2323
public class ClaimTypeApiService : IClaimTypeApiService

src/identity/OpenIddict.UI.Identity.Api/Role/RoleApiService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ namespace tomware.OpenIddict.UI.Identity.Api;
88

99
public interface IRoleApiService
1010
{
11-
Task<IEnumerable<RoleViewModel>> GetRolesAsync();
11+
public Task<IEnumerable<RoleViewModel>> GetRolesAsync();
1212

13-
Task<RoleViewModel> GetAsync(string id);
13+
public Task<RoleViewModel> GetAsync(string id);
1414

15-
Task<string> CreateAsync(RoleViewModel model);
15+
public Task<string> CreateAsync(RoleViewModel model);
1616

17-
Task UpdateAsync(RoleViewModel model);
17+
public Task UpdateAsync(RoleViewModel model);
1818

19-
Task DeleteAsync(string id);
19+
public Task DeleteAsync(string id);
2020
}
2121

2222
public class RoleApiService<TIdentityRole, TKey> : IRoleApiService

src/openiddict/OpenIddict.UI.Api/Application/ApplicationApiService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ namespace tomware.OpenIddict.UI.Api;
99

1010
public interface IApplicationApiService
1111
{
12-
Task<IEnumerable<ApplicationViewModel>> GetApplicationsAsync();
12+
public Task<IEnumerable<ApplicationViewModel>> GetApplicationsAsync();
1313

14-
Task<ApplicationViewModel> GetAsync(string clientId);
14+
public Task<ApplicationViewModel> GetAsync(string clientId);
1515

16-
Task<string> CreateAsync(ApplicationViewModel model);
16+
public Task<string> CreateAsync(ApplicationViewModel model);
1717

18-
Task UpdateAsync(ApplicationViewModel model);
18+
public Task UpdateAsync(ApplicationViewModel model);
1919

20-
Task DeleteAsync(string clientId);
20+
public Task DeleteAsync(string clientId);
2121

22-
Task<ApplicationOptionsViewModel> GetOptionsAsync();
22+
public Task<ApplicationOptionsViewModel> GetOptionsAsync();
2323
}
2424

2525
public class ApplicationApiService : IApplicationApiService

src/openiddict/OpenIddict.UI.Api/Scope/ScopeService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ namespace tomware.OpenIddict.UI.Api;
99

1010
public interface IScopeApiService
1111
{
12-
Task<IEnumerable<ScopeViewModel>> GetScopesAsync();
12+
public Task<IEnumerable<ScopeViewModel>> GetScopesAsync();
1313

14-
Task<IEnumerable<string>> GetScopeNamesAsync();
14+
public Task<IEnumerable<string>> GetScopeNamesAsync();
1515

16-
Task<ScopeViewModel> GetAsync(string id);
16+
public Task<ScopeViewModel> GetAsync(string id);
1717

18-
Task<string> CreateAsync(ScopeViewModel model);
18+
public Task<string> CreateAsync(ScopeViewModel model);
1919

20-
Task UpdateAsync(ScopeViewModel model);
20+
public Task UpdateAsync(ScopeViewModel model);
2121

22-
Task DeleteAsync(string id);
22+
public Task DeleteAsync(string id);
2323
}
2424

2525
public class ScopeApiService : IScopeApiService

0 commit comments

Comments
 (0)