emoss08 / Trenova

An Open Source AI-driven asset based transportation management system
http://trenova.app
Other
25 stars 7 forks source link

✨(feat): role based access control w/ casbin #270

Closed emoss08 closed 3 months ago

emoss08 commented 3 months ago

Summary by Sourcery

This pull request introduces role-based access control using Casbin, adds drag-and-drop functionality for assigning tractors to shipments, and implements optimistic locking for various models. It also includes several refactorings and enhancements to improve code readability, maintainability, and data consistency.

sourcery-ai[bot] commented 3 months ago

Reviewer's Guide by Sourcery

This pull request introduces role-based access control (RBAC) using Casbin. The changes include significant refactoring and enhancements across multiple files to integrate Casbin for permission management, update data models, and improve the shipment management UI.

File-Level Changes

Files Changes
web/frontend/src/components/shipment-management/shipment-list.tsx
web/frontend/src/components/shipment-management/shipment-list-view.tsx
Refactored shipment management components to support drag-and-drop functionality and improved UI with new components and pagination.
pkg/models/location.go
pkg/models/equipment_type.go
pkg/models/tractor.go
pkg/models/accessorial_charge.go
pkg/models/worker.go
pkg/models/division_code.go
pkg/models/user.go
pkg/models/organization.go
pkg/models/fleet_code.go
pkg/models/document_classification.go
Added optimistic locking support with versioning and updated validation rules across multiple data models.
internal/api/handlers/tractor.handler.go
internal/api/handlers/equipmenttype.handler.go
internal/api/handlers/organization.handler.go
Refactored API handlers to use Casbin for permission checks and simplified method signatures.
internal/api/services/permission.service.go
fixtures/seeder.go
fixtures/load_roles.go
fixtures/load_adminaccount.go
Integrated Casbin for role-based access control, refactored permission service, and updated fixture loading to include role and permission setup with Casbin.

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.