Skip to content

Commit 4aeaa46

Browse files
committed
Run code cleanup
1 parent b498ce4 commit 4aeaa46

File tree

100 files changed

+4127
-4133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+4127
-4133
lines changed

AdvancedTodoList.Application/Dtos/TodoListDtos.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using AdvancedTodoList.Application.Dtos;
2-
3-
namespace AdvancedTodoList.Application.Dtos;
1+
namespace AdvancedTodoList.Application.Dtos;
42

53
/// <summary>
64
/// DTO for creating/editing a to-do list.
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
using AdvancedTodoList.Application.Dtos;
2-
using AdvancedTodoList.Core.Models.TodoLists;
1+
using AdvancedTodoList.Core.Models.TodoLists;
32

43
namespace AdvancedTodoList.Application.Dtos;
54

65
/// <summary>
76
/// DTO for creating/editing a to-do list item.
87
/// </summary>
98
public record TodoItemCreateDto(
10-
string Name, string Description, DateTime? DeadlineDate,
11-
int Priority, int? CategoryId
12-
);
9+
string Name, string Description, DateTime? DeadlineDate,
10+
int Priority, int? CategoryId
11+
);
1312

1413
/// <summary>
1514
/// DTO for changing the state of a to-do list item.
@@ -20,19 +19,19 @@ public record TodoItemUpdateStateDto(TodoItemState State);
2019
/// DTO for a full view of a to-do list item.
2120
/// </summary>
2221
public record TodoItemGetByIdDto(
23-
int Id, string TodoListId, string Name,
24-
string Description, DateTime? DeadlineDate,
25-
TodoItemState State, int Priority,
26-
ApplicationUserPreviewDto Owner,
27-
TodoItemCategoryViewDto? Category
28-
);
22+
int Id, string TodoListId, string Name,
23+
string Description, DateTime? DeadlineDate,
24+
TodoItemState State, int Priority,
25+
ApplicationUserPreviewDto Owner,
26+
TodoItemCategoryViewDto? Category
27+
);
2928

3029
/// <summary>
3130
/// DTO for a partial view of a to-do list item.
3231
/// </summary>
3332
public record TodoItemPreviewDto(
34-
int Id, string TodoListId, string Name,
35-
DateTime? DeadlineDate, TodoItemState State,
36-
int Priority, ApplicationUserPreviewDto Owner,
37-
TodoItemCategoryViewDto? Category
38-
);
33+
int Id, string TodoListId, string Name,
34+
DateTime? DeadlineDate, TodoItemState State,
35+
int Priority, ApplicationUserPreviewDto Owner,
36+
TodoItemCategoryViewDto? Category
37+
);

AdvancedTodoList.Application/Dtos/TodoListMembersDtos.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using AdvancedTodoList.Application.Dtos;
2-
3-
namespace AdvancedTodoList.Application.Dtos;
1+
namespace AdvancedTodoList.Application.Dtos;
42

53
/// <summary>
64
/// DTO for a minimal view of a to-do list member.

AdvancedTodoList.Application/Services/Definitions/Auth/IAccessTokensService.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ namespace AdvancedTodoList.Application.Services.Definitions.Auth;
77
/// </summary>
88
public interface IAccessTokensService
99
{
10-
/// <summary>
11-
/// Generates an access token for the user.
12-
/// </summary>
13-
/// <param name="user">User which will receive an access token.</param>
14-
/// <returns>
15-
/// A string that represents an access token.
16-
/// </returns>
17-
string GenerateAccessToken(ApplicationUser user);
10+
/// <summary>
11+
/// Generates an access token for the user.
12+
/// </summary>
13+
/// <param name="user">User which will receive an access token.</param>
14+
/// <returns>
15+
/// A string that represents an access token.
16+
/// </returns>
17+
string GenerateAccessToken(ApplicationUser user);
1818

19-
/// <summary>
20-
/// Validates an access token without checking expiration time and then returns
21-
/// ID of the user stored in it asynchronously.
22-
/// </summary>
23-
/// <param name="accessToken">A string that represents an access token.</param>
24-
/// <returns>
25-
/// A user ID retrieved from the access token or <see langword="null" />, if validation failed.
26-
/// </returns>
27-
Task<string?> GetUserIdFromExpiredTokenAsync(string accessToken);
19+
/// <summary>
20+
/// Validates an access token without checking expiration time and then returns
21+
/// ID of the user stored in it asynchronously.
22+
/// </summary>
23+
/// <param name="accessToken">A string that represents an access token.</param>
24+
/// <returns>
25+
/// A user ID retrieved from the access token or <see langword="null" />, if validation failed.
26+
/// </returns>
27+
Task<string?> GetUserIdFromExpiredTokenAsync(string accessToken);
2828
}

AdvancedTodoList.Application/Services/Definitions/Auth/IAuthService.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@ namespace AdvancedTodoList.Application.Services.Definitions.Auth;
77
/// </summary>
88
public interface IAuthService
99
{
10-
/// <summary>
11-
/// Logs a user in asynchronously.
12-
/// </summary>
13-
/// <param name="logInDto">Data required for logging in.</param>
14-
/// <returns>
15-
/// Returns a task representing the asynchronous operation, containing a
16-
/// response with access and refresh tokens or null if authorization fails.
17-
/// </returns>
18-
Task<LogInResponse?> LogInAsync(LogInDto logInDto);
10+
/// <summary>
11+
/// Logs a user in asynchronously.
12+
/// </summary>
13+
/// <param name="logInDto">Data required for logging in.</param>
14+
/// <returns>
15+
/// Returns a task representing the asynchronous operation, containing a
16+
/// response with access and refresh tokens or null if authorization fails.
17+
/// </returns>
18+
Task<LogInResponse?> LogInAsync(LogInDto logInDto);
1919

20-
/// <summary>
21-
/// Registers a new user asynchronously.
22-
/// </summary>
23-
/// <param name="registerDto">Data required for user registration.</param>
24-
/// <returns>
25-
/// Returns a task representing the asynchronous operation, containing the registration result.
26-
/// </returns>
27-
Task<RegisterResult> RegisterAsync(RegisterDto registerDto);
20+
/// <summary>
21+
/// Registers a new user asynchronously.
22+
/// </summary>
23+
/// <param name="registerDto">Data required for user registration.</param>
24+
/// <returns>
25+
/// Returns a task representing the asynchronous operation, containing the registration result.
26+
/// </returns>
27+
Task<RegisterResult> RegisterAsync(RegisterDto registerDto);
2828

29-
/// <summary>
30-
/// Refreshes the access token asynchronously.
31-
/// </summary>
32-
/// <param name="refreshDto">Data required for token refresh.</param>
33-
/// <returns>
34-
/// Returns a task representing the asynchronous operation,
35-
/// containing a response with access and refresh tokens or null if authorization fails.
36-
/// </returns>
37-
Task<LogInResponse?> RefreshAsync(RefreshDto refreshDto);
29+
/// <summary>
30+
/// Refreshes the access token asynchronously.
31+
/// </summary>
32+
/// <param name="refreshDto">Data required for token refresh.</param>
33+
/// <returns>
34+
/// Returns a task representing the asynchronous operation,
35+
/// containing a response with access and refresh tokens or null if authorization fails.
36+
/// </returns>
37+
Task<LogInResponse?> RefreshAsync(RefreshDto refreshDto);
3838

39-
/// <summary>
40-
/// Logs a user out asynchronously by revoking a refresh token.
41-
/// </summary>
42-
/// <param name="userId">ID of the caller.</param>
43-
/// <param name="logOutDto">Data required for logging out.</param>
44-
/// <returns>
45-
/// Returns a task representing the asynchronous operation,
46-
/// indicating the success or failure of the operation.
47-
/// </returns>
48-
Task<bool> LogOutAsync(string userId, LogOutDto logOutDto);
39+
/// <summary>
40+
/// Logs a user out asynchronously by revoking a refresh token.
41+
/// </summary>
42+
/// <param name="userId">ID of the caller.</param>
43+
/// <param name="logOutDto">Data required for logging out.</param>
44+
/// <returns>
45+
/// Returns a task representing the asynchronous operation,
46+
/// indicating the success or failure of the operation.
47+
/// </returns>
48+
Task<bool> LogOutAsync(string userId, LogOutDto logOutDto);
4949
}
Lines changed: 55 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using AdvancedTodoList.Application.Services.Definitions;
2-
using AdvancedTodoList.Core.Models;
1+
using AdvancedTodoList.Core.Models;
32
using AdvancedTodoList.Core.Models.TodoLists.Members;
43

54
namespace AdvancedTodoList.Application.Services.Definitions.Auth;
@@ -9,61 +8,61 @@ namespace AdvancedTodoList.Application.Services.Definitions.Auth;
98
/// </summary>
109
public interface IPermissionsChecker
1110
{
12-
/// <summary>
13-
/// Asynchronously checks whether the user is a member of the to-do list with
14-
/// specified ID.
15-
/// </summary>
16-
/// <param name="context">To-do list context.</param>
17-
/// <returns>
18-
/// <see langword="true" /> if user is a member of the list; otherwise <see langword="false" />.
19-
/// </returns>
20-
Task<bool> IsMemberOfListAsync(TodoListContext context);
11+
/// <summary>
12+
/// Asynchronously checks whether the user is a member of the to-do list with
13+
/// specified ID.
14+
/// </summary>
15+
/// <param name="context">To-do list context.</param>
16+
/// <returns>
17+
/// <see langword="true" /> if user is a member of the list; otherwise <see langword="false" />.
18+
/// </returns>
19+
Task<bool> IsMemberOfListAsync(TodoListContext context);
2120

22-
/// <summary>
23-
/// Asynchronously checks whether the user is a member of the to-do list and
24-
/// has a permission defined by the funciton <paramref name="permission"/>.
25-
/// </summary>
26-
/// <param name="context">To-do list context.</param>
27-
/// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
28-
/// <returns>
29-
/// <see langword="true" /> if user is a member of the list and has required permission;
30-
/// otherwise <see langword="false" />.
31-
/// </returns>
32-
Task<bool> HasPermissionAsync(TodoListContext context, Func<RolePermissions, bool> permission);
21+
/// <summary>
22+
/// Asynchronously checks whether the user is a member of the to-do list and
23+
/// has a permission defined by the funciton <paramref name="permission"/>.
24+
/// </summary>
25+
/// <param name="context">To-do list context.</param>
26+
/// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
27+
/// <returns>
28+
/// <see langword="true" /> if user is a member of the list and has required permission;
29+
/// otherwise <see langword="false" />.
30+
/// </returns>
31+
Task<bool> HasPermissionAsync(TodoListContext context, Func<RolePermissions, bool> permission);
3332

34-
/// <summary>
35-
/// Asynchronously checks whether the user can touch an entity.
36-
/// </summary>
37-
/// <remarks>
38-
/// This method firstly checks whether <paramref name="entity"/> implements <see cref="IHasOwner"/>
39-
/// interface and if yes, checks if the user is the owner of the entity and is a member of the to-do list;
40-
/// otherwise the method checks if user has the permission defined by the function <paramref name="permission"/>.
41-
/// </remarks>
42-
/// <typeparam name="TEntity">Type of the entity.</typeparam>
43-
/// <typeparam name="TKey">Type of the unique identifier used by the entity.</typeparam>
44-
/// <param name="context">To-do list context.</param>
45-
/// <param name="entity">ID of the entity.</param>
46-
/// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
47-
/// <returns>
48-
/// <see langword="true"/> if user is either an owner of the entity and a member of a to-do list,
49-
/// or he/she/they has permission defined by <paramref name="permission"/>; otherwise <see langword="false" />.
50-
/// </returns>
51-
Task<bool> CanTouchEntityAsync<TEntity, TKey>(TodoListContext context, TEntity entity,
52-
Func<RolePermissions, bool> permission)
53-
where TEntity : class, IEntity<TKey>
54-
where TKey : IEquatable<TKey>;
33+
/// <summary>
34+
/// Asynchronously checks whether the user can touch an entity.
35+
/// </summary>
36+
/// <remarks>
37+
/// This method firstly checks whether <paramref name="entity"/> implements <see cref="IHasOwner"/>
38+
/// interface and if yes, checks if the user is the owner of the entity and is a member of the to-do list;
39+
/// otherwise the method checks if user has the permission defined by the function <paramref name="permission"/>.
40+
/// </remarks>
41+
/// <typeparam name="TEntity">Type of the entity.</typeparam>
42+
/// <typeparam name="TKey">Type of the unique identifier used by the entity.</typeparam>
43+
/// <param name="context">To-do list context.</param>
44+
/// <param name="entity">ID of the entity.</param>
45+
/// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
46+
/// <returns>
47+
/// <see langword="true"/> if user is either an owner of the entity and a member of a to-do list,
48+
/// or he/she/they has permission defined by <paramref name="permission"/>; otherwise <see langword="false" />.
49+
/// </returns>
50+
Task<bool> CanTouchEntityAsync<TEntity, TKey>(TodoListContext context, TEntity entity,
51+
Func<RolePermissions, bool> permission)
52+
where TEntity : class, IEntity<TKey>
53+
where TKey : IEquatable<TKey>;
5554

56-
/// <summary>
57-
/// Asynchronously checks whether the user has a permission to change the role
58-
/// with the priority of <paramref name="rolePriority"/>.
59-
/// </summary>
60-
/// <param name="context">To-do list context.</param>
61-
/// <param name="rolePriority">ID of the role.</param>
62-
/// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
63-
/// <returns>
64-
/// <see langword="true"/> if user has <paramref name="permission"/> and highest role priority than
65-
/// the <paramref name="rolePriority"/>; otherwise <see langword="false" />.
66-
/// </returns>
67-
Task<bool> HasPermissionOverRoleAsync(TodoListContext context, int rolePriority,
68-
Func<RolePermissions, bool> permission);
55+
/// <summary>
56+
/// Asynchronously checks whether the user has a permission to change the role
57+
/// with the priority of <paramref name="rolePriority"/>.
58+
/// </summary>
59+
/// <param name="context">To-do list context.</param>
60+
/// <param name="rolePriority">ID of the role.</param>
61+
/// <param name="permission">Function that should return <see langword="true"/> if user has required permission.</param>
62+
/// <returns>
63+
/// <see langword="true"/> if user has <paramref name="permission"/> and highest role priority than
64+
/// the <paramref name="rolePriority"/>; otherwise <see langword="false" />.
65+
/// </returns>
66+
Task<bool> HasPermissionOverRoleAsync(TodoListContext context, int rolePriority,
67+
Func<RolePermissions, bool> permission);
6968
}

AdvancedTodoList.Application/Services/Definitions/Auth/IRefreshTokensService.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@
55
/// </summary>
66
public interface IRefreshTokensService
77
{
8-
/// <summary>
9-
/// Generates a refresh token for the user and saves it asynchronously.
10-
/// </summary>
11-
/// <param name="userId">ID of the user who will receive the token.</param>
12-
/// <returns>
13-
/// A string that represents a refresh token or <see langword="null" /> if user does not exist.
14-
/// </returns>
15-
Task<string?> GenerateAsync(string userId);
8+
/// <summary>
9+
/// Generates a refresh token for the user and saves it asynchronously.
10+
/// </summary>
11+
/// <param name="userId">ID of the user who will receive the token.</param>
12+
/// <returns>
13+
/// A string that represents a refresh token or <see langword="null" /> if user does not exist.
14+
/// </returns>
15+
Task<string?> GenerateAsync(string userId);
1616

17-
/// <summary>
18-
/// Revokes the refresh token of the user asynchronously
19-
/// </summary>
20-
/// <param name="userId">ID of the user whose token is being revoked.</param>
21-
/// <param name="token">Value of the token to be revoked.</param>
22-
/// <returns>
23-
/// <see langword="true" /> on success; <see langword="false" /> otherwise.
24-
/// </returns>
25-
Task<bool> RevokeAsync(string userId, string token);
17+
/// <summary>
18+
/// Revokes the refresh token of the user asynchronously
19+
/// </summary>
20+
/// <param name="userId">ID of the user whose token is being revoked.</param>
21+
/// <param name="token">Value of the token to be revoked.</param>
22+
/// <returns>
23+
/// <see langword="true" /> on success; <see langword="false" /> otherwise.
24+
/// </returns>
25+
Task<bool> RevokeAsync(string userId, string token);
2626

27-
/// <summary>
28-
/// Checks whether refresh token is valid asynchronously.
29-
/// </summary>
30-
/// <param name="userId">ID of the user whose token is being validated.</param>
31-
/// <param name="token">Value of the token to be validated.</param>
32-
/// <returns>
33-
/// <see langword="true" /> if token is valid;
34-
/// <see langword="false" /> otherwise.
35-
/// </returns>
36-
Task<bool> ValidateAsync(string userId, string token);
27+
/// <summary>
28+
/// Checks whether refresh token is valid asynchronously.
29+
/// </summary>
30+
/// <param name="userId">ID of the user whose token is being validated.</param>
31+
/// <param name="token">Value of the token to be validated.</param>
32+
/// <returns>
33+
/// <see langword="true" /> if token is valid;
34+
/// <see langword="false" /> otherwise.
35+
/// </returns>
36+
Task<bool> ValidateAsync(string userId, string token);
3737
}

0 commit comments

Comments
 (0)