feat: add DCB User Service API - Authentication system with KEYCLOAK - Modular architecture with services for each feature
This commit is contained in:
parent
403baaa0ef
commit
2b4f4ce1b8
@ -192,6 +192,53 @@ export class HubUserResponse {
|
|||||||
lastLogin?: number;
|
lastLogin?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MerchantUserResponse {
|
||||||
|
@ApiProperty({ description: 'User ID' })
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Username' })
|
||||||
|
username: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Email address' })
|
||||||
|
email: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'First name' })
|
||||||
|
firstName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Last name' })
|
||||||
|
lastName: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
enum: [UserRole.DCB_ADMIN, UserRole.DCB_SUPPORT, UserRole.DCB_PARTNER, UserRole.DCB_PARTNER_ADMIN, UserRole.DCB_PARTNER_MANAGER, UserRole.DCB_PARTNER_SUPPORT],
|
||||||
|
description: 'User role'
|
||||||
|
})
|
||||||
|
role: UserRole;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Whether the user is enabled' })
|
||||||
|
enabled: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Whether the email is verified' })
|
||||||
|
emailVerified: boolean;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false, description: 'Merchant partner ID' })
|
||||||
|
merchantPartnerId?: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'User creator ID' })
|
||||||
|
createdBy: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'User creator username' })
|
||||||
|
createdByUsername: string;
|
||||||
|
|
||||||
|
@ApiProperty({ enum: ['HUB', 'MERCHANT'], description: 'User type' })
|
||||||
|
userType: 'HUB' | 'MERCHANT';
|
||||||
|
|
||||||
|
@ApiProperty({ description: 'Creation timestamp' })
|
||||||
|
createdTimestamp: number;
|
||||||
|
|
||||||
|
@ApiProperty({ required: false, description: 'Last login timestamp' })
|
||||||
|
lastLogin?: number;
|
||||||
|
}
|
||||||
|
|
||||||
export class HubUserProfileResponse {
|
export class HubUserProfileResponse {
|
||||||
@ApiProperty({ description: 'User ID' })
|
@ApiProperty({ description: 'User ID' })
|
||||||
id: string;
|
id: string;
|
||||||
@ -252,6 +299,26 @@ function mapToHubUserResponse(user: User): HubUserResponse {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mapper functions
|
||||||
|
function mapToMerchantUserResponse(user: User): MerchantUserResponse {
|
||||||
|
return {
|
||||||
|
id: user.id,
|
||||||
|
username: user.username,
|
||||||
|
email: user.email,
|
||||||
|
firstName: user.firstName,
|
||||||
|
lastName: user.lastName,
|
||||||
|
role: user.role,
|
||||||
|
enabled: user.enabled,
|
||||||
|
emailVerified: user.emailVerified,
|
||||||
|
merchantPartnerId: user.merchantPartnerId,
|
||||||
|
createdBy: user.createdBy,
|
||||||
|
createdByUsername: user.createdByUsername,
|
||||||
|
userType: user.userType,
|
||||||
|
createdTimestamp: user.createdTimestamp,
|
||||||
|
lastLogin: user.lastLogin,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function mapToHubUserProfileResponse(profile: any): HubUserProfileResponse {
|
function mapToHubUserProfileResponse(profile: any): HubUserProfileResponse {
|
||||||
return {
|
return {
|
||||||
id: profile.id,
|
id: profile.id,
|
||||||
@ -413,7 +480,7 @@ export class HubUsersController {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
hubUsers: hubUsers.map(mapToHubUserResponse),
|
hubUsers: hubUsers.map(mapToHubUserResponse),
|
||||||
merchantUsers: merchantUsers.map(mapToHubUserResponse),
|
merchantUsers: merchantUsers.map(mapToMerchantUserResponse),
|
||||||
statistics: {
|
statistics: {
|
||||||
totalHubUsers: hubUsers.length,
|
totalHubUsers: hubUsers.length,
|
||||||
totalMerchantUsers: merchantUsers.length,
|
totalMerchantUsers: merchantUsers.length,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user