feat(identity): redesign identity module and introduce RBAC foundation
- 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.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
Note :
|
||||
- pastikan berada di branch yang benar.
|
||||
-
|
||||
|
||||
Requirement :
|
||||
- Node.js 22 LTS
|
||||
|
||||
Step :
|
||||
1. jalankan "NPM Install".
|
||||
2. generate prisma client "npx prisma generate".
|
||||
3. jalankan "cp env.example env" atau buat file .env baru.
|
||||
4. sesuaikan isi dari .env
|
||||
|
||||
Run Server :
|
||||
- npm run start:dev
|
||||
|
||||
Command Dev :
|
||||
- npm test
|
||||
- npm run lint
|
||||
- npm run format
|
||||
- npx prisma studio {untuk cek db}
|
||||
|
||||
Test API :
|
||||
- menggunakan postman :
|
||||
arahkan ke file /postman/RayLab.postman_collection.json
|
||||
- menggunakan swagger :
|
||||
- masuk ke http://localhost:port/apilist
|
||||
- klik authorize dan masukkan jwt token
|
||||
|
||||
Controller Requirement :
|
||||
- diatas deklarasi class controller pastikan ada ini :
|
||||
- @ApiTags('object')
|
||||
- @Controller('object')
|
||||
- @UseGuards(JwtAuthGuard, PermissionGuard)
|
||||
|
||||
- diatas deklarasi method controller pastikan ada ini :
|
||||
- tipe api : @Post(), @Get(':id'), @Patch(':id'), @Delete(':id')
|
||||
- @Permissions(PermissionType.SOMETHING)
|
||||
- @ApiOperation({ summary: 'penjelasan singkat api' })
|
||||
|
||||
Table :
|
||||
- untuk table akan dibuat otomatis oleh schema.prisma, disana hanya perlu ditambahkan model atau diubah, jalankan commandnya, setelah itu otomatis tablenya dibuat
|
||||
- command : npx prisma migrate dev --name {Nama Perubahan}
|
||||
|
||||
Use case:
|
||||
- penentuan use case ditentukan siapa pemiliknya dahulu, dan harus konsisten.
|
||||
Reference in New Issue
Block a user