From d8d32b74adcfe6dc48014068e8c7213fbeb91e65 Mon Sep 17 00:00:00 2001 From: Igor Zalutski Date: Wed, 20 Nov 2024 13:22:59 -0800 Subject: [PATCH] Add auto-approve checkbox --- prisma/schema.prisma | 17 +++++++++-------- .../ProjectSettings.tsx | 17 +++++++++++++++++ src/data/user/projects.tsx | 3 +++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 1a7fc9fb..8a9aa406 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -522,6 +522,7 @@ model projects { workflow_file String? include_patterns String? exclude_patterns String? + auto_approve Boolean @default(false) chats chats[] digger_runs digger_runs[] env_vars env_vars[] @@ -655,19 +656,19 @@ model user_profiles { user_roles user_roles[] } - model user_m2m_applications { - id Int @id @default(autoincrement()) + id Int @id @default(autoincrement()) email String - clientId String @unique - audience String? - issuer String? + clientId String @unique + audience String + issuer String name String? description String? - createdAt DateTime @default(now()) @map("created_at") - updatedAt DateTime @default(now()) @updatedAt @map("updated_at") -} + createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6) + updatedAt DateTime? @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6) + @@index([email], map: "m2m_application_user_id_idx") +} /// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info. diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)/ProjectSettings.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)/ProjectSettings.tsx index 06a233cd..1276b113 100644 --- a/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)/ProjectSettings.tsx +++ b/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/project/[projectSlug]/(specific-project-pages)/ProjectSettings.tsx @@ -31,6 +31,7 @@ type ProjectSettingsFormData = { managedState: boolean; is_drift_detection_enabled: boolean; drift_crontab: string; + auto_approve: boolean; }; export default function ProjectSettings({ project, repositoryName }: ProjectSettingsProps) { @@ -46,6 +47,7 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett managedState: project.is_managing_state || false, is_drift_detection_enabled: project.is_drift_detection_enabled || false, drift_crontab: project.drift_crontab || '', + auto_approve: project.auto_approve || false, }, }); @@ -63,6 +65,7 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett managedState: data.managedState, is_drift_detection_enabled: data.is_drift_detection_enabled, drift_crontab: data.drift_crontab, + auto_approve: data.auto_approve, }); return result; }, @@ -276,6 +279,20 @@ export default function ProjectSettings({ project, repositoryName }: ProjectSett /> +
+ + ( + + )} + /> +
+ > { const prisma = new PrismaClient(); @@ -1012,6 +1014,7 @@ export async function updateProjectSettingsAction({ is_managing_state: managedState, is_drift_detection_enabled, drift_crontab, + auto_approve, } });