Interface IUserRepository
Defines the contract for user data access operations.
Namespace: OEMS.Core.Domain.RepoInterfaces
Assembly: OEMS.Core.dll
Syntax
public interface IUserRepository
Methods
CheckEmailExistsAsync(string)
Checks if an email address is already registered in the system.
Declaration
Task<bool> CheckEmailExistsAsync(string email)
Parameters
Type | Name | Description |
---|---|---|
string | The email address to check. |
Returns
Type | Description |
---|---|
Task<bool> | A task that represents the asynchronous operation. The task result contains true if the email exists; otherwise, false. |
CheckUsernameExistsAsync(string)
Checks if a username is already taken in the system.
Declaration
Task<bool> CheckUsernameExistsAsync(string username)
Parameters
Type | Name | Description |
---|---|---|
string | username | The username to check. |
Returns
Type | Description |
---|---|
Task<bool> | A task that represents the asynchronous operation. The task result contains true if the username exists; otherwise, false. |
CreateUserAsync(User)
Creates a new user in the data store.
Declaration
Task<bool> CreateUserAsync(User user)
Parameters
Type | Name | Description |
---|---|---|
User | user | The user entity to create. |
Returns
Type | Description |
---|---|
Task<bool> | A task that represents the asynchronous operation. The task result contains true if the creation was successful; otherwise, false. |
DeleteUserAsync(Guid)
Deletes a user from the data store.
Declaration
Task<bool> DeleteUserAsync(Guid id)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The unique identifier of the user to delete. |
Returns
Type | Description |
---|---|
Task<bool> | A task that represents the asynchronous operation. The task result contains true if the deletion was successful; otherwise, false. |
GetUserByEmailAsync(string)
Retrieves a user by their email address.
Declaration
Task<User> GetUserByEmailAsync(string email)
Parameters
Type | Name | Description |
---|---|---|
string | The email address of the user. |
Returns
Type | Description |
---|---|
Task<User> | A task that represents the asynchronous operation. The task result contains the user entity or null if not found. |
GetUserByIdAsync(Guid)
Retrieves a user by their unique identifier.
Declaration
Task<User> GetUserByIdAsync(Guid id)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The unique identifier of the user. |
Returns
Type | Description |
---|---|
Task<User> | A task that represents the asynchronous operation. The task result contains the user entity or null if not found. |
GetUserByUsernameAsync(string)
Retrieves a user by their username.
Declaration
Task<User> GetUserByUsernameAsync(string username)
Parameters
Type | Name | Description |
---|---|---|
string | username | The username of the user. |
Returns
Type | Description |
---|---|
Task<User> | A task that represents the asynchronous operation. The task result contains the user entity or null if not found. |
GetUserOrganizationsAsync(Guid)
Retrieves all organization memberships for a specific user.
Declaration
Task<List<OrganizationUser>> GetUserOrganizationsAsync(Guid userId)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | The unique identifier of the user. |
Returns
Type | Description |
---|---|
Task<List<OrganizationUser>> | A task that represents the asynchronous operation. The task result contains a list of organization user entities. |
GetUsersByIdsAsync(List<Guid>)
Retrieves multiple users by their unique identifiers.
Declaration
Task<List<User>> GetUsersByIdsAsync(List<Guid> userIds)
Parameters
Type | Name | Description |
---|---|---|
List<Guid> | userIds | A list of user identifiers to retrieve. |
Returns
Type | Description |
---|---|
Task<List<User>> | A task that represents the asynchronous operation. The task result contains a list of user entities. |
HasRoleInOrganizationAsync(Guid, Guid, string)
Checks if a user has a specific role within an organization.
Declaration
Task<bool> HasRoleInOrganizationAsync(Guid userId, Guid organizationId, string role)
Parameters
Type | Name | Description |
---|---|---|
Guid | userId | The unique identifier of the user. |
Guid | organizationId | The unique identifier of the organization. |
string | role | The role to check for. |
Returns
Type | Description |
---|---|
Task<bool> | A task that represents the asynchronous operation. The task result contains true if the user has the specified role; otherwise, false. |
UpdateUserAsync(User)
Updates an existing user in the data store.
Declaration
Task<bool> UpdateUserAsync(User user)
Parameters
Type | Name | Description |
---|---|---|
User | user | The user entity with updated information. |
Returns
Type | Description |
---|---|
Task<bool> | A task that represents the asynchronous operation. The task result contains true if the update was successful; otherwise, false. |