diff --git a/src/config/authorization.ts b/src/config/authorization.ts index b637d058..9e1a6c41 100644 --- a/src/config/authorization.ts +++ b/src/config/authorization.ts @@ -13,7 +13,7 @@ * this program. If not, see . */ -import {SCUserConfiguration} from './user'; +import {SCUserConfigurationMap} from './user'; /** * Supported authorization provider types @@ -87,7 +87,7 @@ export interface SCAuthorizationProviderEndpoints { * * @see https://www.npmjs.com/package/jsonpath */ - mapping: { [key in keyof SCUserConfiguration]: string; }; + mapping: SCUserConfigurationMap; /** * URL to revoke a token diff --git a/src/config/user.ts b/src/config/user.ts index 971c6f9b..4487aeba 100644 --- a/src/config/user.ts +++ b/src/config/user.ts @@ -15,40 +15,50 @@ import {SCAcademicPriceGroup} from '../things/abstract/thing-that-can-be-offered'; +/** + * User configuration keys mapped to string type while including their requiredness + */ +export type SCUserConfigurationMap = { [K in keyof SCUserConfigurationOptional]?: string } & { [K in keyof SCUserConfigurationRequired]: string }; + /** * A user configuration */ -export interface SCUserConfiguration { - /** - * User's e-mail - */ - email?: string; - - /** - * User's family name - */ - familyName?: string; - - /** - * User's given name - */ - givenName?: string; +export type SCUserConfiguration = SCUserConfigurationRequired & SCUserConfigurationOptional; +/** + * A user configurations required properties + */ +interface SCUserConfigurationRequired { /** * ID given to the user */ id: string; - /** * The complete name of the user combining all the parts of the name into one */ name: string; - /** * Role assigned to the user */ role: keyof SCAcademicPriceGroup; +} +/** + * A user configurations optional properties + */ + interface SCUserConfigurationOptional { + /** + * User's e-mail + */ + email?: string; + /** + * User's family name + */ + familyName?: string; + /** + * User's given name + */ + givenName?: string; /** * Student ID given to the user */