Skip to content

Commit

Permalink
fix: add missing modifieddate
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Jul 10, 2024
1 parent 5a37563 commit 8fd6329
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/schema/resolvers/Mutation/createInvitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { protect } from "@/auth";
import { sql } from "@/datasources/postgres";
import type { MutationResolvers } from "@/schema";
import { clerkClient } from "@clerk/clerk-sdk-node";
import { isClerkAPIResponseError, isClerkRuntimeError } from "@clerk/shared";
import { isClerkAPIResponseError } from "@clerk/shared";
import { GraphQLError } from "graphql";

export const createInvitation: NonNullable<
Expand Down Expand Up @@ -37,7 +37,24 @@ export const createInvitation: NonNullable<
// Doesn't work without it :/
await sql`
UPDATE public.worker AS u
SET workerusername = ${input.email_address}
SET
workerusername = ${input.email_address},
workermodifieddate = NOW(),
workermodifiedby = (
SELECT workerinstanceid
FROM public.workerinstance
WHERE
workerinstancecustomerid = (
SELECT customerid
FROM public.customer
WHERE customeruuid = ${input.org_id}
)
AND workerinstanceworkerid = (
SELECT workerid
FROM public.worker
WHERE workeridentityid = ${ctx.auth.userId}
)
)
FROM public.workerinstance AS w
WHERE
u.workerid = w.workerinstanceworkerid
Expand Down

0 comments on commit 8fd6329

Please sign in to comment.