- Redesign the Identity module with a richer domain model. - Extend the User entity to support username, Authentik integration, activity tracking, and storage information. - Add Role and Permission domain models with many-to-many relationships. - Implement RBAC foundation using UserRole, RolePermission, and UserPermission mappings. - Add user storage quota and usage fields with default values. - Introduce Authentik identifiers and synchronization metadata. - Refactor user domain logic for role and permission management. - Update Prisma schema to support the new identity architecture. - Improve JWT authentication and permission guard integration. - Update repositories, handlers, controllers, mappers, DTOs, and Swagger configuration. - Refresh environment configuration and project dependencies.
27 lines
763 B
TypeScript
27 lines
763 B
TypeScript
import { RoleData } from '../../domain/entities/role.entity';
|
|
import { PermissionData } from '../../domain/entities/permission.entity';
|
|
|
|
export class PrismaRoleMapper {
|
|
static toDomain(model: any): RoleData {
|
|
const permissions: PermissionData[] = (model.permissions || []).map((p: any) =>
|
|
PermissionData.restore({
|
|
id: p.id,
|
|
name: p.name,
|
|
description: p.description,
|
|
createdAt: p.createdAt,
|
|
updatedAt: p.updatedAt,
|
|
}),
|
|
);
|
|
|
|
return RoleData.restore({
|
|
id: model.id,
|
|
code: model.code,
|
|
name: model.name,
|
|
description: model.description,
|
|
permissions,
|
|
isDefault: model.isDefault ?? false,
|
|
createdAt: model.createdAt,
|
|
updatedAt: model.updatedAt,
|
|
});
|
|
}
|
|
} |