Skip to content

Mariano/policy improvements#251

Merged
Marfuen merged 7 commits into
mainfrom
mariano/policy-improvements
Apr 3, 2025
Merged

Mariano/policy improvements#251
Marfuen merged 7 commits into
mainfrom
mariano/policy-improvements

Conversation

@Marfuen

@Marfuen Marfuen commented Apr 3, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Introduced an enhanced assignee selection interface in policy forms with improved visuals and simplified assignment.
    • Upgraded policy detail and update views to clearly indicate archival state and streamline interactions.
  • Refactor

    • Standardized terminology from “owner” to “assignee” for better consistency across policy management.
  • Chores

    • Updated the database schema and localization entries to support the refined policy workflow and user interface changes.

@vercel

vercel Bot commented Apr 3, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app 🔄 Building (Inspect) Visit Preview 💬 Add feedback Apr 3, 2025 5:21pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
comp-portal ⬜️ Skipped (Inspect) Apr 3, 2025 5:21pm

@coderabbitai

coderabbitai Bot commented Apr 3, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

This update refactors code formatting and business logic across various modules. Changes include re-indenting files, renaming variables from “owner” to “assignee”, and adjusting policy archiving conditions. Several UI components and pages have been updated to use new components and props, and the database schema has been restructured to drop the owner association in favor of an assignee, along with new fields and foreign key relations. Additional localization keys have been added. Overall, the changes streamline both frontend and backend aspects without modifying core functionality.

Changes

File(s) Change Summary
apps/app/src/actions/organization/lib/utils.ts
apps/app/src/actions/schema.ts
Code formatting adjustments: re-indented code (tabs → 2 spaces); no functional changes.
apps/app/src/actions/policies/archive-policy.ts
apps/app/src/actions/policies/create-new-policy.ts
apps/app/src/actions/policies/update-policy-form-action.ts
Policy actions refactored: updated archive logic (using isArchived), replaced ownerId with assigneeId, and added a member-check before policy creation.
apps/app/src/app/[locale]/…/components/SelectAssignee.tsx
apps/app/src/app/[locale]/…/evidence/[id]/components/ReviewSection.tsx
apps/app/src/components/forms/policies/UpdatePolicyOverview.tsx
apps/app/src/components/forms/policies/policy-overview.tsx
apps/app/src/components/policies/policy-overview.tsx
apps/app/src/components/policies/sheets/policy-archive-sheet.tsx
UI component updates: renamed components (e.g., EvidenceAssigneeSectionSelectAssignee), updated interfaces/props, integrated assignee selection logic, and adjusted rendering based on the new policy model.
apps/app/src/app/[locale]/…/policies/(overview)/page.tsx
apps/app/src/app/[locale]/…/policies/all/[policyId]/page.tsx
Page updates: modified policy filtering and grouping to use isArchived and assigneeId; introduced an async getAssignees function to retrieve member data.
apps/app/src/locales/features/policies.ts Localization: added new keys for policy assignee labels and placeholders.
packages/db/prisma/migrations/…migration.sql
packages/db/prisma/schema/auth.prisma
packages/db/prisma/schema/policy.prisma
Database schema changes: dropped ownerId, introduced assigneeId, isArchived, and lastArchivedAt; updated the PolicyStatus enum and restructured model relationships, shifting the policy relation from User to Member.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant PA as Policy Archive Sheet
    participant AP as archivePolicyAction
    participant DB as Database

    U->>PA: Initiate archive action
    PA->>AP: Call archivePolicyAction with policy data
    AP->>DB: Update policy (set isArchived = true)
    DB-->>AP: Return update result
    AP-->>PA: Send success response
    PA->>U: Display success message and redirect
Loading
sequenceDiagram
    participant U as User
    participant CP as createPolicyAction
    participant MC as Member Check
    participant DB as Database

    U->>CP: Submit new policy data
    CP->>MC: Verify member exists for organization
    alt Member exists
        MC-->>CP: Return member data (assigneeId)
        CP->>DB: Create policy with assigneeId and other details
        DB-->>CP: Confirm policy creation
        CP-->>U: Return success response
    else
        CP-->>U: Return error (member not found)
    end
Loading

Possibly related PRs

Poem

Oh, I’m a rabbit with code so neat,
Hopping through changes on nimble feet.
From owners to assignees, the fields now play,
In UI and schema, I scamper all day.
With migrations and merges, my burrow’s aglow—
A whimsical world where new features grow!
🐇✨ Hop on, let’s code and flow!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between efda483 and 833b26f.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (17)
  • apps/app/src/actions/organization/lib/utils.ts (9 hunks)
  • apps/app/src/actions/policies/archive-policy.ts (1 hunks)
  • apps/app/src/actions/policies/create-new-policy.ts (1 hunks)
  • apps/app/src/actions/policies/update-policy-form-action.ts (1 hunks)
  • apps/app/src/actions/schema.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/components/SelectAssignee.tsx (5 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[id]/components/ReviewSection.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/page.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/all/[policyId]/page.tsx (2 hunks)
  • apps/app/src/components/forms/policies/UpdatePolicyOverview.tsx (1 hunks)
  • apps/app/src/components/forms/policies/policy-overview.tsx (2 hunks)
  • apps/app/src/components/policies/policy-overview.tsx (3 hunks)
  • apps/app/src/components/policies/sheets/policy-archive-sheet.tsx (1 hunks)
  • apps/app/src/locales/features/policies.ts (1 hunks)
  • packages/db/prisma/migrations/20250403165218_archived_on_its_own/migration.sql (1 hunks)
  • packages/db/prisma/schema/auth.prisma (1 hunks)
  • packages/db/prisma/schema/policy.prisma (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant