feat: add missing crud to provider identity service (#8717)
This commit is contained in:
1 parent
335061d8cd
commit
bb4c58d526
5 files changed
+237
-4
No files matched your search
@@ -152,7 +152,7 @@ export type UpdateProviderIdentityDTO = {
|
||||
* The user's identifier. For example, when using the `emailpass`
|
||||
* provider, the `entity_id` would be the user's email.
|
||||
*/
|
||||
entity_id: string
|
||||
entity_id?: string
|
||||
|
||||
/**
|
||||
* Holds custom data related to the provider in key-value pairs.
|
||||
@@ -192,3 +192,31 @@ export interface FilterableAuthIdentityProps
|
||||
|
||||
app_metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface FilterableProviderIdentityProps
|
||||
extends BaseFilterable<FilterableProviderIdentityProps> {
|
||||
/**
|
||||
* The IDs to filter the provider identity by.
|
||||
*/
|
||||
id?: string[]
|
||||
|
||||
/**
|
||||
* Filter the provider identities by the ID of the provider identity they are linked to.
|
||||
*/
|
||||
entity_id?: string
|
||||
|
||||
/**
|
||||
* The provider handle to filter the provider identity by.
|
||||
*/
|
||||
provider?: string
|
||||
|
||||
/**
|
||||
* Holds custom data related to the provider in key-value pairs.
|
||||
*/
|
||||
provider_metadata?: Record<string, unknown>
|
||||
|
||||
/**
|
||||
* Holds custom data related to the user in key-value pairs.
|
||||
*/
|
||||
user_metadata?: Record<string, unknown>
|
||||
}
|
||||
@@ -8,8 +8,10 @@ import {
|
||||
CreateAuthIdentityDTO,
|
||||
CreateProviderIdentityDTO,
|
||||
FilterableAuthIdentityProps,
|
||||
FilterableProviderIdentityProps,
|
||||
ProviderIdentityDTO,
|
||||
UpdateAuthIdentityDTO,
|
||||
UpdateProviderIdentityDTO,
|
||||
} from "./common"
|
||||
|
||||
/**
|
||||
@@ -277,6 +279,62 @@ export interface IAuthModuleService extends IModuleService {
|
||||
*/
|
||||
deleteAuthIdentities(ids: string[], sharedContext?: Context): Promise<void>
|
||||
|
||||
/**
|
||||
* This method retrieves a provider identity by its ID.
|
||||
*
|
||||
* @param {string} id - The ID of the provider identity.
|
||||
* @param {FindConfig<ProviderIdentityDTO>} config - The configurations determining how the provider identity is retrieved. Its properties, such as `select` or `relations`, accept the
|
||||
* attributes or relations associated with a provider identity.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<ProviderIdentityDTO>} The retrieved provider identity.
|
||||
*
|
||||
* @example
|
||||
* const providerIdentity = await authModuleService.retrieveProviderIdentity("provider_123")
|
||||
*/
|
||||
retrieveProviderIdentity(
|
||||
id: string,
|
||||
config?: FindConfig<ProviderIdentityDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<ProviderIdentityDTO>
|
||||
|
||||
/**
|
||||
* This method retrieves a paginated list of provider identities based on optional filters and configuration.
|
||||
*
|
||||
* @param {FilterableProviderIdentityProps} filters - The filters to apply on the retrieved provider identities.
|
||||
* @param {FindConfig<ProviderIdentityDTO>} config - The configurations determining how the provider identity is retrieved. Its properties, such as `select` or `relations`, accept the
|
||||
* attributes or relations associated with a provider identity.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<ProviderIdentityDTO[]>} The list of provider identities.
|
||||
*
|
||||
* @example
|
||||
* To retrieve a list of provider identities using their IDs:
|
||||
*
|
||||
* ```ts
|
||||
* const providerIdentities = await authModuleService.listProviderIdentities({
|
||||
* id: ["provider_123", "provider_234"],
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
*
|
||||
* ```ts
|
||||
* const providerIdentities = await authModuleService.listProviderIdentities(
|
||||
* {
|
||||
* id: ["provider_123", "provider_234"],
|
||||
* },
|
||||
* {
|
||||
* take: 20,
|
||||
* skip: 2,
|
||||
* }
|
||||
* )
|
||||
* ```
|
||||
*/
|
||||
listProviderIdentities(
|
||||
filters?: FilterableProviderIdentityProps,
|
||||
config?: FindConfig<ProviderIdentityDTO>,
|
||||
sharedContext?: Context
|
||||
): Promise<ProviderIdentityDTO[]>
|
||||
|
||||
/**
|
||||
* This method creates provider identities.
|
||||
*
|
||||
@@ -321,4 +379,55 @@ export interface IAuthModuleService extends IModuleService {
|
||||
data: CreateProviderIdentityDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProviderIdentityDTO>
|
||||
|
||||
/**
|
||||
* This method updates existing provider identities.
|
||||
*
|
||||
* @param {UpdateProviderIdentityDTO[]} data - The attributes to update in the provider identities.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<ProviderIdentityDTO[]>} The updated provider identities.
|
||||
*
|
||||
* @example
|
||||
* const providerIdentities = await authModuleService.updateProviderIdentities([
|
||||
* {
|
||||
* id: "provider_123",
|
||||
* },
|
||||
* ])
|
||||
*/
|
||||
updateProviderIdentites(
|
||||
data: UpdateProviderIdentityDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<ProviderIdentityDTO[]>
|
||||
|
||||
/**
|
||||
* This method updates an existing provider identity.
|
||||
*
|
||||
* @param {UpdateProviderIdentityDTO} data - The attributes to update in the provider identity.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<ProviderIdentityDTO>} The updated provider identity.
|
||||
*
|
||||
* @example
|
||||
* const providerIdentity = await authModuleService.updateProviderIdentites({
|
||||
* id: "provider_123",
|
||||
* })
|
||||
*/
|
||||
updateProviderIdentites(
|
||||
data: UpdateProviderIdentityDTO,
|
||||
sharedContext?: Context
|
||||
): Promise<ProviderIdentityDTO>
|
||||
|
||||
/**
|
||||
* This method deletes a provider identity by its ID.
|
||||
*
|
||||
* @param {string[]} ids - The IDs of the provider identity.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<void>} Resolves when {summary}
|
||||
*
|
||||
* @example
|
||||
* await authModuleService.deleteProviderIdentities(["provider_123", "provider_234"])
|
||||
*/
|
||||
deleteProviderIdentities(
|
||||
ids: string[],
|
||||
sharedContext?: Context
|
||||
): Promise<void>
|
||||
}
|
||||
Reference in new issue
Block a user