fix: bulk-update-in-scheduleId-in-detailed-view (#19295)
* fix: bulk-update-in-scheduleId-in-detailed-view * minor-change --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
This commit is contained in:
co-authored by
Anik Dhabal Babu
parent
63d26c4fba
commit
f28c605b50
@@ -57,6 +57,7 @@ export const AvailabilitySettingsWebWrapper = ({
|
||||
bulkUpdateDefaultAvailabilityMutation.mutate(
|
||||
{
|
||||
eventTypeIds,
|
||||
selectedDefaultScheduleId: scheduleData?.id,
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
|
||||
+3
-3
@@ -16,10 +16,10 @@ export const bulkUpdateToDefaultAvailabilityHandler = async ({
|
||||
ctx,
|
||||
input,
|
||||
}: BulkUpdateToDefaultAvailabilityOptions) => {
|
||||
const { eventTypeIds } = input;
|
||||
const { eventTypeIds, selectedDefaultScheduleId } = input;
|
||||
const defaultScheduleId = ctx.user.defaultScheduleId;
|
||||
|
||||
if (!defaultScheduleId) {
|
||||
if (!selectedDefaultScheduleId && !defaultScheduleId) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Default schedule not set",
|
||||
@@ -34,7 +34,7 @@ export const bulkUpdateToDefaultAvailabilityHandler = async ({
|
||||
userId: ctx.user.id,
|
||||
},
|
||||
data: {
|
||||
scheduleId: defaultScheduleId,
|
||||
scheduleId: selectedDefaultScheduleId || defaultScheduleId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
+1
@@ -2,6 +2,7 @@ import { z } from "zod";
|
||||
|
||||
export const ZBulkUpdateToDefaultAvailabilityInputSchema = z.object({
|
||||
eventTypeIds: z.array(z.number()),
|
||||
selectedDefaultScheduleId: z.number().nullable().optional(),
|
||||
});
|
||||
|
||||
export type TBulkUpdateToDefaultAvailabilityInputSchema = z.infer<
|
||||
|
||||
Reference in New Issue
Block a user