Skip to content

Commit c4bc45c

Browse files
committed
chore: update @trycompai/db version and remove signature requirement fields
- Updated the @trycompai/db dependency version to 1.3.3 in package.json and bun.lock files. - Removed the isRequiredToSign field from various policy-related actions and components to simplify the policy management process.
1 parent bfdbb15 commit c4bc45c

File tree

13 files changed

+11
-86
lines changed

13 files changed

+11
-86
lines changed

apps/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@tiptap/extension-table-row": "^2.22.3",
4747
"@trigger.dev/react-hooks": "3.3.17",
4848
"@trigger.dev/sdk": "3.3.17",
49-
"@trycompai/db": "^1.3.2",
49+
"@trycompai/db": "^1.3.3",
5050
"@types/canvas-confetti": "^1.9.0",
5151
"@types/three": "^0.177.0",
5252
"@uploadthing/react": "^7.3.0",

apps/app/src/actions/policies/submit-policy-for-approval-action.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ export const submitPolicyForApprovalAction = authActionClient
1616
},
1717
})
1818
.action(async ({ parsedInput, ctx }) => {
19-
const {
20-
id,
21-
assigneeId,
22-
department,
23-
review_frequency,
24-
review_date,
25-
isRequiredToSign,
26-
approverId,
27-
} = parsedInput;
19+
const { id, assigneeId, department, review_frequency, review_date, approverId } = parsedInput;
2820
const { user, session } = ctx;
2921

3022
if (!user.id || !session.activeOrganizationId) {
@@ -49,7 +41,6 @@ export const submitPolicyForApprovalAction = authActionClient
4941
department,
5042
frequency: review_frequency,
5143
reviewDate: newReviewDate,
52-
isRequiredToSign: isRequiredToSign === 'required',
5344
approverId,
5445
},
5546
});

apps/app/src/actions/policies/update-policy-form-action.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ export const updatePolicyFormAction = authActionClient
4040
},
4141
})
4242
.action(async ({ parsedInput, ctx }) => {
43-
const { id, status, assigneeId, department, review_frequency, review_date, isRequiredToSign } =
44-
parsedInput;
43+
const { id, status, assigneeId, department, review_frequency, review_date } = parsedInput;
4544
const { user, session } = ctx;
4645

4746
if (!user.id || !session.activeOrganizationId) {
@@ -81,7 +80,6 @@ export const updatePolicyFormAction = authActionClient
8180
department,
8281
frequency: review_frequency,
8382
reviewDate,
84-
isRequiredToSign: isRequiredToSign === 'required',
8583
...(lastPublishedAt && { lastPublishedAt }),
8684
},
8785
});

apps/app/src/actions/policies/update-policy-overview-action.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const updatePolicyOverviewAction = authActionClient
1818
},
1919
})
2020
.action(async ({ parsedInput, ctx }) => {
21-
const { id, title, description, isRequiredToSign } = parsedInput;
21+
const { id, title, description } = parsedInput;
2222
const { user, session } = ctx;
2323

2424
if (!user) {
@@ -52,13 +52,6 @@ export const updatePolicyOverviewAction = authActionClient
5252
data: {
5353
name: title,
5454
description,
55-
// Use type assertion to handle the new field
56-
// that might not be in the generated types yet
57-
...(isRequiredToSign !== undefined
58-
? ({
59-
isRequiredToSign: isRequiredToSign === 'required',
60-
} as any)
61-
: {}),
6255
},
6356
});
6457

apps/app/src/actions/schema.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ export const updatePolicyOverviewSchema = z.object({
291291
id: z.string(),
292292
title: z.string(),
293293
description: z.string(),
294-
isRequiredToSign: z.enum(['required', 'not_required']).optional(),
295294
entityId: z.string(),
296295
});
297296

@@ -302,7 +301,6 @@ export const updatePolicyFormSchema = z.object({
302301
department: z.nativeEnum(Departments),
303302
review_frequency: z.nativeEnum(Frequency),
304303
review_date: z.date(),
305-
isRequiredToSign: z.enum(['required', 'not_required']),
306304
approverId: z.string().optional().nullable(), // Added for selecting an approver
307305
entityId: z.string(),
308306
});

apps/app/src/app/(app)/[orgId]/people/[employeeId]/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ const getPoliciesTasks = async (employeeId: string) => {
100100
const policies = await db.policy.findMany({
101101
where: {
102102
organizationId: organizationId,
103-
isRequiredToSign: true,
104103
},
105104
orderBy: {
106105
name: 'asc',

apps/app/src/app/(app)/[orgId]/people/dashboard/components/EmployeesOverview.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,10 @@ export async function EmployeesOverview() {
5252
return roles.includes('employee');
5353
});
5454

55-
console.log(employees);
56-
5755
// Fetch required policies
5856
policies = await db.policy.findMany({
5957
where: {
6058
organizationId: organizationId,
61-
isRequiredToSign: true,
6259
},
6360
});
6461

apps/app/src/app/(app)/[orgId]/policies/[policyId]/components/UpdatePolicyOverview.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ export function UpdatePolicyOverview({
104104
const assigneeId = selectedAssigneeId; // Use state instead of form data
105105
const department = formData.get('department') as Departments;
106106
const reviewFrequency = formData.get('review_frequency') as Frequency;
107-
const isRequiredToSign =
108-
formData.get('isRequiredToSign') === 'on' ? 'required' : 'not_required';
109107

110108
// Get review date from the form or use the existing one
111109
const reviewDate = tempDate || (policy.reviewDate ? new Date(policy.reviewDate) : new Date());
@@ -117,7 +115,6 @@ export function UpdatePolicyOverview({
117115
assigneeId !== policy.assigneeId ||
118116
department !== policy.department ||
119117
reviewFrequency !== policy.frequency ||
120-
(policy.isRequiredToSign ? 'required' : 'not_required') !== isRequiredToSign ||
121118
(policy.reviewDate ? new Date(policy.reviewDate).toDateString() : '') !==
122119
reviewDate.toDateString());
123120

@@ -133,7 +130,6 @@ export function UpdatePolicyOverview({
133130
department,
134131
review_frequency: reviewFrequency,
135132
review_date: reviewDate,
136-
isRequiredToSign,
137133
approverId: null,
138134
entityId: policy.id,
139135
});
@@ -152,8 +148,6 @@ export function UpdatePolicyOverview({
152148
const assigneeId = selectedAssigneeId; // Use state instead of form data
153149
const department = formData.get('department') as Departments;
154150
const reviewFrequency = formData.get('review_frequency') as Frequency;
155-
const isRequiredToSign =
156-
formData.get('isRequiredToSign') === 'on' ? 'required' : 'not_required';
157151

158152
// Get review date from the form or use the existing one
159153
const reviewDate = tempDate || (policy.reviewDate ? new Date(policy.reviewDate) : new Date());
@@ -166,7 +160,6 @@ export function UpdatePolicyOverview({
166160
department,
167161
review_frequency: reviewFrequency,
168162
review_date: reviewDate,
169-
isRequiredToSign,
170163
approverId: selectedApproverId,
171164
entityId: policy.id,
172165
});

apps/app/src/components/forms/policies/policy-overview.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { cn } from '@comp/ui/cn';
1010
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@comp/ui/form';
1111
import { Popover, PopoverContent, PopoverTrigger } from '@comp/ui/popover';
1212
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@comp/ui/select';
13-
import { Switch } from '@comp/ui/switch';
1413
import { Departments, Frequency, type Policy, type PolicyStatus } from '@db';
1514
import { zodResolver } from '@hookform/resolvers/zod';
1615
import { format } from 'date-fns';
@@ -52,7 +51,6 @@ export function UpdatePolicyOverview({ policy }: { policy: Policy }) {
5251
department: policy.department ?? Departments.admin,
5352
review_frequency: policy.frequency ?? Frequency.monthly,
5453
review_date: reviewDate,
55-
isRequiredToSign: policy.isRequiredToSign ? 'required' : 'not_required',
5654
},
5755
});
5856

@@ -64,7 +62,6 @@ export function UpdatePolicyOverview({ policy }: { policy: Policy }) {
6462
department: data.department,
6563
review_frequency: data.review_frequency,
6664
review_date: data.review_date,
67-
isRequiredToSign: data.isRequiredToSign,
6865
entityId: data.id,
6966
});
7067
};
@@ -194,24 +191,6 @@ export function UpdatePolicyOverview({ policy }: { policy: Policy }) {
194191
</FormItem>
195192
)}
196193
/>
197-
<FormField
198-
control={form.control}
199-
name="isRequiredToSign"
200-
render={({ field }) => (
201-
<FormItem className="flex flex-col gap-3">
202-
<FormLabel>{'Signature Requirement'}</FormLabel>
203-
<FormControl>
204-
<Switch
205-
checked={field.value === 'required'}
206-
onCheckedChange={(checked) => {
207-
field.onChange(checked ? 'required' : 'not_required');
208-
}}
209-
/>
210-
</FormControl>
211-
<FormMessage />
212-
</FormItem>
213-
)}
214-
/>
215194
</div>
216195
<div className="mt-4 flex justify-end">
217196
<Button

apps/app/src/components/forms/policies/update-policy-form.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@c
66
import { Button } from '@comp/ui/button';
77
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@comp/ui/form';
88
import { Input } from '@comp/ui/input';
9-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@comp/ui/select';
109
import { Textarea } from '@comp/ui/textarea';
1110
import { Policy } from '@db';
1211
import { zodResolver } from '@hookform/resolvers/zod';
@@ -36,7 +35,6 @@ export function UpdatePolicyForm({ policy }: { policy: Policy }) {
3635
id: policy.id,
3736
title: policy.name,
3837
description: policy.description ?? '',
39-
isRequiredToSign: policy.isRequiredToSign ? 'required' : 'not_required',
4038
entityId: policy.id,
4139
},
4240
});
@@ -47,7 +45,6 @@ export function UpdatePolicyForm({ policy }: { policy: Policy }) {
4745
id: data.id,
4846
title: data.title,
4947
description: data.description,
50-
isRequiredToSign: data.isRequiredToSign,
5148
entityId: data.id,
5249
});
5350
};
@@ -97,28 +94,6 @@ export function UpdatePolicyForm({ policy }: { policy: Policy }) {
9794
</FormItem>
9895
)}
9996
/>
100-
<FormField
101-
control={form.control}
102-
name="isRequiredToSign"
103-
render={({ field }) => (
104-
<FormItem>
105-
<FormLabel>{'Signature Requirement'}</FormLabel>
106-
<FormControl>
107-
<div className="mt-3">
108-
<Select value={field.value} onValueChange={field.onChange}>
109-
<SelectTrigger>
110-
<SelectValue placeholder={'Select signature requirement'} />
111-
</SelectTrigger>
112-
<SelectContent>
113-
<SelectItem value="required">{'Required'}</SelectItem>
114-
<SelectItem value="not_required">{'Not Required'}</SelectItem>
115-
</SelectContent>
116-
</Select>
117-
</div>
118-
</FormControl>
119-
</FormItem>
120-
)}
121-
/>
12297
</div>
12398
<div className="mt-8 flex justify-end">
12499
<Button

0 commit comments

Comments
 (0)