Skip to content

Commit e2b7812

Browse files
committed
address comments
1 parent 8120712 commit e2b7812

File tree

3 files changed

+24
-55
lines changed

3 files changed

+24
-55
lines changed

apps/sim/app/api/tools/workday/create-prehire/route.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ export async function POST(request: NextRequest) {
3232
const body = await request.json()
3333
const data = RequestSchema.parse(body)
3434

35+
if (!data.email && !data.phoneNumber && !data.address) {
36+
return NextResponse.json(
37+
{
38+
success: false,
39+
error: 'At least one contact method (email, phone, or address) is required',
40+
},
41+
{ status: 400 }
42+
)
43+
}
44+
3545
const parts = data.legalName.trim().split(/\s+/)
3646
const firstName = parts[0] ?? ''
3747
const lastName = parts.length > 1 ? parts.slice(1).join(' ') : (parts[0] ?? '')
@@ -44,16 +54,6 @@ export async function POST(request: NextRequest) {
4454
data.password
4555
)
4656

47-
if (!data.email && !data.phoneNumber && !data.address) {
48-
return NextResponse.json(
49-
{
50-
success: false,
51-
error: 'At least one contact method (email, phone, or address) is required',
52-
},
53-
{ status: 400 }
54-
)
55-
}
56-
5757
const contactData: Record<string, unknown> = {}
5858
if (data.email) {
5959
contactData.Email_Address_Data = [

apps/sim/blocks/blocks/workday.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,27 @@ Output: {"businessTitle": "Senior Engineer"}`,
349349
config: {
350350
tool: (params) => `workday_${params.operation}`,
351351
params: (params) => {
352-
const { operation, orgType, fields, ...rest } = params
352+
const {
353+
operation,
354+
orgType,
355+
fields,
356+
positionId,
357+
jobProfileId,
358+
locationId,
359+
managerId,
360+
...rest
361+
} = params
353362

354363
if (rest.limit != null && rest.limit !== '') rest.limit = Number(rest.limit)
355364
if (rest.offset != null && rest.offset !== '') rest.offset = Number(rest.offset)
356365

357366
if (orgType) rest.type = orgType
358367

359368
if (operation === 'change_job') {
360-
if (rest.positionId) rest.newPositionId = rest.positionId
361-
if (rest.jobProfileId) rest.newJobProfileId = rest.jobProfileId
362-
if (rest.locationId) rest.newLocationId = rest.locationId
363-
if (rest.managerId) rest.newManagerId = rest.managerId
369+
if (positionId) rest.newPositionId = positionId
370+
if (jobProfileId) rest.newJobProfileId = jobProfileId
371+
if (locationId) rest.newLocationId = locationId
372+
if (managerId) rest.newManagerId = managerId
364373
}
365374

366375
if (fields && operation === 'update_worker') {

apps/sim/tools/workday/utils.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)